Ted Kremenek | 565e465 | 2010-02-05 02:06:54 +0000 | [diff] [blame] | 1 | // 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 Kremenek | 595c7ab | 2008-08-13 03:55:18 +0000 | [diff] [blame] | 3 | |
| 4 | // Delta-Debugging reduced preamble. |
| 5 | typedef signed char BOOL; |
| 6 | typedef unsigned int NSUInteger; |
| 7 | @class NSString, Protocol; |
| 8 | extern void NSLog(NSString *format, ...) __attribute__((format(__NSString__, 1, 2))); |
| 9 | typedef 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 |
| 15 | extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone); |
| 16 | @interface NSValue : NSObject <NSCopying, NSCoding> - (void)getValue:(void *)value; @end |
| 17 | @class NSString, NSData; |
| 18 | typedef 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 |
| 24 | extern NSString * const NSBundleDidLoadNotification; |
| 25 | typedef struct {} NSDecimal; |
| 26 | @interface NSNetService : NSObject {} - (id)init; @end |
| 27 | extern NSString * const NSUndoManagerCheckpointNotification; |
| 28 | |
| 29 | // Test case: <rdar://problem/6145427> |
| 30 | |
| 31 | int main (int argc, const char * argv[]) { |
| 32 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; |
Ted Kremenek | c79d7d4 | 2009-11-21 01:25:37 +0000 | [diff] [blame] | 33 | id someUnintializedPointer = [someUnintializedPointer objectAtIndex:0]; // expected-warning{{Receiver in message expression is a garbage value}} |
Ted Kremenek | 595c7ab | 2008-08-13 03:55:18 +0000 | [diff] [blame] | 34 | NSLog(@"%@", someUnintializedPointer); |
| 35 | [pool drain]; |
| 36 | return 0; |
| 37 | } |