aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/dead-stores.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis/dead-stores.cpp')
-rw-r--r--test/Analysis/dead-stores.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/Analysis/dead-stores.cpp b/test/Analysis/dead-stores.cpp
new file mode 100644
index 000000000000..9ddb7979ca69
--- /dev/null
+++ b/test/Analysis/dead-stores.cpp
@@ -0,0 +1,19 @@
+// RUN: clang-cc -analyze -warn-dead-stores -verify %s &&
+// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -warn-dead-stores -verify %s &&
+// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range -warn-dead-stores -verify %s &&
+// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic -warn-dead-stores -verify %s &&
+// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range -warn-dead-stores -verify %s
+
+int j;
+void f1() {
+ int x = 4;
+
+ ++x; // expected-warning{{never read}}
+
+ switch (j) {
+ case 1:
+ throw 1;
+ (void)x;
+ break;
+ }
+}