aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-06-07 23:23:50 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-06-07 23:23:50 +0000
commit2056048f0f619adadc9a5416a2c4cdf95c58eef7 (patch)
treebc4040662018d320d2c589b442d7c6f161d02ec0 /lib/Frontend/CompilerInstance.cpp
parentd3598a65716e120aef45aa2841d730e03f7101fe (diff)
Frontend: Move some initialization from CompilerInstance to FrontendAction, to parallel what is done for AST inputs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105579 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInstance.cpp')
-rw-r--r--lib/Frontend/CompilerInstance.cpp24
1 files changed, 4 insertions, 20 deletions
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp
index 0af355c431..0ff70edf8b 100644
--- a/lib/Frontend/CompilerInstance.cpp
+++ b/lib/Frontend/CompilerInstance.cpp
@@ -489,25 +489,9 @@ bool CompilerInstance::ExecuteAction(FrontendAction &Act) {
for (unsigned i = 0, e = getFrontendOpts().Inputs.size(); i != e; ++i) {
const std::string &InFile = getFrontendOpts().Inputs[i].second;
- // If we aren't using an AST file, setup the file and source managers and
- // the preprocessor.
- bool IsAST = getFrontendOpts().Inputs[i].first == IK_AST;
- if (!IsAST) {
- if (!i) {
- // Create a file manager object to provide access to and cache the
- // filesystem.
- createFileManager();
-
- // Create the source manager.
- createSourceManager();
- } else {
- // Reset the ID tables if we are reusing the SourceManager.
- getSourceManager().clearIDTables();
- }
-
- // Create the preprocessor.
- createPreprocessor();
- }
+ // Reset the ID tables if we are reusing the SourceManager.
+ if (hasSourceManager())
+ getSourceManager().clearIDTables();
if (Act.BeginSourceFile(*this, InFile, getFrontendOpts().Inputs[i].first)) {
Act.Execute();
@@ -530,7 +514,7 @@ bool CompilerInstance::ExecuteAction(FrontendAction &Act) {
OS << " generated.\n";
}
- if (getFrontendOpts().ShowStats) {
+ if (getFrontendOpts().ShowStats && hasFileManager()) {
getFileManager().PrintStats();
OS << "\n";
}