diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-03-05 04:55:08 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-03-05 04:55:08 +0000 |
commit | aad45e0e0fef78af16849714047d877bb4473de8 (patch) | |
tree | d7e6b3bc79546f5810a0dc0fc123bf427792c09c | |
parent | 3de2d3c2dde13ea145551d1dc23fd36034d5bc75 (diff) |
Add test case for RegionStore's tracking of the ivars of 'self'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66136 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/Analysis/misc-ps-region-store.m | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/Analysis/misc-ps-region-store.m b/test/Analysis/misc-ps-region-store.m index 4759848b9a..a72f235331 100644 --- a/test/Analysis/misc-ps-region-store.m +++ b/test/Analysis/misc-ps-region-store.m @@ -1,5 +1,28 @@ // RUN: clang -analyze -checker-cfref --analyzer-store=region --verify -fblocks %s +typedef struct objc_selector *SEL; +typedef signed char BOOL; +typedef int NSInteger; +typedef unsigned int NSUInteger; +typedef struct _NSZone NSZone; +@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; +@protocol NSObject - (BOOL)isEqual:(id)object; @end +@protocol NSCopying - (id)copyWithZone:(NSZone *)zone; @end +@protocol NSMutableCopying - (id)mutableCopyWithZone:(NSZone *)zone; @end +@protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; @end +@interface NSObject <NSObject> {} - (id)init; @end +extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone); +@interface NSString : NSObject <NSCopying, NSMutableCopying, NSCoding> +- (NSUInteger)length; ++ (id)stringWithUTF8String:(const char *)nullTerminatedCString; +@end extern NSString * const NSBundleDidLoadNotification; +@interface NSAssertionHandler : NSObject {} ++ (NSAssertionHandler *)currentHandler; +- (void)handleFailureInMethod:(SEL)selector object:(id)object file:(NSString *)fileName lineNumber:(NSInteger)line description:(NSString *)format,...; +@end +extern NSString * const NSConnectionReplyMode; + + //--------------------------------------------------------------------------- // Test case 'checkaccess_union' differs for region store and basic store. // The basic store doesn't reason about compound literals, so the code @@ -44,3 +67,24 @@ char test2() { return 'a'; } + +/// +@interface Test3 : NSObject { + int flag; +} +- (void)test_self_tracking; +@end + +@implementation Test3 +- (void)test_self_tracking { + char *p = 0; + char c; + + if (flag) + p = "hello"; + + if (flag) + c = *p; // no-warning +} +@end + |