[cfe-commits] r49684 - /cfe/trunk/Driver/HTMLPrint.cpp

Ted Kremenek kremenek at apple.com
Mon Apr 14 14:14:14 PDT 2008


Author: kremenek
Date: Mon Apr 14 16:14:03 2008
New Revision: 49684

URL: http://llvm.org/viewvc/llvm-project?rev=49684&view=rev
Log:
Convert over to new SourceManager::isFromMainFile() instead of doing direct
FileID comparison (fixes insidious corner case with chunks).

Modified:
    cfe/trunk/Driver/HTMLPrint.cpp

Modified: cfe/trunk/Driver/HTMLPrint.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/HTMLPrint.cpp?rev=49684&r1=49683&r2=49684&view=diff

==============================================================================
--- cfe/trunk/Driver/HTMLPrint.cpp (original)
+++ cfe/trunk/Driver/HTMLPrint.cpp Mon Apr 14 16:14:03 2008
@@ -157,16 +157,13 @@
   SourceManager& SM = R.getSourceMgr();
   
   FullSourceLoc LPos = Pos.getLogicalLoc();
-  unsigned FileID = LPos.getLocation().getFileID();
+  unsigned FileID = SM.getCanonicalFileID(LPos.getLocation());
   
   assert (&LPos.getManager() == &SM && "SourceManagers are different!");
   
-  unsigned MainFileID = SM.getMainFileID();
-  
-  if (FileID != MainFileID)
+  if (!SM.isFromMainFile(LPos.getLocation()))
     return;
   
-  
   // Compute the column number.  Rewind from the current position to the start
   // of the line.
 
@@ -228,13 +225,12 @@
 
     ++Ranges;
     
-    if (B.getFileID() != MainFileID || E.getFileID() != MainFileID)
+    if (!SM.isFromMainFile(B) || !SM.isFromMainFile(E))
       continue;
     
     // Highlight the range.  Make the span tag the outermost tag for the
     // selected range.
     R.InsertCStrBefore(B, "<span class=\"mrange\">");
     R.InsertCStrAfter(E, "</span>");
-  }
-  
+  }  
 }





More information about the cfe-commits mailing list