Summary: In ObjC there are no access modifiers. The strongest alternative is to put methods in the implementation but omit them from the interface declaration. Put exported ObjC methods in their own field in the class structure and use that in RacerD to decide whether to report on the method. Reviewed By: mbouaziz Differential Revision: D13597504 fbshipit-source-id: c4a3d2705master
parent
98cd2e59da
commit
7bbb7fc869
@ -0,0 +1,13 @@
|
||||
/*
|
||||
* 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 Private : NSObject
|
||||
- (void)write_ok:(int)data;
|
||||
- (int)read_other_bad;
|
||||
- (void)write_other_bad:(int)other_data;
|
||||
@end
|
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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 <mutex>
|
||||
#import "Private.h"
|
||||
|
||||
@implementation Private {
|
||||
std::mutex _mutex;
|
||||
int _data;
|
||||
int _other_data;
|
||||
}
|
||||
|
||||
// no report on _data
|
||||
- (int)_private_read_ok {
|
||||
return _data;
|
||||
}
|
||||
|
||||
- (void)write_ok:(int)data {
|
||||
_mutex.lock();
|
||||
_data = data;
|
||||
_mutex.unlock();
|
||||
}
|
||||
|
||||
- (int)read_other_bad {
|
||||
return _other_data;
|
||||
}
|
||||
|
||||
- (void)write_other_bad:(int)other_data {
|
||||
_mutex.lock();
|
||||
_other_data = other_data;
|
||||
_mutex.unlock();
|
||||
}
|
||||
@end
|
@ -1 +1,2 @@
|
||||
codetoanalyze/objcpp/racerd/Basic.mm, Basic_read, 22, LOCK_CONSISTENCY_VIOLATION, no_bucket, ERROR, [<Read trace>,access to `self.data_`,<Write trace>,call to Basic__private_write_no_top_level_report:,access to `self.data_`]
|
||||
codetoanalyze/objcpp/racerd/Basic.mm, Basic_read_bad, 21, LOCK_CONSISTENCY_VIOLATION, no_bucket, ERROR, [<Read trace>,access to `self._data`,<Write trace>,access to `self._data`]
|
||||
codetoanalyze/objcpp/racerd/Private.mm, Private_read_other_bad, 28, LOCK_CONSISTENCY_VIOLATION, no_bucket, ERROR, [<Read trace>,access to `self._other_data`,<Write trace>,access to `self._other_data`]
|
||||
|
Loading…
Reference in new issue