r186582 - Fix crash in libclang if code completion is used with unknown flags.
Manuel Klimek
klimek at google.com
Thu Jul 18 07:23:13 PDT 2013
Author: klimek
Date: Thu Jul 18 09:23:12 2013
New Revision: 186582
URL: http://llvm.org/viewvc/llvm-project?rev=186582&view=rev
Log:
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.
Added:
cfe/trunk/test/Index/c-index-unsupported-warning-test.c
Modified:
cfe/trunk/lib/Frontend/ASTUnit.cpp
Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=186582&r1=186581&r2=186582&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp Thu Jul 18 09:23:12 2013
@@ -2410,10 +2410,10 @@ void ASTUnit::CodeComplete(StringRef Fil
// 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(),
Added: cfe/trunk/test/Index/c-index-unsupported-warning-test.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/c-index-unsupported-warning-test.c?rev=186582&view=auto
==============================================================================
--- cfe/trunk/test/Index/c-index-unsupported-warning-test.c (added)
+++ cfe/trunk/test/Index/c-index-unsupported-warning-test.c Thu Jul 18 09:23:12 2013
@@ -0,0 +1,3 @@
+// RUN: c-index-test -code-completion-at=%s:1:1 -Wunknown-foo-bar-warning -Werror %s
+
+void f();
More information about the cfe-commits
mailing list