[objc] add test for strong/weak self references

Reviewed By: jeremydubreil

Differential Revision: D12900490

fbshipit-source-id: 8707dc049
master
Martin Trojer 6 years ago committed by Facebook Github Bot
parent 165cb1cf73
commit 0d4a0ba35c

@ -11,10 +11,14 @@
@interface TimeSpent () {
AnalyticsTimeSpent* _timeSpent;
}
@property(weak) TimeSpent* weakSelfRef;
@property(strong) TimeSpent* strongSelfRef;
@end
@implementation TimeSpent {
ListAdapter* _listAdapter;
TimeSpent* _strongSelfRef2;
}
- (instancetype)init {
@ -29,6 +33,20 @@
return self;
}
- (instancetype)init_bad_ref {
if (self = [super init]) {
_weakSelfRef = self;
_strongSelfRef = self;
}
}
- (instancetype)init_bad_ref2 {
if (self = [super init]) {
_weakSelfRef = self;
_strongSelfRef2 = self;
}
}
- (instancetype)init_bad {
if (self = [super init]) {
_listAdapter.dataSourceStrong = self;

@ -1,2 +1,4 @@
build_systems/codetoanalyze/objc_retain_cycles_weak/TimeSpent.m, TimeSpent_init_bad, 2, RETAIN_CYCLE, no_bucket, ERROR, [start of procedure init_bad,Taking true branch,start of procedure setDataSourceStrong:,return from a call to ListAdapter_setDataSourceStrong:]
build_systems/codetoanalyze/objc_retain_cycles_weak/TimeSpent.m, TimeSpent_init_bad_ref, 3, RETAIN_CYCLE, no_bucket, ERROR, [start of procedure init_bad_ref,Taking true branch]
build_systems/codetoanalyze/objc_retain_cycles_weak/TimeSpent.m, TimeSpent_init_bad_ref2, 3, RETAIN_CYCLE, no_bucket, ERROR, [start of procedure init_bad_ref2,Taking true branch]
build_systems/codetoanalyze/objc_retain_cycles_weak/TimeSpent.m, retain_cycle_weak_bad, 4, RETAIN_CYCLE, no_bucket, ERROR, [start of procedure retain_cycle_weak_bad(),start of procedure init,start of procedure initWithDelegate:,Executing synthesized setter setDelegate:,return from a call to AnalyticsTimeSpent_initWithDelegate:,return from a call to TimeSpent_init,start of procedure initWithStrongDelegate:,return from a call to AnalyticsTimeSpent_initWithStrongDelegate:,start of procedure setAnalyticsTimeSpent:,return from a call to TimeSpent_setAnalyticsTimeSpent:]

Loading…
Cancel
Save