aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/FrontendAction.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-03-09 17:21:42 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-03-09 17:21:42 +0000
commit35dcda792241569a65db70e555b6dd50c332898b (patch)
treec137163265cbefe585ddbdda6a3fd6a644f212a0 /clang/lib/Frontend/FrontendAction.cpp
parent709b108ae117092d7d6a2c4abcd8f65918db81e3 (diff)
downloadllvm-35dcda792241569a65db70e555b6dd50c332898b.zip
llvm-35dcda792241569a65db70e555b6dd50c332898b.tar.gz
llvm-35dcda792241569a65db70e555b6dd50c332898b.tar.bz2
Introduce '-chain-include' option to specify headers that will be converted to chained PCHs in memory
without having to use multiple runs and intermediate files. Intended for testing & debugging of chained PCH. llvm-svn: 127339
Diffstat (limited to 'clang/lib/Frontend/FrontendAction.cpp')
-rw-r--r--clang/lib/Frontend/FrontendAction.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp
index e3d8b85..5c34e94 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -20,6 +20,7 @@
#include "clang/Frontend/MultiplexConsumer.h"
#include "clang/Parse/ParseAST.h"
#include "clang/Serialization/ASTDeserializationListener.h"
+#include "clang/Serialization/ChainedIncludesSource.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Timer.h"
#include "llvm/Support/ErrorHandling.h"
@@ -209,8 +210,16 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
CI.getASTContext().setASTMutationListener(Consumer->GetASTMutationListener());
- /// Use PCH?
- if (!CI.getPreprocessorOpts().ImplicitPCHInclude.empty()) {
+ if (!CI.getPreprocessorOpts().ChainedIncludes.empty()) {
+ // Convert headers to PCH and chain them.
+ llvm::OwningPtr<ExternalASTSource> source;
+ source.reset(ChainedIncludesSource::create(CI));
+ if (!source)
+ goto failure;
+ CI.getASTContext().setExternalSource(source);
+
+ } else if (!CI.getPreprocessorOpts().ImplicitPCHInclude.empty()) {
+ // Use PCH.
assert(hasPCHSupport() && "This action does not have PCH support!");
ASTDeserializationListener *DeserialListener
= CI.getInvocation().getFrontendOpts().ChainedPCH ?