blob: 1409dbd1df5e36c6442690cbd790e0688fb3e094 [file] [log] [blame]
Ted Kremenek565e4652010-02-05 02:06:54 +00001// RUN: %clang_cc1 -analyze -verify -analyzer-store=basic -analyzer-check-objc-mem %s
2// RUN: %clang_cc1 -analyze -verify -analyzer-store=region -analyzer-check-objc-mem %s
Ted Kremenek595c7ab2008-08-13 03:55:18 +00003
4// Delta-Debugging reduced preamble.
5typedef signed char BOOL;
6typedef unsigned int NSUInteger;
7@class NSString, Protocol;
8extern void NSLog(NSString *format, ...) __attribute__((format(__NSString__, 1, 2)));
9typedef struct _NSZone NSZone;
10@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
11@protocol NSObject - (BOOL)isEqual:(id)object; @end
12@protocol NSCopying - (id)copyWithZone:(NSZone *)zone; @end
13@protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; @end
14@interface NSObject <NSObject> {} + (id)alloc; @end
15extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone);
16@interface NSValue : NSObject <NSCopying, NSCoding> - (void)getValue:(void *)value; @end
17@class NSString, NSData;
18typedef struct _NSPoint {} NSRange;
19@interface NSValue (NSValueRangeExtensions)
20+ (NSValue *)valueWithRange:(NSRange)range;
21- (id)objectAtIndex:(NSUInteger)index;
22@end
23@interface NSAutoreleasePool : NSObject {} - (void)drain; @end
24extern NSString * const NSBundleDidLoadNotification;
25typedef struct {} NSDecimal;
26@interface NSNetService : NSObject {} - (id)init; @end
27extern NSString * const NSUndoManagerCheckpointNotification;
28
29// Test case: <rdar://problem/6145427>
30
31int main (int argc, const char * argv[]) {
32 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
Ted Kremenekc79d7d42009-11-21 01:25:37 +000033 id someUnintializedPointer = [someUnintializedPointer objectAtIndex:0]; // expected-warning{{Receiver in message expression is a garbage value}}
Ted Kremenek595c7ab2008-08-13 03:55:18 +000034 NSLog(@"%@", someUnintializedPointer);
35 [pool drain];
36 return 0;
37}