[cfe-commits] r89939 - /cfe/trunk/test/Analysis/dead-stores.c

Ted Kremenek kremenek at apple.com
Wed Nov 25 22:55:36 PST 2009


Author: kremenek
Date: Thu Nov 26 00:55:36 2009
New Revision: 89939

URL: http://llvm.org/viewvc/llvm-project?rev=89939&view=rev
Log:
Add test case that shows that dead stores checking now works in the presence of blocks.

Modified:
    cfe/trunk/test/Analysis/dead-stores.c

Modified: cfe/trunk/test/Analysis/dead-stores.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/dead-stores.c?rev=89939&r1=89938&r2=89939&view=diff

==============================================================================
--- cfe/trunk/test/Analysis/dead-stores.c (original)
+++ cfe/trunk/test/Analysis/dead-stores.c Thu Nov 26 00:55:36 2009
@@ -1,8 +1,8 @@
-// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -warn-dead-stores -verify %s
-// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -warn-dead-stores -verify %s
-// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -warn-dead-stores -verify %s
-// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -warn-dead-stores -verify %s
-// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -warn-dead-stores -verify %s
+// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -warn-dead-stores -fblocks -verify %s
+// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -warn-dead-stores -fblocks -verify %s
+// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -warn-dead-stores -fblocks -verify %s
+// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -warn-dead-stores -fblocks -verify %s
+// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -warn-dead-stores -fblocks -verify %s
 
 void f1() {
   int k, y;
@@ -354,3 +354,19 @@
     break;
   }
 }
+
+void f23_aux(const char* s);
+void f23(int argc, char **argv) {
+  int shouldLog = (argc > 1); // no-warning
+  ^{ 
+     if (shouldLog) f23_aux("I did too use it!\n");
+     else f23_aux("I shouldn't log.  Wait.. d'oh!\n");
+  }();
+}
+
+void f23_pos(int argc, char **argv) {
+  int shouldLog = (argc > 1); // expected-warning{{Value stored to 'shouldLog' during its initialization is never read}}
+  ^{ 
+     f23_aux("I did too use it!\n");
+  }();  
+}





More information about the cfe-commits mailing list