summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Serialization')
-rw-r--r--clang/lib/Serialization/ASTReader.cpp5
-rw-r--r--clang/lib/Serialization/GeneratePCH.cpp5
2 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 820f339a75d..b35bd7bd329 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -2309,6 +2309,11 @@ ASTReader::ReadControlBlock(ModuleFile &F,
Diag(diag::err_pch_with_compiler_errors);
return HadErrors;
}
+ if (hasErrors) {
+ Diags.ErrorOccurred = true;
+ Diags.UncompilableErrorOccurred = true;
+ Diags.UnrecoverableErrorOccurred = true;
+ }
F.RelocatablePCH = Record[4];
// Relative paths in a relocatable PCH are relative to our sysroot.
diff --git a/clang/lib/Serialization/GeneratePCH.cpp b/clang/lib/Serialization/GeneratePCH.cpp
index 4a2255ab6d3..308fde8b1dd 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;
}
OpenPOWER on IntegriCloud