[cfe-commits] r142886 - /cfe/trunk/lib/Basic/SourceManager.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Mon Oct 24 17:29:44 PDT 2011


Author: akirtzidis
Date: Mon Oct 24 19:29:44 2011
New Revision: 142886

URL: http://llvm.org/viewvc/llvm-project?rev=142886&view=rev
Log:
Use assert(0) instead of duplicating the check, suggestion by Anna.

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=142886&r1=142885&r2=142886&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/SourceManager.cpp (original)
+++ cfe/trunk/lib/Basic/SourceManager.cpp Mon Oct 24 19:29:44 2011
@@ -730,11 +730,11 @@
 /// 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.





More information about the cfe-commits mailing list