aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/FrontendActions.cpp
diff options
context:
space:
mode:
authorBen Barham <ben_barham@apple.com>2020-11-17 17:25:50 -0800
committerArgyrios Kyrtzidis <kyrtzidis@apple.com>2020-11-17 17:27:50 -0800
commit5834996fefc937d6211dc8c8a5b200068753391a (patch)
tree13cb5ce724739d084d3a0a401ed55c84dc07afc7 /clang/lib/Frontend/FrontendActions.cpp
parentf4c6080ab820219c5bf78b0c2143e7fa194da296 (diff)
downloadllvm-5834996fefc937d6211dc8c8a5b200068753391a.zip
llvm-5834996fefc937d6211dc8c8a5b200068753391a.tar.gz
llvm-5834996fefc937d6211dc8c8a5b200068753391a.tar.bz2
[Frontend] Add flag to allow PCM generation despite compiler errors
As with precompiled headers, it's useful for indexers to be able to continue through compiler errors in dependent modules. Resolves rdar://69816264 Reviewed By: akyrtzi Differential Revision: https://reviews.llvm.org/D91580
Diffstat (limited to 'clang/lib/Frontend/FrontendActions.cpp')
-rw-r--r--clang/lib/Frontend/FrontendActions.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp
index f38da54..cb2b89e4 100644
--- a/clang/lib/Frontend/FrontendActions.cpp
+++ b/clang/lib/Frontend/FrontendActions.cpp
@@ -177,7 +177,8 @@ GenerateModuleAction::CreateASTConsumer(CompilerInstance &CI,
Consumers.push_back(std::make_unique<PCHGenerator>(
CI.getPreprocessor(), CI.getModuleCache(), OutputFile, Sysroot, Buffer,
CI.getFrontendOpts().ModuleFileExtensions,
- /*AllowASTWithErrors=*/false,
+ /*AllowASTWithErrors=*/
+ +CI.getFrontendOpts().AllowPCMWithCompilerErrors,
/*IncludeTimestamps=*/
+CI.getFrontendOpts().BuildingImplicitModule,
/*ShouldCacheASTInMemory=*/
@@ -187,6 +188,11 @@ GenerateModuleAction::CreateASTConsumer(CompilerInstance &CI,
return std::make_unique<MultiplexConsumer>(std::move(Consumers));
}
+bool GenerateModuleAction::shouldEraseOutputFiles() {
+ return !getCompilerInstance().getFrontendOpts().AllowPCMWithCompilerErrors &&
+ ASTFrontendAction::shouldEraseOutputFiles();
+}
+
bool GenerateModuleFromModuleMapAction::BeginSourceFileAction(
CompilerInstance &CI) {
if (!CI.getLangOpts().Modules) {
@@ -339,7 +345,7 @@ void VerifyPCHAction::ExecuteAction() {
CI.getPCHContainerReader(), CI.getFrontendOpts().ModuleFileExtensions,
Sysroot.empty() ? "" : Sysroot.c_str(),
/*DisableValidation*/ false,
- /*AllowPCHWithCompilerErrors*/ false,
+ /*AllowASTWithCompilerErrors*/ false,
/*AllowConfigurationMismatch*/ true,
/*ValidateSystemInputs*/ true));