diff options
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Serialization/ASTReader.cpp')
-rw-r--r-- | contrib/llvm/tools/clang/lib/Serialization/ASTReader.cpp | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/contrib/llvm/tools/clang/lib/Serialization/ASTReader.cpp b/contrib/llvm/tools/clang/lib/Serialization/ASTReader.cpp index 609c25d..d75b5eb 100644 --- a/contrib/llvm/tools/clang/lib/Serialization/ASTReader.cpp +++ b/contrib/llvm/tools/clang/lib/Serialization/ASTReader.cpp @@ -19,6 +19,7 @@ #include "clang/AST/DeclTemplate.h" #include "clang/AST/Expr.h" #include "clang/AST/ExprCXX.h" +#include "clang/Frontend/PCHContainerOperations.h" #include "clang/AST/NestedNameSpecifier.h" #include "clang/AST/Type.h" #include "clang/AST/TypeLocVisitor.h" @@ -3590,6 +3591,7 @@ ASTReader::ReadASTCore(StringRef FileName, ModuleFile &F = *M; BitstreamCursor &Stream = F.Stream; + PCHContainerOps.ExtractPCH(F.Buffer->getMemBufferRef(), F.StreamFile); Stream.init(&F.StreamFile); F.SizeInBits = F.Buffer->getBufferSize() * 8; @@ -3858,9 +3860,9 @@ static ASTFileSignature readASTFileSignature(llvm::BitstreamReader &StreamFile){ /// \brief Retrieve the name of the original source file name /// directly from the AST file, without actually loading the AST /// file. -std::string ASTReader::getOriginalSourceFile(const std::string &ASTFileName, - FileManager &FileMgr, - DiagnosticsEngine &Diags) { +std::string ASTReader::getOriginalSourceFile( + const std::string &ASTFileName, FileManager &FileMgr, + const PCHContainerOperations &PCHContainerOps, DiagnosticsEngine &Diags) { // Open the AST file. auto Buffer = FileMgr.getBufferForFile(ASTFileName); if (!Buffer) { @@ -3871,8 +3873,7 @@ std::string ASTReader::getOriginalSourceFile(const std::string &ASTFileName, // Initialize the stream llvm::BitstreamReader StreamFile; - StreamFile.init((const unsigned char *)(*Buffer)->getBufferStart(), - (const unsigned char *)(*Buffer)->getBufferEnd()); + PCHContainerOps.ExtractPCH((*Buffer)->getMemBufferRef(), StreamFile); BitstreamCursor Stream(StreamFile); // Sniff for the signature. @@ -3954,9 +3955,10 @@ namespace { }; } -bool ASTReader::readASTFileControlBlock(StringRef Filename, - FileManager &FileMgr, - ASTReaderListener &Listener) { +bool ASTReader::readASTFileControlBlock( + StringRef Filename, FileManager &FileMgr, + const PCHContainerOperations &PCHContainerOps, + ASTReaderListener &Listener) { // Open the AST file. // FIXME: This allows use of the VFS; we do not allow use of the // VFS when actually loading a module. @@ -4147,16 +4149,15 @@ bool ASTReader::readASTFileControlBlock(StringRef Filename, } } - -bool ASTReader::isAcceptableASTFile(StringRef Filename, - FileManager &FileMgr, - const LangOptions &LangOpts, - const TargetOptions &TargetOpts, - const PreprocessorOptions &PPOpts, - std::string ExistingModuleCachePath) { +bool ASTReader::isAcceptableASTFile( + StringRef Filename, FileManager &FileMgr, + const PCHContainerOperations &PCHContainerOps, const LangOptions &LangOpts, + const TargetOptions &TargetOpts, const PreprocessorOptions &PPOpts, + std::string ExistingModuleCachePath) { SimplePCHValidator validator(LangOpts, TargetOpts, PPOpts, ExistingModuleCachePath, FileMgr); - return !readASTFileControlBlock(Filename, FileMgr, validator); + return !readASTFileControlBlock(Filename, FileMgr, PCHContainerOps, + validator); } ASTReader::ASTReadResult @@ -8407,24 +8408,26 @@ void ASTReader::pushExternalDeclIntoScope(NamedDecl *D, DeclarationName Name) { } } -ASTReader::ASTReader(Preprocessor &PP, ASTContext &Context, StringRef isysroot, - bool DisableValidation, bool AllowASTWithCompilerErrors, +ASTReader::ASTReader(Preprocessor &PP, ASTContext &Context, + const PCHContainerOperations &PCHContainerOps, + StringRef isysroot, bool DisableValidation, + bool AllowASTWithCompilerErrors, bool AllowConfigurationMismatch, bool ValidateSystemInputs, bool UseGlobalIndex) : Listener(new PCHValidator(PP, *this)), DeserializationListener(nullptr), OwnsDeserializationListener(false), SourceMgr(PP.getSourceManager()), - FileMgr(PP.getFileManager()), Diags(PP.getDiagnostics()), - SemaObj(nullptr), PP(PP), Context(Context), Consumer(nullptr), - ModuleMgr(PP.getFileManager()), isysroot(isysroot), - DisableValidation(DisableValidation), + FileMgr(PP.getFileManager()), PCHContainerOps(PCHContainerOps), + Diags(PP.getDiagnostics()), SemaObj(nullptr), PP(PP), Context(Context), + Consumer(nullptr), ModuleMgr(PP.getFileManager(), PCHContainerOps), + isysroot(isysroot), DisableValidation(DisableValidation), AllowASTWithCompilerErrors(AllowASTWithCompilerErrors), AllowConfigurationMismatch(AllowConfigurationMismatch), ValidateSystemInputs(ValidateSystemInputs), UseGlobalIndex(UseGlobalIndex), TriedLoadingGlobalIndex(false), - CurrSwitchCaseStmts(&SwitchCaseStmts), - NumSLocEntriesRead(0), TotalNumSLocEntries(0), NumStatementsRead(0), - TotalNumStatements(0), NumMacrosRead(0), TotalNumMacros(0), - NumIdentifierLookups(0), NumIdentifierLookupHits(0), NumSelectorsRead(0), + CurrSwitchCaseStmts(&SwitchCaseStmts), NumSLocEntriesRead(0), + TotalNumSLocEntries(0), NumStatementsRead(0), TotalNumStatements(0), + NumMacrosRead(0), TotalNumMacros(0), NumIdentifierLookups(0), + NumIdentifierLookupHits(0), NumSelectorsRead(0), NumMethodPoolEntriesRead(0), NumMethodPoolLookups(0), NumMethodPoolHits(0), NumMethodPoolTableLookups(0), NumMethodPoolTableHits(0), TotalNumMethodPoolEntries(0), |