Reviewed By: martinoluca Differential Revision: D4455886 fbshipit-source-id: 58d4d96master
parent
d84a6b854f
commit
269ea5ffe5
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (c) 2017 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface Unavailable_api_allowed_cases : NSObject
|
||||
|
||||
- (void)m NS_AVAILABLE(10_12, 10_0);
|
||||
|
||||
- (void)n NS_AVAILABLE(10_12, 10_0);
|
||||
|
||||
@end
|
||||
|
||||
@implementation Unavailable_api_allowed_cases
|
||||
|
||||
- (void)m {
|
||||
}
|
||||
|
||||
- (void)n {
|
||||
}
|
||||
|
||||
// no bug
|
||||
- (void)with_responds_to_selector:(Unavailable_api_allowed_cases*)a {
|
||||
if ([a respondsToSelector:@selector(m)]) {
|
||||
int x = 1;
|
||||
[a m];
|
||||
x = 3;
|
||||
}
|
||||
}
|
||||
// no bug
|
||||
- (void)with_responds_to_selector:(Unavailable_api_allowed_cases*)a
|
||||
and:(BOOL)ok {
|
||||
if ([a respondsToSelector:@selector(m)] && ok) {
|
||||
[a m];
|
||||
}
|
||||
}
|
||||
|
||||
// bug
|
||||
- (void)without_responds_to_selector:(Unavailable_api_allowed_cases*)a {
|
||||
[a m];
|
||||
}
|
||||
|
||||
// bug
|
||||
- (void)with_responds_to_selector_in_else:(Unavailable_api_allowed_cases*)a {
|
||||
if ([a respondsToSelector:@selector(m)]) {
|
||||
} else {
|
||||
[a m];
|
||||
}
|
||||
}
|
||||
|
||||
// no bug
|
||||
- (void)with_responds_to_selector_nested_if:(Unavailable_api_allowed_cases*)a {
|
||||
if ([a respondsToSelector:@selector(m)]) {
|
||||
if ([a respondsToSelector:@selector(n)]) {
|
||||
[a m];
|
||||
[a n];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// no bug
|
||||
- (void)with_responds_to_selector_two_selectors:
|
||||
(Unavailable_api_allowed_cases*)a {
|
||||
if ([a respondsToSelector:@selector(m)] &&
|
||||
[a respondsToSelector:@selector(n)]) {
|
||||
[a m];
|
||||
[a n];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
@ -1,2 +1,4 @@
|
||||
codetoanalyze/objc/ioslinters/unavailable_api_allowed_cases.m, Unavailable_api_allowed_cases_with_responds_to_selector_in_else:, 52, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, []
|
||||
codetoanalyze/objc/ioslinters/unavailable_api_allowed_cases.m, Unavailable_api_allowed_cases_without_responds_to_selector:, 45, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, []
|
||||
codetoanalyze/objc/ioslinters/unavailable_api_in_supported_ios_sdk.m, OpenURLOptionsFromSourceApplication, 18, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, []
|
||||
codetoanalyze/objc/ioslinters/unavailable_api_in_supported_ios_sdk.m, Unavailable_api_in_supported_ios_sdk_test:and:, 11, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, []
|
||||
|
Loading…
Reference in new issue