diff options
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
| -rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 10 | 
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index 212a1cf..e3eb859 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -251,10 +251,12 @@ void CompilerInstance::createPCHExternalASTSource(llvm::StringRef Path,                                                    bool DisablePCHValidation,                                                   void *DeserializationListener){    llvm::OwningPtr<ExternalASTSource> Source; +  bool Preamble = getPreprocessorOpts().PrecompiledPreambleBytes.first != 0;    Source.reset(createPCHExternalASTSource(Path, getHeaderSearchOpts().Sysroot,                                            DisablePCHValidation,                                            getPreprocessor(), getASTContext(), -                                          DeserializationListener)); +                                          DeserializationListener, +                                          Preamble));    getASTContext().setExternalSource(Source);  } @@ -264,7 +266,8 @@ CompilerInstance::createPCHExternalASTSource(llvm::StringRef Path,                                               bool DisablePCHValidation,                                               Preprocessor &PP,                                               ASTContext &Context, -                                             void *DeserializationListener) { +                                             void *DeserializationListener, +                                             bool Preamble) {    llvm::OwningPtr<ASTReader> Reader;    Reader.reset(new ASTReader(PP, &Context,                               Sysroot.empty() ? 0 : Sysroot.c_str(), @@ -272,7 +275,8 @@ CompilerInstance::createPCHExternalASTSource(llvm::StringRef Path,    Reader->setDeserializationListener(              static_cast<ASTDeserializationListener *>(DeserializationListener)); -  switch (Reader->ReadAST(Path)) { +  switch (Reader->ReadAST(Path, +                          Preamble ? ASTReader::Preamble : ASTReader::PCH)) {    case ASTReader::Success:      // Set the predefines buffer as suggested by the PCH reader. Typically, the      // predefines buffer will be empty.  | 
