aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <kyrtzidis@apple.com>2021-02-08 00:24:31 -0800
committerArgyrios Kyrtzidis <kyrtzidis@apple.com>2021-02-08 16:10:39 -0800
commita8cb39bab04c317c9886ec3a332f3b70ce27ae4f (patch)
treea2f4b69ee32301212ba97978e7fc3133dc8eebfd /clang/lib/Frontend/CompilerInstance.cpp
parent1dab94f9ede5d506d6ff9c61448a8e20d43e05a7 (diff)
downloadllvm-a8cb39bab04c317c9886ec3a332f3b70ce27ae4f.zip
llvm-a8cb39bab04c317c9886ec3a332f3b70ce27ae4f.tar.gz
llvm-a8cb39bab04c317c9886ec3a332f3b70ce27ae4f.tar.bz2
Make sure a module file with errors produced via '-fallow-pcm-with-compiler-errors' can be loaded when using implicit modules
A module with errors would be marked as out-of-date, then the `compilerModule` action would produce it, but due to the error it would be treated as failure and the resulting PCM would not get used. rdar://74087062 Differential Revision: https://reviews.llvm.org/D96246
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 956877d..7c2b2bf 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -1144,7 +1144,10 @@ compileModuleImpl(CompilerInstance &ImportingInstance, SourceLocation ImportLoc,
// module generation thread crashed.
Instance.clearOutputFiles(/*EraseFiles=*/true);
- return !Instance.getDiagnostics().hasErrorOccurred();
+ // If \p AllowPCMWithCompilerErrors is set return 'success' even if errors
+ // occurred.
+ return !Instance.getDiagnostics().hasErrorOccurred() ||
+ Instance.getFrontendOpts().AllowPCMWithCompilerErrors;
}
static const FileEntry *getPublicModuleMap(const FileEntry *File,
@@ -1697,7 +1700,8 @@ ModuleLoadResult CompilerInstance::findOrCompileModuleAndReadAST(
// Try to load the module file. If we are not trying to load from the
// module cache, we don't know how to rebuild modules.
unsigned ARRFlags = Source == MS_ModuleCache
- ? ASTReader::ARR_OutOfDate | ASTReader::ARR_Missing
+ ? ASTReader::ARR_OutOfDate | ASTReader::ARR_Missing |
+ ASTReader::ARR_TreatModuleWithErrorsAsOutOfDate
: Source == MS_PrebuiltModulePath
? 0
: ASTReader::ARR_ConfigurationMismatch;