]> granicus.if.org Git - clang/commitdiff
Use assert(0) instead of duplicating the check, suggestion by Anna.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 25 Oct 2011 00:29:44 +0000 (00:29 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 25 Oct 2011 00:29:44 +0000 (00:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142886 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/SourceManager.cpp

index 364663ee32651c6c06a17d9880a16ca322a2442f..ddb1f39d1d672f2914ffab09938e98e90d71c4b6 100644 (file)
@@ -730,11 +730,11 @@ FileID SourceManager::getFileIDLocal(unsigned SLocOffset) const {
 /// This function knows that the SourceLocation is in a loaded buffer, not a
 /// local one.
 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)
+  if (SLocOffset < CurrentLoadedOffset) {
+    assert(0 && "Invalid SLocOffset or bad function choice");
     return FileID();
+  }
 
   // Essentially the same as the local case, but the loaded array is sorted
   // in the other direction.