[linters] Take the attributed types into account when finding pointer types

Reviewed By: martinoluca

Differential Revision: D4010004

fbshipit-source-id: aa70894
master
Dulma Churchill 8 years ago committed by Facebook Github Bot
parent 3624fea737
commit 98afe25b54

@ -105,13 +105,14 @@ let is_assign_property decl =
| _ -> false
let is_property_pointer_type decl =
let open Clang_ast_t in
match decl with
| Clang_ast_t.ObjCPropertyDecl (_, _, pdi) ->
let type_ptr = pdi.opdi_type_ptr in
let raw_ptr = Clang_ast_types.type_ptr_to_clang_pointer type_ptr in
(match Clang_ast_main.PointerMap.find raw_ptr !CFrontend_config.pointer_type_index with
| MemberPointerType _ | ObjCObjectPointerType _ | BlockPointerType _ -> true
| TypedefType (_, tti) ->
| ObjCPropertyDecl (_, _, pdi) ->
(match Ast_utils.get_desugared_type pdi.opdi_type_ptr with
| Some MemberPointerType _
| Some ObjCObjectPointerType _
| Some BlockPointerType _ -> true
| Some TypedefType (_, tti) ->
(Ast_utils.name_of_typedef_type_info tti) = CFrontend_config.id_cl
| exception Not_found -> false
| _ -> false)

@ -35,4 +35,6 @@ struct MyStruct {
@property(assign) struct MyStruct* shouldNotReport7;
@property(nonatomic, assign, nullable) NSNumber* shouldReport8;
@end

@ -1,6 +1,7 @@
assign_pointer.m, Linters_dummy_method, 18, ASSIGN_POINTER_WARNING
assign_pointer.m, Linters_dummy_method, 20, ASSIGN_POINTER_WARNING
assign_pointer.m, Linters_dummy_method, 22, ASSIGN_POINTER_WARNING
assign_pointer.m, Linters_dummy_method, 38, ASSIGN_POINTER_WARNING
atomic_prop.m, A_bla, 98, DIRECT_ATOMIC_PROPERTY_ACCESS
atomic_prop.m, A_bla, 99, DIRECT_ATOMIC_PROPERTY_ACCESS
atomic_prop.m, A_readP, 77, DIRECT_ATOMIC_PROPERTY_ACCESS

Loading…
Cancel
Save