[cfe-commits] r39028 - /cfe/cfe/trunk/Basic/SourceManager.cpp

sabre at cs.uiuc.edu sabre at cs.uiuc.edu
Wed Jul 11 09:26:57 PDT 2007


Author: sabre
Date: Wed Jul 11 11:26:57 2007
New Revision: 39028

URL: http://llvm.org/viewvc/llvm-project?rev=39028&view=rev
Log:
Add assertions for out-of-fileid error case

Modified:
    cfe/cfe/trunk/Basic/SourceManager.cpp

Modified: cfe/cfe/trunk/Basic/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Basic/SourceManager.cpp?rev=39028&r1=39027&r2=39028&view=diff

==============================================================================
--- cfe/cfe/trunk/Basic/SourceManager.cpp (original)
+++ cfe/cfe/trunk/Basic/SourceManager.cpp Wed Jul 11 11:26:57 2007
@@ -93,6 +93,8 @@
   unsigned FileSize = File->second.Buffer->getBufferSize();
   if (FileSize+1 < (1 << SourceLocation::FilePosBits)) {
     FileIDs.push_back(FileIDInfo::getNormalBuffer(IncludePos, 0, File));
+    assert(FileIDs.size() < (1 << SourceLocation::FileIDBits) &&
+           "Ran out of file ID's!");
     return FileIDs.size();
   }
   
@@ -107,6 +109,8 @@
     FileSize -= (1 << SourceLocation::FilePosBits);
   }
 
+  assert(FileIDs.size() < (1 << SourceLocation::FileIDBits) &&
+         "Ran out of file ID's!");
   return Result;
 }
 





More information about the cfe-commits mailing list