uninit-ps-rdar6145427.m revision d84f422ebfde2145bce79a8fa823e3393b392994
1// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify -analyzer-store=basic -analyzer-check-objc-mem %s 2// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify -analyzer-store=region -analyzer-check-objc-mem %s 3 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]; 33 id someUnintializedPointer = [someUnintializedPointer objectAtIndex:0]; // expected-warning{{Receiver in message expression is an uninitialized value}} 34 NSLog(@"%@", someUnintializedPointer); 35 [pool drain]; 36 return 0; 37} 38