aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Serialization/GeneratePCH.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2016-07-13 20:35:26 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2016-07-13 20:35:26 +0000
commit70ec1c7e62461ad559cc302adbd2f4e83e2fc264 (patch)
tree45b7751d3f95398d2109446dfb642e2640a60698 /clang/lib/Serialization/GeneratePCH.cpp
parent56a76961aae9cf7e4bed4647cdc7b247a53dbe0a (diff)
downloadllvm-70ec1c7e62461ad559cc302adbd2f4e83e2fc264.zip
llvm-70ec1c7e62461ad559cc302adbd2f4e83e2fc264.tar.gz
llvm-70ec1c7e62461ad559cc302adbd2f4e83e2fc264.tar.bz2
[PCH/preamble] Make sure that if the preamble/PCH was serialized with errors that we set diagnostic engine state appropriately.
Otherwise there can be a crash with CFG analysis warnings doing work on invalid AST. Fixes crash of rdar://26224134 llvm-svn: 275313
Diffstat (limited to 'clang/lib/Serialization/GeneratePCH.cpp')
-rw-r--r--clang/lib/Serialization/GeneratePCH.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Serialization/GeneratePCH.cpp b/clang/lib/Serialization/GeneratePCH.cpp
index 4a2255a..308fde8 100644
--- a/clang/lib/Serialization/GeneratePCH.cpp
+++ b/clang/lib/Serialization/GeneratePCH.cpp
@@ -51,7 +51,10 @@ void PCHGenerator::HandleTranslationUnit(ASTContext &Ctx) {
// Emit the PCH file to the Buffer.
assert(SemaPtr && "No Sema?");
Buffer->Signature =
- Writer.WriteAST(*SemaPtr, OutputFile, Module, isysroot, hasErrors);
+ Writer.WriteAST(*SemaPtr, OutputFile, Module, isysroot,
+ // For serialization we are lenient if the errors were
+ // only warn-as-error kind.
+ PP.getDiagnostics().hasUncompilableErrorOccurred());
Buffer->IsComplete = true;
}