Przeglądaj źródła

Use assert(0) instead of duplicating the check, suggestion by Anna.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142886 91177308-0d34-0410-b5e6-96231b3b80d8
Argyrios Kyrtzidis 14 lat temu
rodzic
commit
82ccbe759b
1 zmienionych plików z 3 dodań i 3 usunięć
  1. 3 3
      lib/Basic/SourceManager.cpp

+ 3 - 3
lib/Basic/SourceManager.cpp

@@ -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.