diff options
author | Chris Lattner <sabre@nondot.org> | 2009-03-27 17:13:49 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-03-27 17:13:49 +0000 |
commit | 839150e0d20d490538d026fb2f0d9e3c758c3ff2 (patch) | |
tree | e00e66b99ed03d53c3c4a021ad6375cb5956094d /clang/lib | |
parent | b3e8f6531d095f5df5556984a7c80ea6cecc6205 (diff) | |
download | bcm5719-llvm-839150e0d20d490538d026fb2f0d9e3c758c3ff2.tar.gz bcm5719-llvm-839150e0d20d490538d026fb2f0d9e3c758c3ff2.zip |
push line markers through -E mode.
llvm-svn: 67854
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 5797b12ebc8..c5dc7abd08b 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -692,6 +692,10 @@ void Preprocessor::HandleLineDirective(Token &Tok) { } SourceMgr.AddLineNote(DigitTok.getLocation(), LineNo, FilenameID); + + if (Callbacks) + Callbacks->FileChanged(DigitTok.getLocation(), PPCallbacks::RenameFile, + SrcMgr::C_User); } /// ReadLineMarkerFlags - Parse and validate any flags at the end of a GNU line @@ -823,6 +827,24 @@ void Preprocessor::HandleDigitDirective(Token &DigitTok) { SourceMgr.AddLineNote(DigitTok.getLocation(), LineNo, FilenameID, IsFileEntry, IsFileExit, IsSystemHeader, IsExternCHeader); + + // If the preprocessor has callbacks installed, notify them of the #line + // change. This is used so that the line marker comes out in -E mode for + // example. + if (Callbacks) { + PPCallbacks::FileChangeReason Reason = PPCallbacks::RenameFile; + if (IsFileEntry) + Reason = PPCallbacks::EnterFile; + else if (IsFileExit) + Reason = PPCallbacks::ExitFile; + SrcMgr::CharacteristicKind FileKind = SrcMgr::C_User; + if (IsExternCHeader) + FileKind = SrcMgr::C_ExternCSystem; + else if (IsSystemHeader) + FileKind = SrcMgr::C_System; + + Callbacks->FileChanged(DigitTok.getLocation(), Reason, FileKind); + } } |