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
diff --git a/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp
index 66bec7c..633b82c 100644
--- a/lib/Frontend/FrontendAction.cpp
+++ b/lib/Frontend/FrontendAction.cpp
@@ -40,8 +40,7 @@
// AST files follow a very different path, since they share objects via the
// AST unit.
- bool IsAST = InputKind == IK_AST;
- if (IsAST) {
+ if (InputKind == IK_AST) {
assert(!usesPreprocessorOnly() &&
"Attempt to pass AST file to preprocessor only action!");
assert(hasASTSupport() && "This action does not have AST support!");
@@ -73,6 +72,13 @@
return true;
}
+ // Setup the file and source managers, if needed, and the preprocessor.
+ if (!CI.hasFileManager())
+ CI.createFileManager();
+ if (!CI.hasSourceManager())
+ CI.createSourceManager();
+ CI.createPreprocessor();
+
// Inform the diagnostic client we are processing a source file.
CI.getDiagnosticClient().BeginSourceFile(CI.getLangOpts(),
&CI.getPreprocessor());