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

sabre at cs.uiuc.edu sabre at cs.uiuc.edu
Wed Jul 11 09:23:08 PDT 2007


Author: sabre
Date: Wed Jul 11 11:23:07 2007
New Revision: 38604

URL: http://llvm.org/viewvc/llvm-project?rev=38604&view=rev
Log:
Tolerate conditions where there is no line #

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=38604&r1=38603&r2=38604&view=diff

==============================================================================
--- cfe/cfe/trunk/Basic/SourceManager.cpp (original)
+++ cfe/cfe/trunk/Basic/SourceManager.cpp Wed Jul 11 11:23:07 2007
@@ -184,7 +184,9 @@
 /// about to emit a diagnostic.
 unsigned SourceManager::getLineNumber(SourceLocation Loc) {
   Loc = getLogicalLoc(Loc);
-  FileInfo *FileInfo = getFileInfo(Loc.getFileID());
+  unsigned FileID = Loc.getFileID();
+  if (FileID == 0) return 0;
+  FileInfo *FileInfo = getFileInfo(FileID);
   
   // If this is the first use of line information for this buffer, compute the
   /// SourceLineCache for it on demand. 





More information about the cfe-commits mailing list