Reviewed By: jvillard Differential Revision: D10401459 fbshipit-source-id: a0495426emaster
parent
fb4086c6f6
commit
0d4b88ae29
@ -0,0 +1,17 @@
|
||||
# Copyright (c) 2017-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.
|
||||
|
||||
TESTS_DIR = ../../..
|
||||
|
||||
CLANG_OPTIONS = -c $(OBJCPP_CLANG_OPTIONS) -fobjc-arc
|
||||
INFER_OPTIONS = --debug-exceptions --project-root $(TESTS_DIR)
|
||||
INFERPRINT_OPTIONS = --issues-tests
|
||||
|
||||
SOURCES = $(wildcard *.mm)
|
||||
|
||||
include $(TESTS_DIR)/clang.make
|
||||
include $(TESTS_DIR)/objc.make
|
||||
|
||||
infer-out/report.json: $(MAKEFILE_LIST)
|
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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
|
||||
@end
|
||||
|
||||
struct WeakHolder {
|
||||
NSObject* ref;
|
||||
__weak NSObject* weakRef;
|
||||
};
|
||||
|
||||
@implementation A {
|
||||
WeakHolder* _weakHolder;
|
||||
}
|
||||
|
||||
- (instancetype)aFnGood {
|
||||
_weakHolder = new WeakHolder();
|
||||
_weakHolder->weakRef = self;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)aFnBad {
|
||||
_weakHolder = new WeakHolder();
|
||||
_weakHolder->ref = self;
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1 @@
|
||||
codetoanalyze/objcpp/retain-cycles/ObjCPPStruct.mm, A_aFnBad, 2, RETAIN_CYCLE, no_bucket, ERROR, [start of procedure aFnBad,start of procedure WeakHolder,return from a call to WeakHolder_WeakHolder]
|
Loading…
Reference in new issue