1 // RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-store=region -verify %s
3 //===----------------------------------------------------------------------===//
4 // The following code is reduced using delta-debugging from
5 // Foundation.h (Mac OS X).
7 // It includes the basic definitions for the test cases below.
8 // Not directly including Foundation.h directly makes this test case
9 // both svelte and portable to non-Mac platforms.
10 //===----------------------------------------------------------------------===//
12 typedef signed char BOOL;
13 typedef unsigned int NSUInteger;
14 typedef struct _NSZone NSZone;
15 @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
16 @protocol NSObject - (BOOL)isEqual:(id)object; @end
17 @protocol NSCopying - (id)copyWithZone:(NSZone *)zone; @end
18 @protocol NSMutableCopying - (id)mutableCopyWithZone:(NSZone *)zone; @end
19 @protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; @end
20 @interface NSObject <NSObject> {} @end
21 @class NSString, NSData;
22 @class NSString, NSData, NSMutableData, NSMutableDictionary, NSMutableArray;
23 typedef struct {} NSFastEnumerationState;
24 @protocol NSFastEnumeration
25 - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len;
27 @class NSData, NSIndexSet, NSString, NSURL;
28 @interface NSArray : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration>
31 @interface NSArray (NSArrayCreation)
34 - (void)addObject:(id)object;
36 extern NSString * const NSUndoManagerCheckpointNotification;
38 //===----------------------------------------------------------------------===//
40 //===----------------------------------------------------------------------===//
44 return [aString length]; // expected-warning {{Receiver in message expression is an uninitialized value}}
48 NSString *aString = 0;
49 return [aString length]; // no-warning
53 NSMutableArray *aArray = [NSArray array];
55 [aArray addObject:aString]; // expected-warning {{1st argument in message expression is an uninitialized value}}