summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2013-07-18 14:23:12 +0000
committerManuel Klimek <klimek@google.com>2013-07-18 14:23:12 +0000
commitbe0474c047b1cb01225494ccb3210d501490685c (patch)
treec418f81fc92b19ad8269ea7d763399b81e157c59
parent655bd0d08ca6df5898c9e64bd00ea39841932edb (diff)
downloadbcm5719-llvm-be0474c047b1cb01225494ccb3210d501490685c.tar.gz
bcm5719-llvm-be0474c047b1cb01225494ccb3210d501490685c.zip
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
-rw-r--r--clang/lib/Frontend/ASTUnit.cpp2
-rw-r--r--clang/test/Index/c-index-unsupported-warning-test.c3
2 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index c1f6bc5bb0e..9251fc0daa0 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -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(),
diff --git a/clang/test/Index/c-index-unsupported-warning-test.c b/clang/test/Index/c-index-unsupported-warning-test.c
new file mode 100644
index 00000000000..82ed06359d7
--- /dev/null
+++ b/clang/test/Index/c-index-unsupported-warning-test.c
@@ -0,0 +1,3 @@
+// RUN: c-index-test -code-completion-at=%s:1:1 -Wunknown-foo-bar-warning -Werror %s
+
+void f();
OpenPOWER on IntegriCloud