From ffaab3e2bb13991bb3357e80f14bcae3745b2347 Mon Sep 17 00:00:00 2001 From: Sebastian Redl Date: Fri, 30 Jul 2010 00:29:29 +0000 Subject: 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 --- lib/Frontend/CompilerInstance.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'lib/Frontend/CompilerInstance.cpp') diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp index ea295687aa..84e51837bc 100644 --- a/lib/Frontend/CompilerInstance.cpp +++ b/lib/Frontend/CompilerInstance.cpp @@ -37,7 +37,7 @@ using namespace clang; CompilerInstance::CompilerInstance() - : Invocation(new CompilerInvocation()), Reader(0) { + : Invocation(new CompilerInvocation()) { } CompilerInstance::~CompilerInstance() { @@ -251,13 +251,13 @@ void CompilerInstance::createASTContext() { // ExternalASTSource void CompilerInstance::createPCHExternalASTSource(llvm::StringRef Path, - bool DisablePCHValidation) { + bool DisablePCHValidation, + void *DeserializationListener){ llvm::OwningPtr Source; Source.reset(createPCHExternalASTSource(Path, getHeaderSearchOpts().Sysroot, DisablePCHValidation, - getPreprocessor(), getASTContext())); - // Remember the PCHReader, but in a non-owning way. - Reader = static_cast(Source.get()); + getPreprocessor(), getASTContext(), + DeserializationListener)); getASTContext().setExternalSource(Source); } @@ -266,12 +266,15 @@ CompilerInstance::createPCHExternalASTSource(llvm::StringRef Path, const std::string &Sysroot, bool DisablePCHValidation, Preprocessor &PP, - ASTContext &Context) { + ASTContext &Context, + void *DeserializationListener) { llvm::OwningPtr Reader; Reader.reset(new PCHReader(PP, &Context, Sysroot.empty() ? 0 : Sysroot.c_str(), DisablePCHValidation)); + Reader->setDeserializationListener( + static_cast(DeserializationListener)); switch (Reader->ReadPCH(Path)) { case PCHReader::Success: // Set the predefines buffer as suggested by the PCH reader. Typically, the -- cgit v1.2.3