diff options
author | Ben Langmuir <blangmuir@apple.com> | 2020-03-31 09:26:59 -0700 |
---|---|---|
committer | Ben Langmuir <blangmuir@apple.com> | 2020-03-31 13:50:12 -0700 |
commit | cc3fddb411d55d4d0902a772a9f3db11fc4f002e (patch) | |
tree | a9cd7bcb34f09c3ebb9f3b0240b136bc84725b81 /clang/lib/Serialization/GeneratePCH.cpp | |
parent | 9dcb16bc9aff676f45b530398dc75bd52526b0b5 (diff) | |
download | llvm-cc3fddb411d55d4d0902a772a9f3db11fc4f002e.zip llvm-cc3fddb411d55d4d0902a772a9f3db11fc4f002e.tar.gz llvm-cc3fddb411d55d4d0902a772a9f3db11fc4f002e.tar.bz2 |
[pch] Honour -fallow-pch-with-compiler-errors for overall compilation status
Previously we would emit a PCH with errors, but fail the overall
compilation. If run using the driver, that would result in removing the
just-produced PCH. Instead, we should have the compilation result match
whether we were able to emit the PCH.
Differential Revision: https://reviews.llvm.org/D77159
rdar://61110294
Diffstat (limited to 'clang/lib/Serialization/GeneratePCH.cpp')
-rw-r--r-- | clang/lib/Serialization/GeneratePCH.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Serialization/GeneratePCH.cpp b/clang/lib/Serialization/GeneratePCH.cpp index 002233e..d869796 100644 --- a/clang/lib/Serialization/GeneratePCH.cpp +++ b/clang/lib/Serialization/GeneratePCH.cpp @@ -57,6 +57,11 @@ void PCHGenerator::HandleTranslationUnit(ASTContext &Ctx) { } } + // Errors that do not prevent the PCH from being written should not cause the + // overall compilation to fail either. + if (AllowASTWithErrors) + PP.getDiagnostics().getClient()->clear(); + // Emit the PCH file to the Buffer. assert(SemaPtr && "No Sema?"); Buffer->Signature = |