]> granicus.if.org Git - clang/commitdiff
[analyzer] Fix test in previous commit to account for compiler warning.
authorJordan Rose <jordan_rose@apple.com>
Thu, 19 Dec 2013 23:05:40 +0000 (23:05 +0000)
committerJordan Rose <jordan_rose@apple.com>
Thu, 19 Dec 2013 23:05:40 +0000 (23:05 +0000)
--analyze passes -w, but -cc1 -analyze doesn't. Oops!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197741 91177308-0d34-0410-b5e6-96231b3b80d8

test/Analysis/casts.cpp

index 763f942ede6b4335e75fb4d8299daa4710d08220..53e1cd085acd616aa8de668d5da76502c8987b25 100644 (file)
@@ -1,5 +1,4 @@
 // RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -verify %s
-// expected-no-diagnostics
 
 bool PR14634(int x) {
   double y = (double)x;
@@ -12,8 +11,13 @@ bool PR14634_implicit(int x) {
 }
 
 void intAsBoolAsSwitchCondition(int c) {
-  switch ((bool)c) {
+  switch ((bool)c) { // expected-warning {{switch condition has boolean value}}
   case 0:
     break;
   }
+
+  switch ((int)(bool)c) { // no-warning
+    case 0:
+      break;
+  }
 }