diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-06-29 23:23:46 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-06-29 23:23:46 +0000 |
commit | dbafb6c3384301f6217b6ad851eceae3a363c243 (patch) | |
tree | 33286187a42aa672a0b33e1a4a1fa9ef6d8e4083 /clang/lib/Frontend/FrontendAction.cpp | |
parent | d676ab13540473bdb15c2d204e4cd84bf1fcea93 (diff) | |
download | bcm5719-llvm-dbafb6c3384301f6217b6ad851eceae3a363c243.tar.gz bcm5719-llvm-dbafb6c3384301f6217b6ad851eceae3a363c243.zip |
Teach ASTReader how to read only the Preprocessor state from an AST file, not the ASTContext state.
We use this when running a preprocessor-only action on an AST file in order to
avoid paying the runtime cost of loading the extra information.
llvm-svn: 306760
Diffstat (limited to 'clang/lib/Frontend/FrontendAction.cpp')
-rw-r--r-- | clang/lib/Frontend/FrontendAction.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp index eed8631bdb8..704d5150985 100644 --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/lib/Frontend/FrontendAction.cpp @@ -536,8 +536,8 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, ASTDiags->setClient(Diags->getClient(), /*OwnsClient*/false); std::unique_ptr<ASTUnit> AST = ASTUnit::LoadFromASTFile( - InputFile, CI.getPCHContainerReader(), ASTDiags, CI.getFileSystemOpts(), - CI.getCodeGenOpts().DebugTypeExtRefs); + InputFile, CI.getPCHContainerReader(), ASTUnit::LoadPreprocessorOnly, + ASTDiags, CI.getFileSystemOpts(), CI.getCodeGenOpts().DebugTypeExtRefs); if (!AST) goto failure; @@ -576,6 +576,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, Module *ASTModule = AST->getPreprocessor().getHeaderSearchInfo().lookupModule( AST->getLangOpts().CurrentModule, /*AllowSearch*/ false); + assert(ASTModule && "module file does not define its own module"); Input = FrontendInputFile(ASTModule->PresumedModuleMapFile, Kind); } else { auto &SM = CI.getSourceManager(); @@ -598,8 +599,8 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, IntrusiveRefCntPtr<DiagnosticsEngine> Diags(&CI.getDiagnostics()); std::unique_ptr<ASTUnit> AST = ASTUnit::LoadFromASTFile( - InputFile, CI.getPCHContainerReader(), Diags, CI.getFileSystemOpts(), - CI.getCodeGenOpts().DebugTypeExtRefs); + InputFile, CI.getPCHContainerReader(), ASTUnit::LoadEverything, Diags, + CI.getFileSystemOpts(), CI.getCodeGenOpts().DebugTypeExtRefs); if (!AST) goto failure; |