Fix crash in libclang if code completion is used with unknown flags.

Use CaptureDroppedDiagnostics to make sure that there is a diagnostic
client installed when warning flags are parsed.

llvm-svn: 186582
This commit is contained in:
Manuel Klimek 2013-07-18 14:23:12 +00:00
parent 655bd0d08c
commit be0474c047
2 changed files with 4 additions and 1 deletions

View File

@ -2410,10 +2410,10 @@ void ASTUnit::CodeComplete(StringRef File, unsigned Line, unsigned Column,
// Set up diagnostics, capturing any diagnostics produced.
Clang->setDiagnostics(&Diag);
ProcessWarningOptions(Diag, CCInvocation->getDiagnosticOpts());
CaptureDroppedDiagnostics Capture(true,
Clang->getDiagnostics(),
StoredDiagnostics);
ProcessWarningOptions(Diag, CCInvocation->getDiagnosticOpts());
// Create the target instance.
Clang->setTarget(TargetInfo::CreateTargetInfo(Clang->getDiagnostics(),

View File

@ -0,0 +1,3 @@
// RUN: c-index-test -code-completion-at=%s:1:1 -Wunknown-foo-bar-warning -Werror %s
void f();