aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/GeneratePCH.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2010-07-30 00:29:29 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2010-07-30 00:29:29 +0000
commitffaab3e2bb13991bb3357e80f14bcae3745b2347 (patch)
treeaba453c66d76494ce04b5495d76ac38b68e2af5c /lib/Frontend/GeneratePCH.cpp
parent3ce9e7d270e7df86c09c8126b4412d55be7c123b (diff)
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109823 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/GeneratePCH.cpp')
-rw-r--r--lib/Frontend/GeneratePCH.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/Frontend/GeneratePCH.cpp b/lib/Frontend/GeneratePCH.cpp
index 422a4b6264..561a68a6ef 100644
--- a/lib/Frontend/GeneratePCH.cpp
+++ b/lib/Frontend/GeneratePCH.cpp
@@ -37,19 +37,20 @@ namespace {
PCHWriter Writer;
public:
- PCHGenerator(const Preprocessor &PP, PCHReader *Chain,
+ PCHGenerator(const Preprocessor &PP, bool Chaining,
const char *isysroot, llvm::raw_ostream *Out);
virtual void InitializeSema(Sema &S) { SemaPtr = &S; }
virtual void HandleTranslationUnit(ASTContext &Ctx);
+ virtual PCHDeserializationListener *GetPCHDeserializationListener();
};
}
PCHGenerator::PCHGenerator(const Preprocessor &PP,
- PCHReader *Chain,
+ bool Chaining,
const char *isysroot,
llvm::raw_ostream *OS)
- : PP(PP), isysroot(isysroot), Out(OS), SemaPtr(0), StatCalls(0),
- Stream(Buffer), Writer(Stream, Chain) {
+ : PP(PP), isysroot(isysroot), Out(OS), SemaPtr(0),
+ StatCalls(0), Stream(Buffer), Writer(Stream) {
// Install a stat() listener to keep track of all of the stat()
// calls.
@@ -57,7 +58,7 @@ PCHGenerator::PCHGenerator(const Preprocessor &PP,
// If we have a chain, we want new stat calls only, so install the memorizer
// *after* the already installed PCHReader's stat cache.
PP.getFileManager().addStatCache(StatCalls,
- /*AtBeginning=*/!Chain);
+ /*AtBeginning=*/!Chaining);
}
void PCHGenerator::HandleTranslationUnit(ASTContext &Ctx) {
@@ -78,9 +79,13 @@ void PCHGenerator::HandleTranslationUnit(ASTContext &Ctx) {
Buffer.clear();
}
+PCHDeserializationListener *PCHGenerator::GetPCHDeserializationListener() {
+ return &Writer;
+}
+
ASTConsumer *clang::CreatePCHGenerator(const Preprocessor &PP,
llvm::raw_ostream *OS,
- PCHReader *Chain,
+ bool Chaining,
const char *isysroot) {
- return new PCHGenerator(PP, Chain, isysroot, OS);
+ return new PCHGenerator(PP, Chaining, isysroot, OS);
}