diff --git a/infer/src/clang/cPredicates.ml b/infer/src/clang/cPredicates.ml index 0163038aa..5cd370c7e 100644 --- a/infer/src/clang/cPredicates.ml +++ b/infer/src/clang/cPredicates.ml @@ -20,12 +20,12 @@ let get_available_attr_ios_sdk an = let rec get_available_attr attrs = match attrs with | [] -> None - | AvailabilityAttr attr_info :: _ -> + | AvailabilityAttr attr_info :: rest -> (match attr_info.ai_parameters with | "ios" :: version :: _ -> Some (String.Search_pattern.replace_all (String.Search_pattern.create "_") ~in_:version ~with_:".") - | _ -> None) + | _ -> get_available_attr rest) | _ :: rest -> get_available_attr rest in match an with | Ctl_parser_types.Decl decl -> diff --git a/infer/tests/codetoanalyze/objc/ioslints/issues.exp b/infer/tests/codetoanalyze/objc/ioslints/issues.exp index 2f4907f14..215a9652f 100644 --- a/infer/tests/codetoanalyze/objc/ioslints/issues.exp +++ b/infer/tests/codetoanalyze/objc/ioslints/issues.exp @@ -5,3 +5,4 @@ codetoanalyze/objc/ioslints/unavailable_api_allowed_cases.m, Unavailable_api_all codetoanalyze/objc/ioslints/unavailable_api_allowed_cases.m, Unavailable_api_allowed_cases_without_responds_to_selector:, 64, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, [] codetoanalyze/objc/ioslints/unavailable_api_in_supported_ios_sdk.m, OpenURLOptionsFromSourceApplication, 26, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, [] codetoanalyze/objc/ioslints/unavailable_api_in_supported_ios_sdk.m, Unavailable_api_in_supported_ios_sdk_test:and:, 19, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, [] +codetoanalyze/objc/ioslints/unavailable_property_ios.m, FNFPlayerLayer_initWithConfigs:, 22, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, [] diff --git a/infer/tests/codetoanalyze/objc/ioslints/unavailable_property_ios.m b/infer/tests/codetoanalyze/objc/ioslints/unavailable_property_ios.m new file mode 100644 index 000000000..44a72cf6f --- /dev/null +++ b/infer/tests/codetoanalyze/objc/ioslints/unavailable_property_ios.m @@ -0,0 +1,26 @@ +/* + * 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 + +@interface FNFPlayerLayer : CAEAGLLayer + +- (instancetype)initWithConfigs:(FNFPlayerLayer*)configs; + +@end + +@implementation FNFPlayerLayer { + BOOL my_field; +} + +- (instancetype)initWithConfigs:(FNFPlayerLayer*)configs { + my_field = configs.presentsWithTransaction; + return self; +} + +@end