[ASTUnit] Clear out diagnostic state after creating the preamble.
If the preamble had diagnostic state this would leave behind invalid
state in the DiagnosticsEngine and crash later. The test case runs into
an assertion in DiagnosticsEngine::setSourceManager.
llvm-svn: 294963
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index f3d033c..12b78ea 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -1891,6 +1891,8 @@
PreambleRebuildCounter = PrecompilePreambleAfterNParses;
OverrideMainBuffer =
getMainBufferWithPrecompiledPreamble(PCHContainerOps, *Invocation);
+ getDiagnostics().Reset();
+ ProcessWarningOptions(getDiagnostics(), Invocation->getDiagnosticOpts());
}
SimpleTimer ParsingTimer(WantTiming);