diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Frontend/DependencyFile.cpp | 9 | ||||
-rw-r--r-- | lib/Frontend/FrontendAction.cpp | 4 | ||||
-rw-r--r-- | lib/Lex/PPLexerChange.cpp | 1 | ||||
-rw-r--r-- | lib/Lex/Preprocessor.cpp | 5 |
4 files changed, 15 insertions, 4 deletions
diff --git a/lib/Frontend/DependencyFile.cpp b/lib/Frontend/DependencyFile.cpp index de2b056dc7..14aee3559c 100644 --- a/lib/Frontend/DependencyFile.cpp +++ b/lib/Frontend/DependencyFile.cpp @@ -48,14 +48,15 @@ public: IncludeSystemHeaders(Opts.IncludeSystemHeaders), PhonyTarget(Opts.UsePhonyTargets) {} - ~DependencyFileCallback() { + virtual void FileChanged(SourceLocation Loc, FileChangeReason Reason, + SrcMgr::CharacteristicKind FileType); + + virtual void EndOfMainFile() { OutputDependencyFile(); OS->flush(); delete OS; + OS = 0; } - - virtual void FileChanged(SourceLocation Loc, FileChangeReason Reason, - SrcMgr::CharacteristicKind FileType); }; } diff --git a/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp index 66df7a6191..110612d03b 100644 --- a/lib/Frontend/FrontendAction.cpp +++ b/lib/Frontend/FrontendAction.cpp @@ -169,6 +169,10 @@ void FrontendAction::EndSourceFile() { CI.setASTContext(0); } + // Inform the preprocessor we are done. + if (CI.hasPreprocessor()) + CI.getPreprocessor().EndSourceFile(); + if (CI.getFrontendOpts().ShowStats) { llvm::errs() << "\nSTATISTICS FOR '" << getCurrentFile() << "':\n"; CI.getPreprocessor().PrintStats(); diff --git a/lib/Lex/PPLexerChange.cpp b/lib/Lex/PPLexerChange.cpp index 6d1c132fc0..335d3db627 100644 --- a/lib/Lex/PPLexerChange.cpp +++ b/lib/Lex/PPLexerChange.cpp @@ -255,6 +255,7 @@ bool Preprocessor::HandleEndOfFile(Token &Result, bool isEndOfMacro) { if (!I->second->isUsed()) Diag(I->second->getDefinitionLoc(), diag::pp_macro_not_used); } + return true; } diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index 9d59300d21..8b4b1ddf41 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/lib/Lex/Preprocessor.cpp @@ -519,6 +519,11 @@ bool Preprocessor::EnterMainSourceFile() { return EnterSourceFile(FID, 0, ErrorStr); } +void Preprocessor::EndSourceFile() { + // Notify the client that we reached the end of the source file. + if (Callbacks) + Callbacks->EndOfMainFile(); +} //===----------------------------------------------------------------------===// // Lexer Event Handling. |