From 39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df Mon Sep 17 00:00:00 2001 From: dim Date: Sun, 20 Feb 2011 13:06:31 +0000 Subject: Vendor import of clang trunk r126079: http://llvm.org/svn/llvm-project/cfe/trunk@126079 --- test/Analysis/unreachable-code-path.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'test/Analysis/unreachable-code-path.c') diff --git a/test/Analysis/unreachable-code-path.c b/test/Analysis/unreachable-code-path.c index 0715327..52e6d3d 100644 --- a/test/Analysis/unreachable-code-path.c +++ b/test/Analysis/unreachable-code-path.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-experimental-checks -analyzer-check-objc-mem -analyzer-check-dead-stores -verify -analyzer-opt-analyze-nested-blocks %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental.UnreachableCode -analyzer-check-objc-mem -analyzer-checker=core.DeadStores -verify -analyzer-opt-analyze-nested-blocks -Wno-unused-value %s extern void foo(int a); @@ -93,8 +93,8 @@ void test9(unsigned a) { switch (a) { if (a) // expected-warning{{never executed}} foo(a + 5); // no-warning - else // no-warning - foo(a); // no-warning + else // no-warning + foo(a); // no-warning case 1: case 2: break; @@ -102,3 +102,23 @@ void test9(unsigned a) { break; } } + +// Tests from flow-sensitive version +void test10() { + goto c; + d: + goto e; // expected-warning {{never executed}} + c: ; + int i; + return; + goto b; // expected-warning {{never executed}} + goto a; // expected-warning {{never executed}} + b: + i = 1; // no-warning + a: + i = 2; // no-warning + goto f; + e: + goto d; + f: ; +} -- cgit v1.1