]> granicus.if.org Git - clang/commitdiff
Added test case for static analyzer to detect uses of uninitialized pointers as recei...
authorTed Kremenek <kremenek@apple.com>
Wed, 26 Mar 2008 21:51:44 +0000 (21:51 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 26 Mar 2008 21:51:44 +0000 (21:51 +0000)
Added test case directory "Analysis-Apple" which is only run on Apple (darwin) machines.

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

test/Analysis-Apple/uninit-msg-expr.m [new file with mode: 0644]
test/Makefile
test/Makefile.parallel

diff --git a/test/Analysis-Apple/uninit-msg-expr.m b/test/Analysis-Apple/uninit-msg-expr.m
new file mode 100644 (file)
index 0000000..cd42126
--- /dev/null
@@ -0,0 +1,13 @@
+// RUN: clang -grsimple -verify %s
+
+#include <Foundation/NSString.h>
+
+void f1() {
+  NSString *aString;
+  unsigned i = [aString length]; // expected-warning {{Receiver in message expression is an uninitialized value}}
+}
+
+void f2() {
+  NSString *aString = nil;
+  unsigned i = [aString length]; // no-warning
+}
index ec4d45e058ed8c45a9f19a8043e38e09ad98e0b1..38d0f3c24c6e50e8665ff46a8c76939bfce08a9a 100644 (file)
@@ -5,7 +5,7 @@ TESTDIRS := CodeGen Lexer Preprocessor Parser Sema Analysis Serialization
 
 # Only run rewriter tests on darwin.
 ifeq ($(OS),Darwin)
-TESTDIRS += Rewriter
+TESTDIRS += Rewriter Analysis-Apple
 endif
 
 all::
index 0a3ef843c7d0c143ac3275aca8d6b73364bb6e43..a88ff0e7a3ec6f1095cd9aeaa8b774d14b1c131f 100644 (file)
@@ -5,7 +5,7 @@ TESTDIRS = CodeGen Lexer Preprocessor Parser Sema Analysis Serialization
 
 # Only run rewriter tests on darwin.
 ifeq ($(OS),Darwin)
-TESTDIRS += Rewriter
+TESTDIRS += Rewriter Analysis-Apple
 endif
 
 ifdef VERBOSE