aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/FrontendAction.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2010-07-09 21:00:24 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2010-07-09 21:00:24 +0000
commit77f4603c8b142e642300959a601ecec2b7c8e288 (patch)
treee6df3e6932023c52a90bd14cad69e82daa782d63 /lib/Frontend/FrontendAction.cpp
parent0193a72c6fc873c0c83119ab1e6f089719e09e1a (diff)
When given the -chained-pch option and a previous PCH file, have the PCHWriter emit a CHAINED_METADATA record instead of METADATA, and write a link to the previous file there.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108014 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/FrontendAction.cpp')
-rw-r--r--lib/Frontend/FrontendAction.cpp11
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