aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-03-23 05:09:10 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-03-23 05:09:10 +0000
commitdbd8209b33e6c9f151e4913a9c095d64a95439c4 (patch)
treecc208cfa59d9fb8a90daf856f96ab3d83c9184b8 /lib/Frontend
parentd9e0c0fc47d5881a609ec34372d554e3652db66c (diff)
PPCallbacks: Add hook for reaching the end of the main file, and fix DependencyFile to not do work in its destructor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99257 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend')
-rw-r--r--lib/Frontend/DependencyFile.cpp9
-rw-r--r--lib/Frontend/FrontendAction.cpp4
2 files changed, 9 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();