diff options
author | Kadir Cetinkaya <kadircet@google.com> | 2018-10-23 13:49:37 +0000 |
---|---|---|
committer | Kadir Cetinkaya <kadircet@google.com> | 2018-10-23 13:49:37 +0000 |
commit | 513ac508c95f7049f54f779d8c82d48d99a00c8b (patch) | |
tree | 35c88e822e4efa65ca34404d3c3e654aeb3a1553 /test/Index/complete-switch.c | |
parent | dbace9b63720354837ba30897ca16b94b87ed709 (diff) | |
download | clang-513ac508c95f7049f54f779d8c82d48d99a00c8b.tar.gz |
[clang] Fix a null pointer dereference.
Summary:
Sometimes expression inside switch statement can be invalid, for
example type might be incomplete. In those cases code were causing a null
pointer dereference. This patch fixes that.
Reviewers: sammccall, ioeric, hokein
Reviewed By: sammccall
Subscribers: arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D53561
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345029 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Index/complete-switch.c')
-rw-r--r-- | test/Index/complete-switch.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/Index/complete-switch.c b/test/Index/complete-switch.c new file mode 100644 index 0000000000..9a9438c28d --- /dev/null +++ b/test/Index/complete-switch.c @@ -0,0 +1,10 @@ +void f() { + auto foo = bar; + switch(foo) { + case x: + break; + } +} + +// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:4:10 %s | FileCheck %s -allow-empty +// CHECK-NOT: COMPLETION: foo |