[cfe-commits] r66136 - /cfe/trunk/test/Analysis/misc-ps-region-store.m

Ted Kremenek kremenek at apple.com
Wed Mar 4 20:55:10 PST 2009


Author: kremenek
Date: Wed Mar  4 22:55:08 2009
New Revision: 66136

URL: http://llvm.org/viewvc/llvm-project?rev=66136&view=rev
Log:
Add test case for RegionStore's tracking of the ivars of 'self'.

Modified:
    cfe/trunk/test/Analysis/misc-ps-region-store.m

Modified: cfe/trunk/test/Analysis/misc-ps-region-store.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps-region-store.m?rev=66136&r1=66135&r2=66136&view=diff

==============================================================================
--- cfe/trunk/test/Analysis/misc-ps-region-store.m (original)
+++ cfe/trunk/test/Analysis/misc-ps-region-store.m Wed Mar  4 22:55:08 2009
@@ -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;
+ at class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
+ at protocol NSObject  - (BOOL)isEqual:(id)object; @end
+ at protocol NSCopying  - (id)copyWithZone:(NSZone *)zone; @end
+ at protocol NSMutableCopying  - (id)mutableCopyWithZone:(NSZone *)zone; @end
+ at protocol NSCoding  - (void)encodeWithCoder:(NSCoder *)aCoder; @end
+ at interface NSObject <NSObject> {} - (id)init; @end
+extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone);
+ at interface NSString : NSObject <NSCopying, NSMutableCopying, NSCoding>
+- (NSUInteger)length;
++ (id)stringWithUTF8String:(const char *)nullTerminatedCString;
+ at end extern NSString * const NSBundleDidLoadNotification;
+ at interface NSAssertionHandler : NSObject {}
++ (NSAssertionHandler *)currentHandler;
+- (void)handleFailureInMethod:(SEL)selector object:(id)object file:(NSString *)fileName lineNumber:(NSInteger)line description:(NSString *)format,...;
+ at 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 @@
 
   return 'a';
 }
+
+///
+ at interface Test3 : NSObject {
+  int flag;
+}
+- (void)test_self_tracking;
+ at end
+
+ at implementation Test3
+- (void)test_self_tracking {
+  char *p = 0;
+  char c;
+
+  if (flag)
+    p = "hello";
+
+  if (flag)
+    c = *p; // no-warning
+}
+ at end
+





More information about the cfe-commits mailing list