summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
parent56a76961aae9cf7e4bed4647cdc7b247a53dbe0a (diff)
downloadbcm5719-llvm-70ec1c7e62461ad559cc302adbd2f4e83e2fc264.tar.gz
bcm5719-llvm-70ec1c7e62461ad559cc302adbd2f4e83e2fc264.zip
[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/Frontend/ASTUnit.cpp')
-rw-r--r--clang/lib/Frontend/ASTUnit.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 635d566159b..e0bf1c51c85 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -2509,7 +2509,8 @@ static bool serializeUnit(ASTWriter &Writer,
}
bool ASTUnit::serialize(raw_ostream &OS) {
- bool hasErrors = getDiagnostics().hasErrorOccurred();
+ // For serialization we are lenient if the errors were only warn-as-error kind.
+ bool hasErrors = getDiagnostics().hasUncompilableErrorOccurred();
if (WriterData)
return serializeUnit(WriterData->Writer, WriterData->Buffer,
OpenPOWER on IntegriCloud