Summary: This diff adds an additional parameter of struct return type in ObjC's methods. The additional parameter had been supported only in C/C++ functions/methods for 5 years (D2865091 (ec80d40bdd
)). If there is no specific reason not to do that, let's do it and fix the incorrect frontend translations.
Reviewed By: jvillard
Differential Revision: D26049748
fbshipit-source-id: 414b3011f
master
parent
32846974eb
commit
f3a29d1c9c
@ -1 +1,2 @@
|
||||
codetoanalyze/objc/bufferoverrun/block.m, Block.block_in_field_Bad, 7, BUFFER_OVERRUN_L1, no_bucket, ERROR, [<Offset trace>,Call,Assignment,<Length trace>,Array declaration,Array access: Offset: 15 Size: 10]
|
||||
codetoanalyze/objc/bufferoverrun/return_struct.m, ReturnStruct.call_get_struct_Bad, 3, BUFFER_OVERRUN_L1, no_bucket, ERROR, [<Offset trace>,Call,Parameter `n`,Assignment,Assignment,<Length trace>,Array declaration,Array access: Offset: 5 Size: 3]
|
||||
|
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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>
|
||||
|
||||
struct s {
|
||||
int a;
|
||||
};
|
||||
|
||||
@interface ReturnStruct : NSObject
|
||||
@end
|
||||
|
||||
@implementation ReturnStruct
|
||||
|
||||
- (struct s)get_struct:(int)n {
|
||||
struct s x;
|
||||
x.a = n;
|
||||
return x;
|
||||
}
|
||||
|
||||
- (void)call_get_struct_Ok {
|
||||
int arr[5];
|
||||
struct s x = [self get_struct:3];
|
||||
arr[x.a] = 0;
|
||||
}
|
||||
|
||||
- (void)call_get_struct_Bad {
|
||||
int arr[3];
|
||||
struct s x = [self get_struct:5];
|
||||
arr[x.a] = 0;
|
||||
}
|
||||
|
||||
@end
|
Loading…
Reference in new issue