mirror of https://github.com/microsoft/clang.git
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186582 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2dbdef2374
commit
f0c06a3fa4
|
@ -2410,10 +2410,10 @@ void ASTUnit::CodeComplete(StringRef File, unsigned Line, unsigned Column,
|
||||||
|
|
||||||
// Set up diagnostics, capturing any diagnostics produced.
|
// Set up diagnostics, capturing any diagnostics produced.
|
||||||
Clang->setDiagnostics(&Diag);
|
Clang->setDiagnostics(&Diag);
|
||||||
ProcessWarningOptions(Diag, CCInvocation->getDiagnosticOpts());
|
|
||||||
CaptureDroppedDiagnostics Capture(true,
|
CaptureDroppedDiagnostics Capture(true,
|
||||||
Clang->getDiagnostics(),
|
Clang->getDiagnostics(),
|
||||||
StoredDiagnostics);
|
StoredDiagnostics);
|
||||||
|
ProcessWarningOptions(Diag, CCInvocation->getDiagnosticOpts());
|
||||||
|
|
||||||
// Create the target instance.
|
// Create the target instance.
|
||||||
Clang->setTarget(TargetInfo::CreateTargetInfo(Clang->getDiagnostics(),
|
Clang->setTarget(TargetInfo::CreateTargetInfo(Clang->getDiagnostics(),
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
// RUN: c-index-test -code-completion-at=%s:1:1 -Wunknown-foo-bar-warning -Werror %s
|
||||||
|
|
||||||
|
void f();
|
Loading…
Reference in New Issue