Author: d0k Date: Mon Feb 13 10:16:43 2017 New Revision: 294963 URL: http://llvm.org/viewvc/llvm-project?rev=294963&view=rev Log: [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. Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp cfe/trunk/test/Index/complete-preamble.h Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=294963&r1=294962&r2=294963&view=diff ============================================================================== --- cfe/trunk/lib/Frontend/ASTUnit.cpp (original) +++ cfe/trunk/lib/Frontend/ASTUnit.cpp Mon Feb 13 10:16:43 2017 @@ -1891,6 +1891,8 @@ bool ASTUnit::LoadFromCompilerInvocation PreambleRebuildCounter = PrecompilePreambleAfterNParses; OverrideMainBuffer = getMainBufferWithPrecompiledPreamble(PCHContainerOps, *Invocation); + getDiagnostics().Reset(); + ProcessWarningOptions(getDiagnostics(), Invocation->getDiagnosticOpts()); } SimpleTimer ParsingTimer(WantTiming); Modified: cfe/trunk/test/Index/complete-preamble.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-preamble.h?rev=294963&r1=294962&r2=294963&view=diff ============================================================================== --- cfe/trunk/test/Index/complete-preamble.h (original) +++ cfe/trunk/test/Index/complete-preamble.h Mon Feb 13 10:16:43 2017 @@ -1,6 +1,11 @@ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Weverything" + namespace std { void wibble(); } +#pragma clang diagnostic pop + namespace std { } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits