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/CompilerInstance.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/CompilerInstance.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index ea295687aa0..84e51837bc8 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/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<ExternalASTSource> Source; Source.reset(createPCHExternalASTSource(Path, getHeaderSearchOpts().Sysroot, DisablePCHValidation, - getPreprocessor(), getASTContext())); - // Remember the PCHReader, but in a non-owning way. - Reader = static_cast<PCHReader*>(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<PCHReader> Reader; Reader.reset(new PCHReader(PP, &Context, Sysroot.empty() ? 0 : Sysroot.c_str(), DisablePCHValidation)); + Reader->setDeserializationListener( + static_cast<PCHDeserializationListener *>(DeserializationListener)); switch (Reader->ReadPCH(Path)) { case PCHReader::Success: // Set the predefines buffer as suggested by the PCH reader. Typically, the |