Author: lattner
Date: Mon Jan 19 02:01:53 2009
New Revision: 62502

URL: http://llvm.org/viewvc/llvm-project?rev=62502&view=rev
Log:
do not use SourceManager::getFileCharacteristic(FileID), it is not
safe because a #line can change the file characteristic on a per-loc
basis.


Modified:
    cfe/trunk/lib/Lex/PPLexerChange.cpp

Modified: cfe/trunk/lib/Lex/PPLexerChange.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPLexerChange.cpp?rev=62502&r1=62501&r2=62502&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/PPLexerChange.cpp (original)
+++ cfe/trunk/lib/Lex/PPLexerChange.cpp Mon Jan 19 02:01:53 2009
@@ -118,9 +118,10 @@
   // Notify the client, if desired, that we are in a new source file.
   if (Callbacks) {
     FileID FID = CurPPLexer->getFileID();
-    SrcMgr::CharacteristicKind FileType = SourceMgr.getFileCharacteristic(FID);
-    Callbacks->FileChanged(SourceMgr.getLocForStartOfFile(FID),
-                           PPCallbacks::EnterFile, FileType);
+    SourceLocation EnterLoc = SourceMgr.getLocForStartOfFile(FID);
+    SrcMgr::CharacteristicKind FileType =
+      SourceMgr.getFileCharacteristic(EnterLoc);
+    Callbacks->FileChanged(EnterLoc, PPCallbacks::EnterFile, FileType);
   }
 }
 
@@ -194,9 +195,9 @@
     // Notify the client, if desired, that we are in a new source file.
     if (Callbacks && !isEndOfMacro && CurPPLexer) {
       SrcMgr::CharacteristicKind FileType =
-        SourceMgr.getFileCharacteristic(CurPPLexer->getFileID());
-        Callbacks->FileChanged(CurPPLexer->getSourceLocation(),
-                               PPCallbacks::ExitFile, FileType); 
+        SourceMgr.getFileCharacteristic(CurPPLexer->getSourceLocation());
+      Callbacks->FileChanged(CurPPLexer->getSourceLocation(),
+                             PPCallbacks::ExitFile, FileType); 
     }
 
     // Client should lex another token.


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to