diff options
Diffstat (limited to 'lib/Frontend/FrontendAction.cpp')
-rw-r--r-- | lib/Frontend/FrontendAction.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp index b761f30adf..dbbf69c8b1 100644 --- a/lib/Frontend/FrontendAction.cpp +++ b/lib/Frontend/FrontendAction.cpp @@ -111,11 +111,10 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, /// action. if (!usesPreprocessorOnly()) { CI.createASTContext(); - CI.setASTConsumer(CreateASTConsumer(CI, Filename)); - if (!CI.hasASTConsumer()) - goto failure; - /// Use PCH? + /// Use PCH? If so, we want the PCHReader active before the consumer + /// is created, because the consumer might be interested in the reader + /// (e.g. the PCH writer for chaining). if (!CI.getPreprocessorOpts().ImplicitPCHInclude.empty()) { assert(hasPCHSupport() && "This action does not have PCH support!"); CI.createPCHExternalASTSource( @@ -123,6 +122,10 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, if (!CI.getASTContext().getExternalSource()) goto failure; } + + CI.setASTConsumer(CreateASTConsumer(CI, Filename)); + if (!CI.hasASTConsumer()) + goto failure; } // Initialize builtin info as long as we aren't using an external AST |