]> granicus.if.org Git - clang/commitdiff
do not use SourceManager::getFileCharacteristic(FileID), it is not
authorChris Lattner <sabre@nondot.org>
Mon, 19 Jan 2009 08:01:53 +0000 (08:01 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 19 Jan 2009 08:01:53 +0000 (08:01 +0000)
safe because a #line can change the file characteristic on a per-loc
basis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62502 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/PPLexerChange.cpp

index f8c8636fcb1c15ba8462c1a95583d7a3dc4b376d..e425f6b737ba27fc1740c59aba59e3c431cecd1c 100644 (file)
@@ -118,9 +118,10 @@ void Preprocessor::EnterSourceFileWithPTH(PTHLexer *PL,
   // 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 @@ bool Preprocessor::HandleEndOfFile(Token &Result, bool isEndOfMacro) {
     // 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.