Reviewed By: jvillard Differential Revision: D9116721 fbshipit-source-id: 8d6f4a98dmaster
parent
9eca72d405
commit
562f9d1c7c
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
@interface A : NSObject
|
||||
@property int val;
|
||||
@end
|
||||
|
||||
bool myrand();
|
||||
|
||||
@implementation A
|
||||
- (instancetype)myDoO:(id)o {
|
||||
return self;
|
||||
}
|
||||
+ (instancetype)initWithVal:(int)v {
|
||||
A* a = [A alloc];
|
||||
a.val = v;
|
||||
return a;
|
||||
}
|
||||
+ (instancetype)nestedGood {
|
||||
const BOOL isB = myrand();
|
||||
return [[[A initWithVal:isB ? 0 : 1] myDoO:[NSObject class]]
|
||||
myDoO:[NSObject class]];
|
||||
}
|
||||
|
||||
+ (instancetype)nestedBad {
|
||||
const BOOL isB = myrand();
|
||||
return [[[A initWithVal:42] myDoO:[NSObject class]] myDoO:[NSObject class]];
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1 @@
|
||||
codetoanalyze/objc/liveness/NestedClassCalls.m, A_nestedBad, 1, DEAD_STORE, no_bucket, ERROR, [Write of unused value]
|
Loading…
Reference in new issue