void clang_analyzer_eval(int);
#define nil ((id)0)
typedef const void * CFTypeRef;
extern CFTypeRef CFRetain(CFTypeRef cf);
void CFRelease(CFTypeRef cf);
typedef signed char BOOL;
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 NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; @end
@protocol NSMutableCopying - (id)mutableCopyWithZone:(NSZone *)zone; @end
@interface NSObject <NSObject> {}
+(id)alloc;
-(id)init;
-(id)autorelease;
-(id)copy;
-(id)retain;
-(oneway void)release;
-(void)dealloc;
@end
@interface NSString : NSObject <NSCopying, NSMutableCopying, NSCoding>
- (NSUInteger)length;
-(id)initWithFormat:(NSString *)f,...;
-(BOOL)isEqualToString:(NSString *)s;
+ (id)string;
@end
@interface NSNumber : NSObject {}
+(id)alloc;
-(id)initWithInteger:(int)i;
@end
@interface Test1 : NSObject {
NSString *text;
}
-(id)myMethod;
@property (nonatomic, assign) NSString *text;
@end
#if !__has_feature(objc_arc)
@implementation Test1
@synthesize text;
-(id)myMethod {
Test1 *cell = [[[Test1 alloc] init] autorelease];
NSString *string1 = [[NSString alloc] initWithFormat:@"test %f", 0.0]; cell.text = string1;
return cell;
}
@end
@interface MyNumber : NSObject
{
NSNumber* _myNumber;
}
- (id)initWithNumber:(NSNumber *)number;
@property (nonatomic, readonly) NSNumber* myNumber;
@property (nonatomic, readonly) NSNumber* newMyNumber;
@end
@implementation MyNumber
@synthesize myNumber=_myNumber;
- (id)initWithNumber:(NSNumber *)number
{
self = [super init];
if ( self )
{
_myNumber = [number copy];
}
return self;
}
- (NSNumber*)newMyNumber
{
if ( _myNumber )
return [_myNumber retain];
return [[NSNumber alloc] initWithInteger:1];
}
- (id)valueForUndefinedKey:(NSString*)key
{
id value = 0;
if ([key isEqualToString:@"MyIvarNumberAsPropertyOverReleased"])
value = self.myNumber; else if ([key isEqualToString:@"MyIvarNumberAsPropertyOk"])
value = [self.myNumber retain]; else if ([key isEqualToString:@"MyIvarNumberAsNewMyNumber"])
value = self.newMyNumber; else
value = [[NSNumber alloc] initWithInteger:0];
return [value autorelease]; }
@end
NSNumber* numberFromMyNumberProperty(MyNumber* aMyNumber)
{
NSNumber* result = aMyNumber.myNumber;
return [result autorelease]; }
#endif
@interface Person : NSObject {
NSString *_name;
}
@property (retain) NSString * name;
@property (assign) id friend;
@end
@implementation Person
@synthesize name = _name;
-(void)dealloc {
#if !__has_feature(objc_arc)
self.name = [[NSString alloc] init];
[super dealloc]; #endif
}
@end
#if !__has_feature(objc_arc)
void rdar6611873(void) {
Person *p = [[[Person alloc] init] autorelease];
p.name = [[NSString string] retain]; p.name = [[NSString alloc] init];
p.friend = [[Person alloc] init]; }
#endif
@interface SubPerson : Person
-(NSString *)foo;
@end
@implementation SubPerson
-(NSString *)foo {
return super.name;
}
@end
#if !__has_feature(objc_arc)
@interface RDar9241180
@property (readwrite,assign) id x;
-(id)testAnalyzer1:(int) y;
-(void)testAnalyzer2;
@end
@implementation RDar9241180
@synthesize x;
-(id)testAnalyzer1:(int)y {
RDar9241180 *o;
if (y && o.x) return o;
return o; }
-(void)testAnalyzer2 {
id y;
self.x = y; }
@end
#endif
extern void doSomethingWithPerson(Person *p);
extern void doSomethingWithName(NSString *name);
void testConsistencyRetain(Person *p) {
clang_analyzer_eval(p.name == p.name);
id origName = p.name;
clang_analyzer_eval(p.name == origName); doSomethingWithPerson(p);
clang_analyzer_eval(p.name == origName); }
void testConsistencyAssign(Person *p) {
clang_analyzer_eval(p.friend == p.friend);
id origFriend = p.friend;
clang_analyzer_eval(p.friend == origFriend); doSomethingWithPerson(p);
clang_analyzer_eval(p.friend == origFriend); }
@interface ClassWithShadowedReadWriteProperty {
int _f;
}
@property (readonly) int someProp;
@end
@interface ClassWithShadowedReadWriteProperty ()
@property (readwrite) int someProp;
@end
@implementation ClassWithShadowedReadWriteProperty
- (void)testSynthesisForShadowedReadWriteProperties; {
clang_analyzer_eval(self.someProp == self.someProp);
_f = 1;
(void)self.someProp;
clang_analyzer_eval(_f == 1);
_f = 2;
(void)[self someProp];
clang_analyzer_eval(_f == 2); }
@end
@interface ClassWithRedeclaredPropertyInExtensionFollowedByCategory
@end
@interface ClassWithRedeclaredPropertyInExtensionFollowedByCategory ()
@end
@interface ClassWithRedeclaredPropertyInExtensionFollowedByCategory ()
@property (readwrite) int someProp;
@property (readonly) int otherProp;
@end
@interface ClassWithRedeclaredPropertyInExtensionFollowedByCategory (MyCat)
@property (readonly) int someProp;
@property (readonly) int otherProp;
@end
@implementation ClassWithRedeclaredPropertyInExtensionFollowedByCategory
- (void)testSynthesisForRedeclaredProperties; {
clang_analyzer_eval(self.someProp == self.someProp); clang_analyzer_eval([self someProp] == self.someProp);
clang_analyzer_eval(self.otherProp == self.otherProp); clang_analyzer_eval([self otherProp] == self.otherProp); }
@end
@interface ClassWithRedeclaredPropertyInCategoryFollowedByExtension
@end
@interface ClassWithRedeclaredPropertyInCategoryFollowedByExtension ()
@property (readwrite) int someProp;
@end
@interface ClassWithRedeclaredPropertyInCategoryFollowedByExtension (MyCat)
@property (readonly) int someProp;
@end
@implementation ClassWithRedeclaredPropertyInCategoryFollowedByExtension
- (void)testSynthesisForRedeclaredProperties; {
clang_analyzer_eval(self.someProp == self.someProp); clang_analyzer_eval([self someProp] == self.someProp); }
@end
@interface ClassWithSynthesizedPropertyAndGetter
@property (readonly) int someProp;
@end
@implementation ClassWithSynthesizedPropertyAndGetter
@synthesize someProp;
- (void)testBodyFarmGetterNotUsed {
int i = self.someProp;
clang_analyzer_eval(i == 22); }
-(int)someProp {
return 22;
}
@end
__attribute__((objc_root_class))
@interface ClassWithPrivatePropertyInClassExtensionWithProtocolShadowingCategory
@end
@protocol HasStuff
@property (nonatomic, readonly) int stuffProperty;
@end
@interface ClassWithPrivatePropertyInClassExtensionWithProtocolShadowingCategory (Private)
@property (nonatomic, readonly) int stuffProperty;
@end
@interface ClassWithPrivatePropertyInClassExtensionWithProtocolShadowingCategory (Internal) <HasStuff>
@end
@interface ClassWithPrivatePropertyInClassExtensionWithProtocolShadowingCategory() <HasStuff>
@end
@implementation ClassWithPrivatePropertyInClassExtensionWithProtocolShadowingCategory
@synthesize stuffProperty = _stuffProperty;
-(void)foo {
(void)self.stuffProperty;
}
@end
@interface ClassWithSetters
@property (assign) int propWithIvar1;
@property (assign) int propWithIvar2;
@property (retain) NSNumber *retainedProperty;
@end
@interface ClassWithSetters (InOtherTranslationUnit)
@property (assign) int propInOther;
@end
@implementation ClassWithSetters
- (void) testSettingPropWithIvarInvalidatesExactlyThatIvar; {
_propWithIvar1 = 1;
_propWithIvar2 = 2;
self.propWithIvar1 = 66;
clang_analyzer_eval(_propWithIvar1 == 66); clang_analyzer_eval(_propWithIvar2 == 2);
_propWithIvar1 = 1;
[self setPropWithIvar1:66];
clang_analyzer_eval(_propWithIvar1 == 66); clang_analyzer_eval(_propWithIvar2 == 2); }
- (void) testSettingPropWithoutIvarInvalidatesEntireInstance; {
_propWithIvar1 = 1;
_propWithIvar2 = 2;
self.propInOther = 66;
clang_analyzer_eval(_propWithIvar1 == 66); clang_analyzer_eval(_propWithIvar2 == 2);
_propWithIvar1 = 1;
_propWithIvar2 = 2;
[self setPropInOther:66];
clang_analyzer_eval(_propWithIvar1 == 66); clang_analyzer_eval(_propWithIvar2 == 2); }
#if !__has_feature(objc_arc)
- (void) testWriteRetainedValueToRetainedProperty; {
NSNumber *number = [[NSNumber alloc] initWithInteger:5];
self.retainedProperty = number;
}
#endif
@end
int gBackingForReadWriteClassProp = 0;
@interface ClassWithClassProperties
@property(class, readonly) int readOnlyClassProp;
@property(class) int readWriteClassProp;
@property(readonly) int classAndInstancePropWithSameNameOrderInstanceFirst;
@property(class, readonly) int classAndInstancePropWithSameNameOrderInstanceFirst;
@property(class, readonly) int classAndInstancePropWithSameNameOrderClassFirst;
@property(readonly) int classAndInstancePropWithSameNameOrderClassFirst;
@property(class, readonly) int dynamicClassProp;
@end
@interface ClassWithClassProperties (OtherTranslationUnit)
@property(class, assign) id propInOtherTranslationUnit;
@end
@implementation ClassWithClassProperties
@dynamic dynamicClassProp;
+ (int)readOnlyClassProp {
return 1;
}
+ (int)readWriteClassProp {
return gBackingForReadWriteClassProp;
}
+ (void)setReadWriteClassProp:(int)val {
gBackingForReadWriteClassProp = val;
}
- (int)classAndInstancePropWithSameNameOrderInstanceFirst {
return 12;
}
+ (int)classAndInstancePropWithSameNameOrderInstanceFirst {
return 13;
}
+ (int)classAndInstancePropWithSameNameOrderClassFirst {
return 14;
}
- (int)classAndInstancePropWithSameNameOrderClassFirst {
return 15;
}
- (void)testInlineClassProp {
clang_analyzer_eval(ClassWithClassProperties.readOnlyClassProp == 1);
ClassWithClassProperties.readWriteClassProp = 7;
clang_analyzer_eval(ClassWithClassProperties.readWriteClassProp == 7); ClassWithClassProperties.readWriteClassProp = 8;
clang_analyzer_eval(ClassWithClassProperties.readWriteClassProp == 8); }
- (void)testUnknownClassProp {
clang_analyzer_eval(ClassWithClassProperties.propInOtherTranslationUnit == ClassWithClassProperties.propInOtherTranslationUnit); }
- (void)testEscapeGlobalOnUnknownProp {
gBackingForReadWriteClassProp = 33;
ClassWithClassProperties.propInOtherTranslationUnit = 0;
clang_analyzer_eval(gBackingForReadWriteClassProp == 33); }
- (void)testClassAndInstancePropertyWithSameName {
clang_analyzer_eval(self.classAndInstancePropWithSameNameOrderInstanceFirst == 12); clang_analyzer_eval(ClassWithClassProperties.classAndInstancePropWithSameNameOrderInstanceFirst == 13);
clang_analyzer_eval(ClassWithClassProperties.classAndInstancePropWithSameNameOrderClassFirst == 14); clang_analyzer_eval(self.classAndInstancePropWithSameNameOrderClassFirst == 15); }
- (void)testDynamicClassProp {
clang_analyzer_eval(ClassWithClassProperties.dynamicClassProp == 16); }
@end
@interface SubclassOfClassWithClassProperties : ClassWithClassProperties
@end
@implementation SubclassOfClassWithClassProperties
+ (int)dynamicClassProp; {
return 16;
}
- (void)testDynamicClassProp {
clang_analyzer_eval(SubclassOfClassWithClassProperties.dynamicClassProp == 16); }
@end
#if !__has_feature(objc_arc)
void testOverrelease(Person *p, int coin) {
switch (coin) {
case 0:
[p.name release]; break;
case 1:
[p.friend release]; break;
case 2: {
id friend = p.friend;
doSomethingWithPerson(p);
[friend release]; }
}
}
@implementation Person (Rdar16333368)
- (void)testDeliberateRelease:(Person *)other {
doSomethingWithName(self.name);
[_name release]; self->_name = 0;
doSomethingWithName(other->_name);
[other.name release]; }
- (void)deliberateReleaseFalseNegative {
id name = self.name;
_name = 0;
[name release];
}
- (void)testRetainAndRelease {
[self.name retain];
[self.name release];
[self.name release]; }
- (void)testRetainAndReleaseIVar {
[self.name retain];
[_name release];
[_name release];
}
@end
#endif
@interface IntWrapper
@property int value;
@end
@implementation IntWrapper
@synthesize value;
@end
void testConsistencyInt(IntWrapper *w) {
clang_analyzer_eval(w.value == w.value);
int origValue = w.value;
if (origValue != 42)
return;
clang_analyzer_eval(w.value == 42); }
void testConsistencyInt2(IntWrapper *w) {
if (w.value != 42)
return;
clang_analyzer_eval(w.value == 42); }
@interface IntWrapperAuto
@property int value;
@end
@implementation IntWrapperAuto
@end
void testConsistencyIntAuto(IntWrapperAuto *w) {
clang_analyzer_eval(w.value == w.value);
int origValue = w.value;
if (origValue != 42)
return;
clang_analyzer_eval(w.value == 42); }
void testConsistencyIntAuto2(IntWrapperAuto *w) {
if (w.value != 42)
return;
clang_analyzer_eval(w.value == 42); }
typedef struct {
int value;
} IntWrapperStruct;
@interface StructWrapper
@property IntWrapperStruct inner;
@end
@implementation StructWrapper
@synthesize inner;
@end
void testConsistencyStruct(StructWrapper *w) {
clang_analyzer_eval(w.inner.value == w.inner.value);
int origValue = w.inner.value;
if (origValue != 42)
return;
clang_analyzer_eval(w.inner.value == 42); }
@interface OpaqueIntWrapper
@property int value;
@end
void testOpaqueConsistency(OpaqueIntWrapper *w) {
clang_analyzer_eval(w.value == w.value); }
#if !__has_feature(objc_arc)
@interface RetainCountTesting
@property (strong) id ownedProp;
@property (unsafe_unretained) id unownedProp;
@property (nonatomic, strong) id manualProp;
@property (readonly) id readonlyProp;
@property (nonatomic, readwrite/*, assign */) id implicitManualProp; @property (nonatomic, readwrite/*, assign */) id implicitSynthProp; @property CFTypeRef cfProp;
@end
@implementation RetainCountTesting {
id _ivarOnly;
}
- (id)manualProp {
return _manualProp;
}
- (void)setImplicitManualProp:(id)newValue {}
- (void)testOverreleaseOwnedIvar {
[_ownedProp retain];
[_ownedProp release];
[_ownedProp release];
[_ownedProp release]; }
- (void)testOverreleaseUnownedIvar {
[_unownedProp retain];
[_unownedProp release];
[_unownedProp release]; }
- (void)testOverreleaseIvarOnly {
[_ivarOnly retain];
[_ivarOnly release];
[_ivarOnly release];
[_ivarOnly release]; }
- (void)testOverreleaseReadonlyIvar {
[_readonlyProp retain];
[_readonlyProp release];
[_readonlyProp release];
[_readonlyProp release]; }
- (void)testOverreleaseImplicitManualIvar {
[_implicitManualProp retain];
[_implicitManualProp release];
[_implicitManualProp release];
[_implicitManualProp release]; }
- (void)testOverreleaseImplicitSynthIvar {
[_implicitSynthProp retain];
[_implicitSynthProp release];
[_implicitSynthProp release]; }
- (void)testOverreleaseCF {
CFRetain(_cfProp);
CFRelease(_cfProp);
CFRelease(_cfProp);
CFRelease(_cfProp); }
- (void)testOverreleaseOwnedIvarUse {
[_ownedProp retain];
[_ownedProp release];
[_ownedProp release];
[_ownedProp myMethod]; }
- (void)testOverreleaseIvarOnlyUse {
[_ivarOnly retain];
[_ivarOnly release];
[_ivarOnly release];
[_ivarOnly myMethod]; }
- (void)testOverreleaseCFUse {
CFRetain(_cfProp);
CFRelease(_cfProp);
CFRelease(_cfProp);
extern void CFUse(CFTypeRef);
CFUse(_cfProp); }
- (void)testOverreleaseOwnedIvarAutoreleaseOkay {
[_ownedProp retain];
[_ownedProp release];
[_ownedProp autorelease];
}
- (void)testOverreleaseIvarOnlyAutoreleaseOkay {
[_ivarOnly retain];
[_ivarOnly release];
[_ivarOnly autorelease];
}
- (void)testOverreleaseOwnedIvarAutorelease {
[_ownedProp retain];
[_ownedProp release];
[_ownedProp autorelease];
[_ownedProp autorelease];
}
- (void)testOverreleaseIvarOnlyAutorelease {
[_ivarOnly retain];
[_ivarOnly release];
[_ivarOnly autorelease];
[_ivarOnly autorelease];
}
- (void)testPropertyAccessThenReleaseOwned {
id owned = [self.ownedProp retain];
[owned release];
[_ownedProp release];
clang_analyzer_eval(owned == _ownedProp); }
- (void)testPropertyAccessThenReleaseOwned2 {
id fromIvar = _ownedProp;
id owned = [self.ownedProp retain];
[owned release];
[fromIvar release];
clang_analyzer_eval(owned == fromIvar); }
- (void)testPropertyAccessThenReleaseUnowned {
id unowned = [self.unownedProp retain];
[unowned release];
[_unownedProp release]; }
- (void)testPropertyAccessThenReleaseUnowned2 {
id fromIvar = _unownedProp;
id unowned = [self.unownedProp retain];
[unowned release];
clang_analyzer_eval(unowned == fromIvar); [fromIvar release]; }
- (void)testPropertyAccessThenReleaseManual {
id prop = [self.manualProp retain];
[prop release];
[_manualProp release]; }
- (void)testPropertyAccessThenReleaseManual2 {
id fromIvar = _manualProp;
id prop = [self.manualProp retain];
[prop release];
clang_analyzer_eval(prop == fromIvar); [fromIvar release]; }
- (void)testPropertyAccessThenReleaseCF {
CFTypeRef owned = CFRetain(self.cfProp);
CFRelease(owned);
CFRelease(_cfProp); clang_analyzer_eval(owned == _cfProp); }
- (void)testPropertyAccessThenReleaseCF2 {
CFTypeRef fromIvar = _cfProp;
CFTypeRef owned = CFRetain(self.cfProp);
CFRelease(owned);
CFRelease(fromIvar);
clang_analyzer_eval(owned == fromIvar); }
- (void)testPropertyAccessThenReleaseReadonly {
id prop = [self.readonlyProp retain];
[prop release];
[_readonlyProp release]; }
- (void)testPropertyAccessThenReleaseReadonly2 {
id fromIvar = _readonlyProp;
id prop = [self.readonlyProp retain];
[prop release];
clang_analyzer_eval(prop == fromIvar); [fromIvar release]; }
- (void)testPropertyAccessThenReleaseImplicitManual {
id prop = [self.implicitManualProp retain];
[prop release];
[_implicitManualProp release]; }
- (void)testPropertyAccessThenReleaseImplicitManual2 {
id fromIvar = _implicitManualProp;
id prop = [self.implicitManualProp retain];
[prop release];
clang_analyzer_eval(prop == fromIvar); [fromIvar release]; }
- (void)testPropertyAccessThenReleaseImplicitSynth {
id prop = [self.implicitSynthProp retain];
[prop release];
[_implicitSynthProp release]; }
- (void)testPropertyAccessThenReleaseImplicitSynth2 {
id fromIvar = _implicitSynthProp;
id prop = [self.implicitSynthProp retain];
[prop release];
clang_analyzer_eval(prop == fromIvar); [fromIvar release]; }
- (id)getUnownedFromProperty {
[_ownedProp retain];
[_ownedProp autorelease];
return _ownedProp; }
- (id)transferUnownedFromProperty {
[_ownedProp retain];
[_ownedProp autorelease];
return [_ownedProp autorelease]; }
- (id)transferOwnedFromProperty __attribute__((ns_returns_retained)) {
[_ownedProp retain];
[_ownedProp autorelease];
return _ownedProp; }
- (void)testAssignOwned:(id)newValue {
_ownedProp = newValue;
[_ownedProp release]; }
- (void)testAssignUnowned:(id)newValue {
_unownedProp = newValue;
[_unownedProp release]; }
- (void)testAssignIvarOnly:(id)newValue {
_ivarOnly = newValue;
[_ivarOnly release]; }
- (void)testAssignCF:(CFTypeRef)newValue {
_cfProp = newValue;
CFRelease(_cfProp); }
- (void)testAssignReadonly:(id)newValue {
_readonlyProp = newValue;
[_readonlyProp release]; }
- (void)testAssignImplicitManual:(id)newValue {
_implicitManualProp = newValue;
[_implicitManualProp release]; }
- (void)testAssignImplicitSynth:(id)newValue {
_implicitSynthProp = newValue;
[_implicitSynthProp release]; }
- (void)testAssignOwnedOkay:(id)newValue {
_ownedProp = [newValue retain];
[_ownedProp release]; }
- (void)testAssignUnownedOkay:(id)newValue {
_unownedProp = [newValue retain];
[_unownedProp release]; }
- (void)testAssignIvarOnlyOkay:(id)newValue {
_ivarOnly = [newValue retain];
[_ivarOnly release]; }
- (void)testAssignCFOkay:(CFTypeRef)newValue {
_cfProp = CFRetain(newValue);
CFRelease(_cfProp); }
- (void)testAssignReadonlyOkay:(id)newValue {
_readonlyProp = [newValue retain];
[_readonlyProp release]; }
- (void)testAssignImplicitManualOkay:(id)newValue {
_implicitManualProp = [newValue retain];
[_implicitManualProp release]; }
- (void)testAssignImplicitSynthOkay:(id)newValue {
_implicitSynthProp = [newValue retain];
[_implicitSynthProp release]; }
- (void)establishIvarIsNilDuringLoops {
extern id getRandomObject(void);
int i = 4; while (--i) {
id x = 0;
if (getRandomObject())
x = _ivarOnly;
if (!x)
x = getRandomObject();
[x myMethod];
}
}
- (void)retainIvarAndInvalidateSelf {
extern void invalidate(id);
[_unownedProp retain];
invalidate(self);
[_unownedProp release]; }
@end
@interface Wrapper
@property(nonatomic, readonly) int value;
@end
@implementation Wrapper
@synthesize value;
@end
void testNoCrashWhenAccessPropertyAndThereAreNoDirectBindingsAtAll(void) {
union {
Wrapper *wrapper;
} u = { 0 };
[u.wrapper value];
}
#endif
@interface ExplicitAccessorInCategory : NSObject
@property(readonly) int normal;
- (int)normal;
@property(readonly) int no_custom_accessor;
@end
@interface ExplicitAccessorInCategory ()
@property(readonly) int in_category;
@property(readonly) int still_no_custom_accessor;
- (int)still_no_custom_accessor;
@end
@interface ExplicitAccessorInCategory ()
- (int)in_category;
- (int)no_custom_accessor;
@end
@implementation ExplicitAccessorInCategory
- (void)foo {
clang_analyzer_eval(self.normal == self.normal); clang_analyzer_eval(self.in_category == self.in_category);
clang_analyzer_eval(self.no_custom_accessor == self.no_custom_accessor); clang_analyzer_eval(self.still_no_custom_accessor == self.still_no_custom_accessor); }
@end
@interface Shadowed
@property (assign) NSObject *o;
- (NSObject *)getShadowedIvar;
- (void)clearShadowedIvar;
- (NSObject *)getShadowedProp;
- (void)clearShadowedProp;
@property (assign) NSObject *o2;
@end
@implementation Shadowed
- (NSObject *)getShadowedIvar {
return self->_o;
}
- (void)clearShadowedIvar {
self->_o = nil;
}
- (NSObject *)getShadowedProp {
return self.o;
}
- (void)clearShadowedProp {
self.o = nil;
}
@end
@interface Shadowing : Shadowed
@end
@implementation Shadowing
@synthesize o;
-(void)testPropertyShadowing {
NSObject *oo = self.o; clang_analyzer_eval(self.o == oo); clang_analyzer_eval([self getShadowedIvar] == oo); [self clearShadowedIvar];
clang_analyzer_eval(self.o == oo); clang_analyzer_eval([self getShadowedIvar] == oo); clang_analyzer_eval([self getShadowedIvar] == nil); }
@synthesize o2 = ooo2;
-(void)testPropertyShadowingWithExplicitIvar {
NSObject *oo2 = self.o2; }
@end