[PATCH] D130847: [clang] SourceManager: fix isOffsetInFileID for the case of a fake SLocEntry

Ivan Murashko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 8 03:18:33 PDT 2022


ivanmurashko updated this revision to Diff 450750.
ivanmurashko added a comment.

rebase


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,7 +880,7 @@
   for (NumProbes = 0; NumProbes < 8; ++NumProbes, ++I) {
     // Make sure the entry is loaded!
     const SrcMgr::SLocEntry &E = getLoadedSLocEntry(I);
-    if (E.getOffset() <= SLocOffset) {
+    if (E.getOffset() != 0 && E.getOffset() <= SLocOffset) {
       FileID Res = FileID::get(-int(I) - 2);
       LastFileIDLookup = Res;
       NumLinearScans += NumProbes + 1;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130847.450750.patch
Type: text/x-patch
Size: 578 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220808/f95d81c5/attachment.bin>


More information about the llvm-commits mailing list