Ted Kremenek | 8382cf5 | 2009-11-13 18:46:29 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -analyze -analyzer-experimental-internal-checks -warn-dead-stores -verify %s |
Ted Kremenek | 0364865 | 2008-07-03 22:25:27 +0000 | [diff] [blame] | 2 | |
| 3 | typedef signed char BOOL; |
| 4 | typedef unsigned int NSUInteger; |
| 5 | typedef struct _NSZone NSZone; |
| 6 | @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; |
| 7 | @protocol NSObject - (BOOL)isEqual:(id)object; @end |
| 8 | @protocol NSCopying - (id)copyWithZone:(NSZone *)zone; @end |
| 9 | @protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; @end |
| 10 | @interface NSObject <NSObject> {} @end |
| 11 | extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone); |
| 12 | @interface NSValue : NSObject <NSCopying, NSCoding> - (void)getValue:(void *)value; @end |
| 13 | typedef float CGFloat; |
| 14 | typedef struct _NSPoint {} NSRange; |
| 15 | @interface NSValue (NSValueRangeExtensions) + (NSValue *)valueWithRange:(NSRange)range; |
| 16 | - (BOOL)containsObject:(id)anObject; |
| 17 | @end |
| 18 | @class NSURLAuthenticationChallenge; |
| 19 | @interface NSResponder : NSObject <NSCoding> {} @end |
| 20 | @class NSArray, NSDictionary, NSString; |
| 21 | @interface NSObject (NSKeyValueBindingCreation) |
| 22 | + (void)exposeBinding:(NSString *)binding; |
| 23 | - (NSArray *)exposedBindings; |
| 24 | @end |
| 25 | extern NSString *NSAlignmentBinding; |
| 26 | |
| 27 | // This test case was reported as a false positive due to a bug in the |
| 28 | // LiveVariables <-> DeadStores interplay. We should not flag a warning |
| 29 | // here. The test case was reported in: |
| 30 | // http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-July/002157.html |
| 31 | void DeadStoreTest(NSObject *anObject) { |
| 32 | NSArray *keys; |
| 33 | if ((keys = [anObject exposedBindings]) && // no-warning |
| 34 | ([keys containsObject:@"name"] && [keys containsObject:@"icon"])) {} |
| 35 | } |
| 36 | |