diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-19 08:01:53 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-19 08:01:53 +0000 |
commit | 8c61b53fdb283dade0bbf51c3c5befbc5d0aefa7 (patch) | |
tree | 01668a2c05649999d73713709de855030dd24f35 /lib/Lex/PPLexerChange.cpp | |
parent | 693faa6e6918994bc22aacf078a889bb93e0fe25 (diff) |
do not use SourceManager::getFileCharacteristic(FileID), it is not
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
Diffstat (limited to 'lib/Lex/PPLexerChange.cpp')
-rw-r--r-- | lib/Lex/PPLexerChange.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/Lex/PPLexerChange.cpp b/lib/Lex/PPLexerChange.cpp index f8c8636fcb..e425f6b737 100644 --- a/lib/Lex/PPLexerChange.cpp +++ b/lib/Lex/PPLexerChange.cpp @@ -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. |