From 5f67d13b3bc1901cd77678fd2b1d73b99bd24913 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Wed, 26 Mar 2008 22:00:11 +0000 Subject: [PATCH] Added test case for static analysis to warn about passing uninitialized values as arguments (not the receiver) in message expressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48845 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Analysis-Apple/uninit-msg-expr.m | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/Analysis-Apple/uninit-msg-expr.m b/test/Analysis-Apple/uninit-msg-expr.m index cd42126b30..9ce458925c 100644 --- a/test/Analysis-Apple/uninit-msg-expr.m +++ b/test/Analysis-Apple/uninit-msg-expr.m @@ -1,6 +1,7 @@ // RUN: clang -grsimple -verify %s #include +#include void f1() { NSString *aString; @@ -11,3 +12,9 @@ void f2() { NSString *aString = nil; unsigned i = [aString length]; // no-warning } + +void f3() { + NSMutableArray *aArray = [NSArray array]; + NSString *aString; + [aArray addObject:aString]; // expected-warning {{Pass-by-value argument in message expression is undefined.}} +}