diff options
author | Manuel Klimek <klimek@google.com> | 2013-07-18 14:23:12 +0000 |
---|---|---|
committer | Manuel Klimek <klimek@google.com> | 2013-07-18 14:23:12 +0000 |
commit | be0474c047b1cb01225494ccb3210d501490685c (patch) | |
tree | c418f81fc92b19ad8269ea7d763399b81e157c59 | |
parent | 655bd0d08ca6df5898c9e64bd00ea39841932edb (diff) | |
download | bcm5719-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.cpp | 2 | ||||
-rw-r--r-- | clang/test/Index/c-index-unsupported-warning-test.c | 3 |
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(); |