uninit-ps-rdar6145427.m revision 595c7ab8a482069a2c72bd979912283b3a705723
1// RUN: clang -verify -checker-cfref %s
2
3// Delta-Debugging reduced preamble.
4typedef signed char BOOL;
5typedef unsigned int NSUInteger;
6@class NSString, Protocol;
7extern void NSLog(NSString *format, ...) __attribute__((format(__NSString__, 1, 2)));
8typedef struct _NSZone NSZone;
9@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
10@protocol NSObject  - (BOOL)isEqual:(id)object; @end
11@protocol NSCopying  - (id)copyWithZone:(NSZone *)zone; @end
12@protocol NSCoding  - (void)encodeWithCoder:(NSCoder *)aCoder; @end
13@interface NSObject <NSObject> {} + (id)alloc; @end
14extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone);
15@interface NSValue : NSObject <NSCopying, NSCoding>  - (void)getValue:(void *)value; @end
16@class NSString, NSData;
17typedef struct _NSPoint {} NSRange;
18@interface NSValue (NSValueRangeExtensions) 
19+ (NSValue *)valueWithRange:(NSRange)range;
20- (id)objectAtIndex:(NSUInteger)index;
21@end
22@interface NSAutoreleasePool : NSObject {} - (void)drain; @end
23extern NSString * const NSBundleDidLoadNotification;
24typedef struct {} NSDecimal;
25@interface NSNetService : NSObject {} - (id)init; @end
26extern NSString * const NSUndoManagerCheckpointNotification;
27
28// Test case: <rdar://problem/6145427>
29
30int main (int argc, const char * argv[]) {
31  NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
32  id someUnintializedPointer = [someUnintializedPointer objectAtIndex:0]; // expected-warning{{Receiver in message expression is an uninitialized value.}}
33  NSLog(@"%@", someUnintializedPointer);    
34  [pool drain];
35  return 0;
36}
37