diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp --- a/clang/lib/Basic/SourceManager.cpp +++ b/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;