r176333 - Add one more sanity check in SourceManager::getFileIDLoaded().
Argyrios Kyrtzidis
akyrtzi at gmail.com
Thu Feb 28 19:43:33 PST 2013
Author: akirtzidis
Date: Thu Feb 28 21:43:33 2013
New Revision: 176333
URL: http://llvm.org/viewvc/llvm-project?rev=176333&view=rev
Log:
Add one more sanity check in SourceManager::getFileIDLoaded().
Modified:
cfe/trunk/lib/Basic/SourceManager.cpp
Modified: cfe/trunk/lib/Basic/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=176333&r1=176332&r2=176333&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/SourceManager.cpp (original)
+++ cfe/trunk/lib/Basic/SourceManager.cpp Thu Feb 28 21:43:33 2013
@@ -863,6 +863,11 @@ FileID SourceManager::getFileIDLoaded(un
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;
}
}
More information about the cfe-commits
mailing list