diff --git a/infer/tests/codetoanalyze/objc/autoreleasepool/Makefile b/infer/tests/codetoanalyze/objc/autoreleasepool/Makefile index 0c7c19cbf..d57b2a6c5 100644 --- a/infer/tests/codetoanalyze/objc/autoreleasepool/Makefile +++ b/infer/tests/codetoanalyze/objc/autoreleasepool/Makefile @@ -6,7 +6,8 @@ TESTS_DIR = ../../.. CLANG_OPTIONS = -c $(OBJC_CLANG_OPTIONS) -INFER_OPTIONS = --cost-only --debug-exceptions --project-root $(TESTS_DIR) +INFER_OPTIONS = --cost-only --debug-exceptions --project-root $(TESTS_DIR) \ + --report-force-relative-path --xcode-isysroot-suffix $(XCODE_ISYSROOT_SUFFIX) INFERPRINT_OPTIONS = --issues-tests INFERPRINT_COST_OPTIONS = --cost-tests-only-autoreleasepool --cost-issues-tests diff --git a/infer/tests/codetoanalyze/objc/autoreleasepool/arc_block.m b/infer/tests/codetoanalyze/objc/autoreleasepool/arc_block.m new file mode 100644 index 000000000..3079924b0 --- /dev/null +++ b/infer/tests/codetoanalyze/objc/autoreleasepool/arc_block.m @@ -0,0 +1,23 @@ +/* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +#import +#import "no_arc_callee.h" + +@interface ArcBlock : NSObject +@end + +@implementation ArcBlock + ++ (void)callIndexOfObjectPassingTest_linear_FN:(NSArray*)x { + int i = [x indexOfObjectPassingTest:^BOOL( + NSObject* obj, NSUInteger idx, BOOL* stop) { + NoArcCallee* o = [NoArcCallee giveMeObject]; + return false; + }]; +} + +@end diff --git a/infer/tests/codetoanalyze/objc/autoreleasepool/cost-issues.exp b/infer/tests/codetoanalyze/objc/autoreleasepool/cost-issues.exp index 05f3d5dba..b822ae1d9 100644 --- a/infer/tests/codetoanalyze/objc/autoreleasepool/cost-issues.exp +++ b/infer/tests/codetoanalyze/objc/autoreleasepool/cost-issues.exp @@ -1,3 +1,7 @@ +${XCODE_ISYSROOT}/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h, NSArray.indexOfObjectPassingTest:[objc_blockArcBlock.callIndexOfObjectPassingTest_linear_FN:_1], 0, OnUIThread:false, [] +codetoanalyze/objc/autoreleasepool/arc_block.m, ArcBlock.callIndexOfObjectPassingTest_linear_FN:, 0, OnUIThread:false, [] +codetoanalyze/objc/autoreleasepool/arc_block.m, ArcBlock.dealloc, 0, OnUIThread:false, [] +codetoanalyze/objc/autoreleasepool/arc_block.m, objc_blockArcBlock.callIndexOfObjectPassingTest_linear_FN:_1, 1, OnUIThread:false, [autorelease,Call to NoArcCallee.giveMeObject,Modeled call to autorelease] codetoanalyze/objc/autoreleasepool/arc_caller.m, ArcCaller.callAllocObject_zero:, 0, OnUIThread:false, [] codetoanalyze/objc/autoreleasepool/arc_caller.m, ArcCaller.callCopyObject_zero:x:, 0, OnUIThread:false, [] codetoanalyze/objc/autoreleasepool/arc_caller.m, ArcCaller.callGiveMeObject_autoreleasepool_zero:, 0, OnUIThread:false, []