diff options
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r-- | clang/lib/Basic/SourceManager.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp index 8fa648c730b..1b8383bc426 100644 --- a/clang/lib/Basic/SourceManager.cpp +++ b/clang/lib/Basic/SourceManager.cpp @@ -863,6 +863,11 @@ FileID SourceManager::getFileIDLoaded(unsigned SLocOffset) const { return Res; } + // Sanity checking, otherwise a bug may lead to hanging in release build. + if (LessIndex == MiddleIndex) { + assert(0 && "binary search missed the entry"); + return FileID(); + } LessIndex = MiddleIndex; } } |