diff options
| author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-07-30 00:29:29 +0000 |
|---|---|---|
| committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-07-30 00:29:29 +0000 |
| commit | 07a89a83d4db0b3f241c70d5bbb518631ff90cfd (patch) | |
| tree | 04d2e40c51deb9492c53f280f108ba097a08c087 /clang/lib/Frontend/FrontendAction.cpp | |
| parent | 0c7476ad590d2263111430b5654127d2003afdca (diff) | |
| download | bcm5719-llvm-07a89a83d4db0b3f241c70d5bbb518631ff90cfd.tar.gz bcm5719-llvm-07a89a83d4db0b3f241c70d5bbb518631ff90cfd.zip | |
Make macro weirdness in chained PCH work. This required changing the way PCHReader and PCHWriter are initialized to correctly pick up all initializer. On the upside, this means that there is far less repetition in the dependent PCH now.
llvm-svn: 109823
Diffstat (limited to 'clang/lib/Frontend/FrontendAction.cpp')
| -rw-r--r-- | clang/lib/Frontend/FrontendAction.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp index 9efa8c61db8..90b87864b83 100644 --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/lib/Frontend/FrontendAction.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "clang/Frontend/FrontendAction.h" +#include "clang/AST/ASTConsumer.h" #include "clang/AST/ASTContext.h" #include "clang/Lex/HeaderSearch.h" #include "clang/Lex/Preprocessor.h" @@ -112,19 +113,21 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, if (!usesPreprocessorOnly()) { CI.createASTContext(); - /// 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). + llvm::OwningPtr<ASTConsumer> Consumer(CreateASTConsumer(CI, Filename)); + + /// Use PCH? if (!CI.getPreprocessorOpts().ImplicitPCHInclude.empty()) { assert(hasPCHSupport() && "This action does not have PCH support!"); CI.createPCHExternalASTSource( CI.getPreprocessorOpts().ImplicitPCHInclude, - CI.getPreprocessorOpts().DisablePCHValidation); + CI.getPreprocessorOpts().DisablePCHValidation, + CI.getInvocation().getFrontendOpts().ChainedPCH? + Consumer->GetPCHDeserializationListener() : 0); if (!CI.getASTContext().getExternalSource()) goto failure; } - CI.setASTConsumer(CreateASTConsumer(CI, Filename)); + CI.setASTConsumer(Consumer.take()); if (!CI.hasASTConsumer()) goto failure; } |

