diff options
author | dim <dim@FreeBSD.org> | 2010-09-17 15:54:40 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2010-09-17 15:54:40 +0000 |
commit | 36c49e3f258dced101949edabd72e9bc3f1dedc4 (patch) | |
tree | 0bbe07708f7571f8b5291f6d7b96c102b7c99dee /test/SemaCXX/warn-for-var-in-else.cpp | |
parent | fc84956ac8b7cd244ef30e7a4d4d38a58dec5904 (diff) | |
download | FreeBSD-src-36c49e3f258dced101949edabd72e9bc3f1dedc4.zip FreeBSD-src-36c49e3f258dced101949edabd72e9bc3f1dedc4.tar.gz |
Vendor import of clang r114020 (from the release_28 branch):
http://llvm.org/svn/llvm-project/cfe/branches/release_28@114020
Approved by: rpaulo (mentor)
Diffstat (limited to 'test/SemaCXX/warn-for-var-in-else.cpp')
-rw-r--r-- | test/SemaCXX/warn-for-var-in-else.cpp | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/test/SemaCXX/warn-for-var-in-else.cpp b/test/SemaCXX/warn-for-var-in-else.cpp deleted file mode 100644 index 1307c43..0000000 --- a/test/SemaCXX/warn-for-var-in-else.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -// rdar://6425550 -int bar(); -void do_something(int); -int *get_ptr(); - -int foo() { - if (int X = bar()) { - return X; - } else { - do_something(X); // expected-warning{{'X' is always zero in this context}} - return 0; - } -} - -bool foo2() { - if (bool B = bar()) { - if (int Y = bar()) { - return B; - } else { - do_something(Y); // expected-warning{{'Y' is always zero in this context}} - return B; - } - } else { - if (bool B2 = B) { // expected-warning{{'B' is always false in this context}} - do_something(B); // expected-warning{{'B' is always false in this context}} - } else if (B2) { // expected-warning{{'B2' is always false in this context}} - do_something(B); // expected-warning{{'B' is always false in this context}} - do_something(B2); // expected-warning{{'B2' is always false in this context}} - } - return B; // expected-warning{{'B' is always false in this context}} - } -} - -void foo3() { - if (int *P1 = get_ptr()) - do_something(*P1); - else if (int *P2 = get_ptr()) { - do_something(*P1); // expected-warning{{'P1' is always NULL in this context}} - do_something(*P2); - } else { - do_something(*P1); // expected-warning{{'P1' is always NULL in this context}} - do_something(*P2); // expected-warning{{'P2' is always NULL in this context}} - } -} |