[PATCH] D130847: [clang] SourceManager: fix isOffsetInFileID for the case of a fake SLocEntry
Ivan Murashko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 8 16:03:37 PDT 2022
ivanmurashko updated this revision to Diff 450989.
ivanmurashko added a comment.
stop search if we could not load an entry
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130847/new/
https://reviews.llvm.org/D130847
Files:
clang/lib/Basic/SourceManager.cpp
Index: clang/lib/Basic/SourceManager.cpp
===================================================================
--- clang/lib/Basic/SourceManager.cpp
+++ clang/lib/Basic/SourceManager.cpp
@@ -880,6 +880,8 @@
for (NumProbes = 0; NumProbes < 8; ++NumProbes, ++I) {
// Make sure the entry is loaded!
const SrcMgr::SLocEntry &E = getLoadedSLocEntry(I);
+ if (E.getOffset() == 0)
+ return FileID(); // invalid entry.
if (E.getOffset() <= SLocOffset) {
FileID Res = FileID::get(-int(I) - 2);
LastFileIDLookup = Res;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130847.450989.patch
Type: text/x-patch
Size: 547 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220808/47be977c/attachment.bin>
More information about the cfe-commits
mailing list