[cfe-commits] r113458 - /cfe/trunk/test/Analysis/misc-ps.m
Ted Kremenek
kremenek at apple.com
Wed Sep 8 17:40:43 PDT 2010
Author: kremenek
Date: Wed Sep 8 19:40:43 2010
New Revision: 113458
URL: http://llvm.org/viewvc/llvm-project?rev=113458&view=rev
Log:
Include test case for <rdar://problem/5880430>.
Modified:
cfe/trunk/test/Analysis/misc-ps.m
Modified: cfe/trunk/test/Analysis/misc-ps.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps.m?rev=113458&r1=113457&r2=113458&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/misc-ps.m (original)
+++ cfe/trunk/test/Analysis/misc-ps.m Wed Sep 8 19:40:43 2010
@@ -1068,3 +1068,30 @@
*arg = malloc(1);
}
+// <rdar://problem/5880430> Switch on enum should not consider default case live
+// if all enum values are covered
+enum Cases { C1, C2, C3, C4 };
+void test_enum_cases(enum Cases C) {
+ switch (C) {
+ case C1:
+ case C2:
+ case C4:
+ case C3:
+ return;
+ }
+ int *p = 0;
+ *p = 0xDEADBEEF; // no-warning
+}
+
+void test_enum_cases_positive(enum Cases C) {
+ switch (C) { // expected-warning{{enumeration value 'C4' not handled in switch}}
+ case C1:
+ case C2:
+ case C3:
+ return;
+ }
+ int *p = 0;
+ *p = 0xDEADBEEF; // expected-warning{{Dereference of null pointer}}
+}
+
+
More information about the cfe-commits
mailing list