]> granicus.if.org Git - clang/commitdiff
[ASTUnit] Clear out diagnostic state after creating the preamble.
authorBenjamin Kramer <benny.kra@googlemail.com>
Mon, 13 Feb 2017 16:16:43 +0000 (16:16 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Mon, 13 Feb 2017 16:16:43 +0000 (16:16 +0000)
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

lib/Frontend/ASTUnit.cpp
test/Index/complete-preamble.h

index f3d033c3e79748ab5e77ed26ad83b1b4afc06585..12b78ea3cd9bb2df09b5af51d9232dbcb9099592 100644 (file)
@@ -1891,6 +1891,8 @@ bool ASTUnit::LoadFromCompilerInvocation(
     PreambleRebuildCounter = PrecompilePreambleAfterNParses;
     OverrideMainBuffer =
         getMainBufferWithPrecompiledPreamble(PCHContainerOps, *Invocation);
+    getDiagnostics().Reset();
+    ProcessWarningOptions(getDiagnostics(), Invocation->getDiagnosticOpts());
   }
   
   SimpleTimer ParsingTimer(WantTiming);
index e696284c09643ba14e42f859050557ca352ae93e..1972c2acb56812153bdc3b24d235314f12090d94 100644 (file)
@@ -1,6 +1,11 @@
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Weverything"
+
 namespace std {
   void wibble();
 }
 
+#pragma clang diagnostic pop
+
 namespace std {
 }