[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@294963 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2017-02-13 16:16:43 +00:00
parent 01e065de43
commit 76b548308d
2 changed files with 7 additions and 0 deletions

View File

@ -1891,6 +1891,8 @@ bool ASTUnit::LoadFromCompilerInvocation(
PreambleRebuildCounter = PrecompilePreambleAfterNParses;
OverrideMainBuffer =
getMainBufferWithPrecompiledPreamble(PCHContainerOps, *Invocation);
getDiagnostics().Reset();
ProcessWarningOptions(getDiagnostics(), Invocation->getDiagnosticOpts());
}
SimpleTimer ParsingTimer(WantTiming);

View File

@ -1,6 +1,11 @@
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
namespace std {
void wibble();
}
#pragma clang diagnostic pop
namespace std {
}