Summary: This diff increases autoreleasepool size when * caller is non-ARC-compiled * callee is ARC-compiled * return type is a pointer to objc object To distinguish non-ARC-/ARC-compiled: * extended `translation_unit_decl_info` to have a boolean field `is_objc_arc_on` * then copied it to `ProcAttributes.t` for each procedures. Reviewed By: ezgicicek Differential Revision: D23565003 fbshipit-source-id: dee22ea82master
parent
e1806cbbb2
commit
76ad9915a1
@ -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 <Foundation/Foundation.h>
|
||||
|
||||
@interface ArcCallee : NSObject
|
||||
|
||||
+ (ArcCallee*)allocObject;
|
||||
|
||||
+ (ArcCallee*)newObject;
|
||||
|
||||
+ (ArcCallee*)copyObject:(ArcCallee*)obj;
|
||||
|
||||
+ (ArcCallee*)mutableCopyObject:(ArcCallee*)obj;
|
||||
|
||||
+ (ArcCallee*)giveMeObject;
|
||||
|
||||
+ (int)giveMeInt;
|
||||
|
||||
@end
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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 <Foundation/Foundation.h>
|
||||
#import "arc_callee.h"
|
||||
|
||||
@implementation ArcCallee
|
||||
|
||||
+ (ArcCallee*)allocObject {
|
||||
return [ArcCallee alloc];
|
||||
}
|
||||
|
||||
+ (ArcCallee*)newObject {
|
||||
return [ArcCallee new];
|
||||
}
|
||||
|
||||
/* Since the checker cares about calling `autorelease` only, we define the
|
||||
following functions as returning a new object simply. */
|
||||
|
||||
+ (ArcCallee*)copyObject:(ArcCallee*)obj {
|
||||
return [ArcCallee new];
|
||||
}
|
||||
|
||||
+ (ArcCallee*)mutableCopyObject:(ArcCallee*)obj {
|
||||
return [ArcCallee new];
|
||||
}
|
||||
|
||||
+ (ArcCallee*)giveMeObject {
|
||||
return [ArcCallee new];
|
||||
}
|
||||
|
||||
+ (int)giveMeInt {
|
||||
return 100;
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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 <Foundation/Foundation.h>
|
||||
#import "arc_callee.h"
|
||||
|
||||
@interface NoArcCaller : NSObject
|
||||
@end
|
||||
|
||||
@implementation NoArcCaller
|
||||
|
||||
- (void)callAllocObject_zero_FP:(int)n {
|
||||
for (int i = 0; i < n; i++) {
|
||||
ArcCallee* obj = [ArcCallee allocObject];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)callNewObject_zero_FP:(int)n {
|
||||
for (int i = 0; i < n; i++) {
|
||||
ArcCallee* obj = [ArcCallee newObject];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)callCopyObject_zero_FP:(int)n x:(ArcCallee*)x {
|
||||
for (int i = 0; i < n; i++) {
|
||||
ArcCallee* obj = [ArcCallee copyObject:x];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)callMutableCopyObject_zero_FP:(int)n x:(ArcCallee*)x {
|
||||
for (int i = 0; i < n; i++) {
|
||||
ArcCallee* obj = [ArcCallee mutableCopyObject:x];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)callGiveMeObject_linear:(int)n {
|
||||
for (int i = 0; i < n; i++) {
|
||||
ArcCallee* obj = [ArcCallee giveMeObject];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)callGiveMeObject_autoreleasepool_zero:(int)n {
|
||||
for (int i = 0; i < n; i++) {
|
||||
@autoreleasepool {
|
||||
ArcCallee* obj = [ArcCallee giveMeObject];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)callGiveMeInt_zero {
|
||||
int i = [ArcCallee giveMeInt];
|
||||
}
|
||||
|
||||
@end
|
Loading…
Reference in new issue