diff options
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r-- | clang/lib/Basic/SourceManager.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp index 96a526ad141..a540f3b9450 100644 --- a/clang/lib/Basic/SourceManager.cpp +++ b/clang/lib/Basic/SourceManager.cpp @@ -732,6 +732,10 @@ FileID SourceManager::getFileIDLocal(unsigned SLocOffset) const { FileID SourceManager::getFileIDLoaded(unsigned SLocOffset) const { assert(SLocOffset >= CurrentLoadedOffset && "Bad function choice"); + // Sanity checking, otherwise a bug may lead to hanging in release build. + if (SLocOffset < CurrentLoadedOffset) + return FileID(); + // Essentially the same as the local case, but the loaded array is sorted // in the other direction. |