]> granicus.if.org Git - clang/commitdiff
[ASTUnit] Reset diag state when creating the ASTUnit.
authorBenjamin Kramer <benny.kra@googlemail.com>
Wed, 18 Jan 2017 16:25:48 +0000 (16:25 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Wed, 18 Jan 2017 16:25:48 +0000 (16:25 +0000)
A client could call this with a dirty diagnostic engine, don't crash.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292406 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/ASTUnit.cpp

index d8929969e6c1cf8437ed7016051e9456bee721ca..8064da084bbb085005d4f339db880cc239fc5bd1 100644 (file)
@@ -1879,6 +1879,7 @@ bool ASTUnit::LoadFromCompilerInvocation(
   // We'll manage file buffers ourselves.
   Invocation->getPreprocessorOpts().RetainRemappedFileBuffers = true;
   Invocation->getFrontendOpts().DisableFree = false;
+  getDiagnostics().Reset();
   ProcessWarningOptions(getDiagnostics(), Invocation->getDiagnosticOpts());
 
   std::unique_ptr<llvm::MemoryBuffer> OverrideMainBuffer;