]> granicus.if.org Git - clang/commitdiff
Move new test (that requires RegionStore) into its own file.
authorJordy Rose <jediknil@belkadan.com>
Thu, 29 Jul 2010 07:11:59 +0000 (07:11 +0000)
committerJordy Rose <jediknil@belkadan.com>
Thu, 29 Jul 2010 07:11:59 +0000 (07:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109736 91177308-0d34-0410-b5e6-96231b3b80d8

test/Analysis/array-struct-region.c [new file with mode: 0644]
test/Analysis/array-struct.c

diff --git a/test/Analysis/array-struct-region.c b/test/Analysis/array-struct-region.c
new file mode 100644 (file)
index 0000000..2966d13
--- /dev/null
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -analyze -analyzer-experimental-checks -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-checks -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s
+
+int string_literal_init() {
+  char a[] = "abc";
+  char b[2] = "abc"; // expected-warning{{too long}}
+  char c[5] = "abc";
+
+  if (a[1] != 'b')
+    return 0; // expected-warning{{never executed}}
+  if (b[1] != 'b')
+    return 0; // expected-warning{{never executed}}
+  if (c[1] != 'b')
+    return 0; // expected-warning{{never executed}}
+
+  if (a[3] != 0)
+    return 0; // expected-warning{{never executed}}
+  if (c[3] != 0)
+    return 0; // expected-warning{{never executed}}
+
+  if (c[4] != 0)
+    return 0; // expected-warning{{never executed}}
+
+  return 42;
+}
index ef9907bb579da1063c8c648e4a8b85a1169c19d6..3e46a0a62235f148da1629618becb290d1f780ed 100644 (file)
@@ -178,26 +178,3 @@ void f18() {
   if (*q) { // no-warning
   }
 }
-
-int f19() {
-  char a[] = "abc";
-  char b[2] = "abc"; // expected-warning{{too long}}
-  char c[5] = "abc";
-
-  if (a[1] != 'b')
-    return 5; // expected-warning{{never executed}}
-  if (b[1] != 'b')
-    return 5; // expected-warning{{never executed}}
-  if (c[1] != 'b')
-    return 5; // expected-warning{{never executed}}
-
-  if (a[3] != 0)
-    return 5; // expected-warning{{never executed}}
-  if (c[3] != 0)
-    return 5; // expected-warning{{never executed}}
-
-  if (c[4] != 0)
-    return 5; // expected-warning{{never executed}}
-
-  return 0;
-}