ivanmurashko added a comment. In D130847#3690977 <https://reviews.llvm.org/D130847#3690977>, @aaron.ballman wrote:
> > Given that this code is on the hot path, should it be the caller's > responsibility to have already validated the `FileID` that's passed in so > that the fake entry can never be returned? That is a good point. The crash that I am trying to fix uses incorrectly assigned `SourceManager::LastFileIDLookup`, see SourceManager::getFileID <https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Basic/SourceManager.h#L1112>. It's worth avoiding the incorrect cache value assignment. I could determine the place at the code where the assignment was made and updated the patch accordingly. @aaron.ballman, could you look at the update. Is it reasonable? Note: the change introduces a check that similar to one made previously <https://reviews.llvm.org/rG7dc4f33c77acd90b3217b94e50965bbcefbcd55f> for the rest of the search procedure ================ Comment at: clang/include/clang/Basic/SourceManager.h:1112-1113 // If our one-entry cache covers this offset, just return it. if (isOffsetInFileID(LastFileIDLookup, SLocOffset)) return LastFileIDLookup; ---------------- nit: There is the place when `isOffsetInFileID` produces a wrong result at my case Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D130847/new/ https://reviews.llvm.org/D130847 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits