From 6d5bc2b1f858fb64b08ae753e29caffbc3640e99 Mon Sep 17 00:00:00 2001 From: Dulma Churchill Date: Thu, 10 Oct 2024 03:36:10 -0700 Subject: [PATCH] [clang] Add function prototype to Objective-C blocks Summary: We were passing `attr_info` too much incorrectly. Now only passing it in the few places where it's needed to go from AttributedType to BlockPointerType. Now also passing ?from_block to only translate the function prototype for blocks and not for other function pointers, since that's not required at the moment. Translating the function prototype of blocks including its annotations helped handle correctly the example from the test in the parameter not null checked checker. Reviewed By: ngorogiannis Differential Revision: D64107506 fbshipit-source-id: 6980396bb01db7ac6bc70fadcae9de161e9fbe1e --- infer/src/clang/cType_to_sil_type.ml | 69 +++++++++++-------- infer/src/clang/cType_to_sil_type.mli | 1 + .../objc/frontend/block/retain_cycle.m.dot | 6 +- ...specialized_method_with_block_params.m.dot | 16 ++--- .../Blocks_as_parameters.m | 2 +- .../parameter-not-null-checked/issues.exp | 1 - .../annotations/nonnull_annotations.m.dot | 8 +-- .../objc/shared/block/BlockVar.m.dot | 30 ++++---- .../objc/shared/block/block-it.m.dot | 8 +-- .../objc/shared/block/block.m.dot | 16 ++--- .../objc/shared/block/block_release.m.dot | 6 +- .../npe/Nonnull_attribute_example.m.dot | 4 +- 12 files changed, 90 insertions(+), 77 deletions(-) diff --git a/infer/src/clang/cType_to_sil_type.ml b/infer/src/clang/cType_to_sil_type.ml index 20b2608946c..d20df0a3d1d 100644 --- a/infer/src/clang/cType_to_sil_type.ml +++ b/infer/src/clang/cType_to_sil_type.ml @@ -132,29 +132,29 @@ let add_protocols_to_desc tenv desc protocol_desc_list = if List.is_empty protocol_desc_list then desc else add_nonempty_protocol desc -let rec build_array_type ?attr_info translate_decl tenv (qual_type : Clang_ast_t.qual_type) - length_opt stride_opt = - let array_type = qual_type_to_sil_type ?attr_info translate_decl tenv qual_type in +let rec build_array_type translate_decl tenv (qual_type : Clang_ast_t.qual_type) length_opt + stride_opt = + let array_type = qual_type_to_sil_type translate_decl tenv qual_type in let length = Option.map ~f:IntLit.of_int length_opt in let stride = Option.map ~f:IntLit.of_int stride_opt in Typ.Tarray {elt= array_type; length; stride} -and type_desc_of_attr_type ~attr_info translate_decl tenv type_info = +and type_desc_of_attr_type ~attr_info ?from_block translate_decl tenv type_info = let open Clang_ast_t in match type_info.ti_desugared_type with | Some type_ptr -> ( match CAst_utils.get_type type_ptr with | Some (ObjCObjectPointerType (_, qual_type)) -> - let typ = qual_type_to_sil_type ~attr_info translate_decl tenv qual_type in + let typ = qual_type_to_sil_type ?from_block translate_decl tenv qual_type in Typ.Tptr (typ, pointer_attribute_of_objc_attribute ~attr_info) | _ -> - type_ptr_to_type_desc translate_decl tenv type_ptr ~attr_info ) + type_ptr_to_type_desc ~attr_info translate_decl tenv type_ptr ) | None -> Typ.Tvoid -and type_desc_of_c_type ?attr_info translate_decl tenv c_type : Typ.desc = +and type_desc_of_c_type ?attr_info ?from_block translate_decl tenv c_type : Typ.desc = let open Clang_ast_t in match c_type with | NoneType _ -> @@ -162,7 +162,7 @@ and type_desc_of_c_type ?attr_info translate_decl tenv c_type : Typ.desc = | BuiltinType (_, builtin_type_kind) -> type_desc_of_builtin_type_kind builtin_type_kind | PointerType (_, qual_type) | ObjCObjectPointerType (_, qual_type) -> - let typ = qual_type_to_sil_type ?attr_info translate_decl tenv qual_type in + let typ = qual_type_to_sil_type ?from_block translate_decl tenv qual_type in let desc = typ.Typ.desc in if Typ.equal_desc desc (get_builtin_objc_type `ObjCClass) then desc else Typ.Tptr (typ, Typ.Pk_pointer) @@ -173,51 +173,63 @@ and type_desc_of_c_type ?attr_info translate_decl tenv c_type : Typ.desc = decl_ptr_to_type_desc translate_decl tenv pointer ) in let type_ptr = objc_object_type_info.Clang_ast_t.ooti_base_type in - let desc = type_ptr_to_type_desc ?attr_info translate_decl tenv type_ptr in + let desc = type_ptr_to_type_desc ?from_block translate_decl tenv type_ptr in add_protocols_to_desc tenv desc protocol_desc_list | BlockPointerType (_, qual_type) -> - let typ = qual_type_to_sil_type ?attr_info translate_decl tenv qual_type in + let typ = qual_type_to_sil_type ~from_block:true translate_decl tenv qual_type in Typ.Tptr (typ, block_pointer_attr_of_attr_info attr_info) | IncompleteArrayType (_, {arti_element_type; arti_stride}) | DependentSizedArrayType (_, {arti_element_type; arti_stride}) -> - build_array_type ?attr_info translate_decl tenv arti_element_type None arti_stride + build_array_type translate_decl tenv arti_element_type None arti_stride | VariableArrayType (_, {arti_element_type; arti_stride}, _) -> - build_array_type ?attr_info translate_decl tenv arti_element_type None arti_stride + build_array_type translate_decl tenv arti_element_type None arti_stride | ConstantArrayType (_, {arti_element_type; arti_stride}, n) -> - build_array_type ?attr_info translate_decl tenv arti_element_type (Some n) arti_stride + build_array_type translate_decl tenv arti_element_type (Some n) arti_stride + | FunctionProtoType (_type_info, function_type_info, params_type_info) + when Option.value ~default:false from_block -> + Typ.Tfun + (Some + { Typ.params_type= + List.map + ~f:(fun param_type -> + qual_type_to_sil_type ?from_block translate_decl tenv param_type ) + params_type_info.Clang_ast_t.pti_params_type + ; return_type= + qual_type_to_sil_type ?from_block translate_decl tenv + function_type_info.Clang_ast_t.fti_return_type } ) | FunctionProtoType _ | FunctionNoProtoType _ -> Typ.Tfun None | ParenType (_, qual_type) -> - (qual_type_to_sil_type ?attr_info translate_decl tenv qual_type).Typ.desc + (qual_type_to_sil_type ?attr_info ?from_block translate_decl tenv qual_type).Typ.desc | DecayedType (_, qual_type) -> - (qual_type_to_sil_type ?attr_info translate_decl tenv qual_type).Typ.desc + (qual_type_to_sil_type ?from_block translate_decl tenv qual_type).Typ.desc | RecordType (_, pointer) | EnumType (_, pointer) -> decl_ptr_to_type_desc translate_decl tenv pointer | ElaboratedType type_info -> ( match type_info.Clang_ast_t.ti_desugared_type with (* TODO desugar to qualtype *) | Some type_ptr -> - type_ptr_to_type_desc ?attr_info translate_decl tenv type_ptr + type_ptr_to_type_desc translate_decl tenv type_ptr | None -> Typ.Tvoid ) | ObjCInterfaceType (_, pointer) -> decl_ptr_to_type_desc translate_decl tenv pointer | RValueReferenceType (_, qual_type) -> - let typ = qual_type_to_sil_type ?attr_info translate_decl tenv qual_type in + let typ = qual_type_to_sil_type ?from_block translate_decl tenv qual_type in Typ.Tptr (typ, Typ.Pk_rvalue_reference) | LValueReferenceType (_, qual_type) -> - let typ = qual_type_to_sil_type ?attr_info translate_decl tenv qual_type in + let typ = qual_type_to_sil_type ?from_block translate_decl tenv qual_type in Typ.Tptr (typ, Typ.Pk_lvalue_reference) | AttributedType (type_info, attr_info) -> (* TODO desugar to qualtyp *) - type_desc_of_attr_type ~attr_info translate_decl tenv type_info + type_desc_of_attr_type ~attr_info ?from_block translate_decl tenv type_info | _ -> ( (* TypedefType, etc *) let type_info = Clang_ast_proj.get_type_tuple c_type in match type_info.Clang_ast_t.ti_desugared_type with (* TODO desugar typedeftype to qualtype *) | Some typ -> - type_ptr_to_type_desc ?attr_info translate_decl tenv typ + type_ptr_to_type_desc translate_decl tenv typ | None -> Typ.Tvoid ) @@ -250,29 +262,29 @@ and decl_ptr_to_type_desc translate_decl tenv decl_ptr : Typ.desc = Typ.Tvoid ) -and clang_type_ptr_to_type_desc ?attr_info translate_decl tenv type_ptr = +and clang_type_ptr_to_type_desc ?attr_info ?from_block translate_decl tenv type_ptr = try Clang_ast_extend.TypePointerMap.find type_ptr !CFrontend_config.sil_types_map with Caml.Not_found -> ( match CAst_utils.get_type type_ptr with | Some c_type -> - let type_desc = type_desc_of_c_type ?attr_info translate_decl tenv c_type in + let type_desc = type_desc_of_c_type ?attr_info ?from_block translate_decl tenv c_type in CAst_utils.update_sil_types_map type_ptr type_desc ; type_desc | _ -> Typ.Tvoid ) -and type_ptr_to_type_desc ?attr_info translate_decl tenv type_ptr : Typ.desc = +and type_ptr_to_type_desc ?attr_info ?from_block translate_decl tenv type_ptr : Typ.desc = match type_ptr with | Clang_ast_types.TypePtr.Ptr _ -> - clang_type_ptr_to_type_desc ?attr_info translate_decl tenv type_ptr + clang_type_ptr_to_type_desc ?attr_info ?from_block translate_decl tenv type_ptr | Clang_ast_extend.Builtin kind -> type_desc_of_builtin_type_kind kind | Clang_ast_extend.PointerOf typ -> - let sil_typ = qual_type_to_sil_type ?attr_info translate_decl tenv typ in + let sil_typ = qual_type_to_sil_type ?from_block translate_decl tenv typ in Typ.Tptr (sil_typ, Pk_pointer) | Clang_ast_extend.ReferenceOf typ -> - let sil_typ = qual_type_to_sil_type ?attr_info translate_decl tenv typ in + let sil_typ = qual_type_to_sil_type ?from_block translate_decl tenv typ in let pk_ref = match CAst_utils.get_desugared_type typ.Clang_ast_t.qt_type_ptr with | Some (Clang_ast_t.RValueReferenceType _) -> @@ -291,9 +303,10 @@ and type_ptr_to_type_desc ?attr_info translate_decl tenv type_ptr : Typ.desc = L.(die InternalError) "unknown variant for type_ptr" -and qual_type_to_sil_type ?attr_info translate_decl tenv qual_type = +and qual_type_to_sil_type ?attr_info ?from_block translate_decl tenv qual_type = let desc = - type_ptr_to_type_desc ?attr_info translate_decl tenv qual_type.Clang_ast_t.qt_type_ptr + type_ptr_to_type_desc ?attr_info ?from_block translate_decl tenv + qual_type.Clang_ast_t.qt_type_ptr in let is_reference = CType.is_reference_type qual_type in let quals = Typ.mk_type_quals ~is_reference ~is_const:qual_type.Clang_ast_t.qt_is_const () in diff --git a/infer/src/clang/cType_to_sil_type.mli b/infer/src/clang/cType_to_sil_type.mli index 6afacdfce46..653da15d647 100644 --- a/infer/src/clang/cType_to_sil_type.mli +++ b/infer/src/clang/cType_to_sil_type.mli @@ -13,6 +13,7 @@ val type_of_builtin_type_kind : ?is_const:bool -> Clang_ast_t.builtin_type_kind val qual_type_to_sil_type : ?attr_info:Clang_ast_t.attr_type_info + -> ?from_block:bool -> (Tenv.t -> Clang_ast_t.decl -> Typ.desc) -> Tenv.t -> Clang_ast_t.qual_type diff --git a/infer/tests/codetoanalyze/objc/frontend/block/retain_cycle.m.dot b/infer/tests/codetoanalyze/objc/frontend/block/retain_cycle.m.dot index 85ae1849748..698974ac1dd 100644 --- a/infer/tests/codetoanalyze/objc/frontend/block/retain_cycle.m.dot +++ b/infer/tests/codetoanalyze/objc/frontend/block/retain_cycle.m.dot @@ -56,7 +56,7 @@ digraph cfg { "capture#A#[instance].ca0ec9307f9d5110_2" [label="2: Exit A.capture \n " color=yellow style=filled] -"capture#A#[instance].ca0ec9307f9d5110_3" [label="3: Compound statement \n n$3=*&self:A* [line 45, column 4]\n n$4=*n$3._b:B* [line 45, column 4]\n n$0=*&self:A* [line 45, column 16]\n n$5=_fun_B.sHandler:(n$4:B*,(_fun_objc_block_retain_cycle.m:45,([by value]n$0 &self:A*)):_fn_(*)) virtual [line 45, column 3]\n " shape="box"] +"capture#A#[instance].ca0ec9307f9d5110_3" [label="3: Compound statement \n n$3=*&self:A* [line 45, column 4]\n n$4=*n$3._b:B* [line 45, column 4]\n n$0=*&self:A* [line 45, column 16]\n n$5=_fun_B.sHandler:(n$4:B*,(_fun_objc_block_retain_cycle.m:45,([by value]n$0 &self:A*)):(_fn_ [D*] -> void)(*)) virtual [line 45, column 3]\n " shape="box"] "capture#A#[instance].ca0ec9307f9d5110_3" -> "capture#A#[instance].ca0ec9307f9d5110_2" ; @@ -78,14 +78,14 @@ digraph cfg { "dealloc#B#[instance].62d516b6d74de70c_2" [label="2: Exit B.dealloc \n " color=yellow style=filled] -"sHandler:#B#[instance].2c9d8ca3b6059922_1" [label="1: Start B.sHandler:\nFormals: self:B* h:_fn_(*)\nLocals: \n " color=yellow style=filled] +"sHandler:#B#[instance].2c9d8ca3b6059922_1" [label="1: Start B.sHandler:\nFormals: self:B* h:(_fn_ [D*] -> void)(*)\nLocals: \n " color=yellow style=filled] "sHandler:#B#[instance].2c9d8ca3b6059922_1" -> "sHandler:#B#[instance].2c9d8ca3b6059922_3" ; "sHandler:#B#[instance].2c9d8ca3b6059922_2" [label="2: Exit B.sHandler: \n " color=yellow style=filled] -"sHandler:#B#[instance].2c9d8ca3b6059922_3" [label="3: BinaryOperatorStmt: Assign \n n$1=*&h:_fn_(*) [line 28, column 14]\n n$0=*&self:B* [line 28, column 3]\n *n$0._h:_fn_(*)=n$1 [line 28, column 3]\n " shape="box"] +"sHandler:#B#[instance].2c9d8ca3b6059922_3" [label="3: BinaryOperatorStmt: Assign \n n$1=*&h:(_fn_ [D*] -> void)(*) [line 28, column 14]\n n$0=*&self:B* [line 28, column 3]\n *n$0._h:(_fn_ [D*] -> void)(*)=n$1 [line 28, column 3]\n " shape="box"] "sHandler:#B#[instance].2c9d8ca3b6059922_3" -> "sHandler:#B#[instance].2c9d8ca3b6059922_2" ; diff --git a/infer/tests/codetoanalyze/objc/frontend/block/specialized_method_with_block_params.m.dot b/infer/tests/codetoanalyze/objc/frontend/block/specialized_method_with_block_params.m.dot index 8205a63cf17..05f85b419e3 100644 --- a/infer/tests/codetoanalyze/objc/frontend/block/specialized_method_with_block_params.m.dot +++ b/infer/tests/codetoanalyze/objc/frontend/block/specialized_method_with_block_params.m.dot @@ -55,14 +55,14 @@ digraph cfg { "objc_block_specialized_method_wit.982152dd64690368_3" -> "objc_block_specialized_method_wit.982152dd64690368_2" ; -"foo.acbd18db4cc2f85c_1" [label="1: Start foo\nFormals: <_Nullable> my_block1:_fn_(_Nullable *) <_Nullable> my_block2:_fn_(_Nullable *) <_Nonnull> a:A*\nLocals: \n " color=yellow style=filled] +"foo.acbd18db4cc2f85c_1" [label="1: Start foo\nFormals: <_Nullable> my_block1:(_fn_ [int] -> void)(_Nullable *) <_Nullable> my_block2:(_fn_ [int] -> void)(_Nullable *) <_Nonnull> a:A*\nLocals: \n " color=yellow style=filled] "foo.acbd18db4cc2f85c_1" -> "foo.acbd18db4cc2f85c_3" ; "foo.acbd18db4cc2f85c_2" [label="2: Exit foo \n " color=yellow style=filled] -"foo.acbd18db4cc2f85c_3" [label="3: Call n$0 \n n$0=*&my_block1:_fn_(_Nullable *) [line 16, column 3]\n n$1=_fun___call_objc_block(n$0:_fn_,22:int) objc_block [line 16, column 3]\n " shape="box"] +"foo.acbd18db4cc2f85c_3" [label="3: Call n$0 \n n$0=*&my_block1:(_fn_ [int] -> void)(_Nullable *) [line 16, column 3]\n n$1=_fun___call_objc_block(n$0:_fn_,22:int) objc_block [line 16, column 3]\n " shape="box"] "foo.acbd18db4cc2f85c_3" -> "foo.acbd18db4cc2f85c_2" ; @@ -92,7 +92,7 @@ digraph cfg { "bar2#A#[instance].2f0519276ed04788_4" -> "bar2#A#[instance].2f0519276ed04788_2" ; -"bar2#A#[instance].2f0519276ed04788_5" [label="5: Compound statement \n n$14=*&self:A* [line 40, column 7]\n n$16=*&self:A* [line 43, column 7]\n n$18=*&self:A* [line 46, column 7]\n n$19=_fun_foo((_fun_objc_block_specialized_method_with_block_params.m:40,([by value]n$14 &self:A*)):_fn_(*),(_fun_objc_block_specialized_method_with_block_params.m:43,([by value]n$16 &self:A*)):_fn_(*),n$18:A*) [line 39, column 3]\n " shape="box"] +"bar2#A#[instance].2f0519276ed04788_5" [label="5: Compound statement \n n$14=*&self:A* [line 40, column 7]\n n$16=*&self:A* [line 43, column 7]\n n$18=*&self:A* [line 46, column 7]\n n$19=_fun_foo((_fun_objc_block_specialized_method_with_block_params.m:40,([by value]n$14 &self:A*)):(_fn_ [int] -> void)(*),(_fun_objc_block_specialized_method_with_block_params.m:43,([by value]n$16 &self:A*)):(_fn_ [int] -> void)(*),n$18:A*) [line 39, column 3]\n " shape="box"] "bar2#A#[instance].2f0519276ed04788_5" -> "bar2#A#[instance].2f0519276ed04788_3" ; @@ -115,7 +115,7 @@ digraph cfg { "bar:#A(class A)#[instance].8e6cfff8b86359b6_5" -> "bar:#A(class A)#[instance].8e6cfff8b86359b6_3" ; -"bar:#A(class A)#[instance].8e6cfff8b86359b6_6" [label="6: Compound statement \n n$3=*&self:A* [line 27, column 7]\n n$4=*&x:int [line 27, column 7]\n n$7=*&self:A* [line 30, column 7]\n n$10=*&a:A* [line 33, column 7]\n n$11=_fun_foo((_fun_objc_block_specialized_method_with_block_params.m:27,([by value]n$3 &self:A*),([by value]n$4 &x:int)):_fn_(*),(_fun_objc_block_specialized_method_with_block_params.m:30,([by value]n$7 &self:A*)):_fn_(*),n$10:A*) [line 26, column 3]\n " shape="box"] +"bar:#A(class A)#[instance].8e6cfff8b86359b6_6" [label="6: Compound statement \n n$3=*&self:A* [line 27, column 7]\n n$4=*&x:int [line 27, column 7]\n n$7=*&self:A* [line 30, column 7]\n n$10=*&a:A* [line 33, column 7]\n n$11=_fun_foo((_fun_objc_block_specialized_method_with_block_params.m:27,([by value]n$3 &self:A*),([by value]n$4 &x:int)):(_fn_ [int] -> void)(*),(_fun_objc_block_specialized_method_with_block_params.m:30,([by value]n$7 &self:A*)):(_fn_ [int] -> void)(*),n$10:A*) [line 26, column 3]\n " shape="box"] "bar:#A(class A)#[instance].8e6cfff8b86359b6_6" -> "bar:#A(class A)#[instance].8e6cfff8b86359b6_5" ; @@ -123,7 +123,7 @@ digraph cfg { "bar:#A(class A)#[instance].8e6cfff8b86359b6_7" -> "bar:#A(class A)#[instance].8e6cfff8b86359b6_6" ; -"call_foo_with_same_param#A#[insta.0f7e046192340a49_1" [label="1: Start A.call_foo_with_same_param\nFormals: self:A*\nLocals: b:_fn_(_Nullable *) \n " color=yellow style=filled] +"call_foo_with_same_param#A#[insta.0f7e046192340a49_1" [label="1: Start A.call_foo_with_same_param\nFormals: self:A*\nLocals: b:(_fn_ [int] -> void)(_Nullable *) \n " color=yellow style=filled] "call_foo_with_same_param#A#[insta.0f7e046192340a49_1" -> "call_foo_with_same_param#A#[insta.0f7e046192340a49_7" ; @@ -138,15 +138,15 @@ digraph cfg { "call_foo_with_same_param#A#[insta.0f7e046192340a49_4" -> "call_foo_with_same_param#A#[insta.0f7e046192340a49_2" ; -"call_foo_with_same_param#A#[insta.0f7e046192340a49_5" [label="5: Call _fun_foo \n n$22=*&b:_fn_(_Nullable *) [line 55, column 7]\n n$23=*&b:_fn_(_Nullable *) [line 55, column 10]\n n$24=*&self:A* [line 55, column 13]\n n$25=_fun_foo(n$22:_fn_(_Nullable *),n$23:_fn_(_Nullable *),n$24:A*) [line 55, column 3]\n " shape="box"] +"call_foo_with_same_param#A#[insta.0f7e046192340a49_5" [label="5: Call _fun_foo \n n$22=*&b:(_fn_ [int] -> void)(_Nullable *) [line 55, column 7]\n n$23=*&b:(_fn_ [int] -> void)(_Nullable *) [line 55, column 10]\n n$24=*&self:A* [line 55, column 13]\n n$25=_fun_foo(n$22:(_fn_ [int] -> void)(_Nullable *),n$23:(_fn_ [int] -> void)(_Nullable *),n$24:A*) [line 55, column 3]\n " shape="box"] "call_foo_with_same_param#A#[insta.0f7e046192340a49_5" -> "call_foo_with_same_param#A#[insta.0f7e046192340a49_3" ; -"call_foo_with_same_param#A#[insta.0f7e046192340a49_6" [label="6: Call _fun_foo \n n$26=*&b:_fn_(_Nullable *) [line 54, column 7]\n n$27=*&b:_fn_(_Nullable *) [line 54, column 10]\n n$28=*&self:A* [line 54, column 13]\n n$29=_fun_foo(n$26:_fn_(_Nullable *),n$27:_fn_(_Nullable *),n$28:A*) [line 54, column 3]\n " shape="box"] +"call_foo_with_same_param#A#[insta.0f7e046192340a49_6" [label="6: Call _fun_foo \n n$26=*&b:(_fn_ [int] -> void)(_Nullable *) [line 54, column 7]\n n$27=*&b:(_fn_ [int] -> void)(_Nullable *) [line 54, column 10]\n n$28=*&self:A* [line 54, column 13]\n n$29=_fun_foo(n$26:(_fn_ [int] -> void)(_Nullable *),n$27:(_fn_ [int] -> void)(_Nullable *),n$28:A*) [line 54, column 3]\n " shape="box"] "call_foo_with_same_param#A#[insta.0f7e046192340a49_6" -> "call_foo_with_same_param#A#[insta.0f7e046192340a49_5" ; -"call_foo_with_same_param#A#[insta.0f7e046192340a49_7" [label="7: DeclStmt \n VARIABLE_DECLARED(b:_fn_(_Nullable *)); [line 51, column 3]\n n$30=*&self:A* [line 51, column 20]\n *&b:_fn_(*)=(_fun_objc_block_specialized_method_with_block_params.m:51,([by value]n$30 &self:A*)) [line 51, column 3]\n " shape="box"] +"call_foo_with_same_param#A#[insta.0f7e046192340a49_7" [label="7: DeclStmt \n VARIABLE_DECLARED(b:(_fn_ [int] -> void)(_Nullable *)); [line 51, column 3]\n n$30=*&self:A* [line 51, column 20]\n *&b:(_fn_ [int] -> void)(*)=(_fun_objc_block_specialized_method_with_block_params.m:51,([by value]n$30 &self:A*)) [line 51, column 3]\n " shape="box"] "call_foo_with_same_param#A#[insta.0f7e046192340a49_7" -> "call_foo_with_same_param#A#[insta.0f7e046192340a49_6" ; diff --git a/infer/tests/codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m b/infer/tests/codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m index c2cee1994cd..0f0fc3ae4af 100644 --- a/infer/tests/codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m +++ b/infer/tests/codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m @@ -197,7 +197,7 @@ typedef void (^_Nullable NewAnnotateSyncBlock)( void MarkerAnnotateSync(NS_NOESCAPE _Nullable NewAnnotateSyncBlock block) {} -void LoadAndAnnotateOk_FP(NSString* composerSessionID) { +void LoadAndAnnotateOk(NSString* composerSessionID) { MarkerAnnotateSync(^(NewAnnotateBlock annotate) { annotate("composer_session_id", composerSessionID); }); diff --git a/infer/tests/codetoanalyze/objc/parameter-not-null-checked/issues.exp b/infer/tests/codetoanalyze/objc/parameter-not-null-checked/issues.exp index 36f312e87ef..8552cb07a13 100644 --- a/infer/tests/codetoanalyze/objc/parameter-not-null-checked/issues.exp +++ b/infer/tests/codetoanalyze/objc/parameter-not-null-checked/issues.exp @@ -5,4 +5,3 @@ codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_ codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.nonnullBlockTwoBlocksBad:and:and:, 4, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block2` of Blocks_as_parameters.nonnullBlockTwoBlocksBad:and:and:,Executing `block2`], "block2("=>"BLOCK_CALL_SAFE(block2" codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.blockCheckedAssignNULLBad:and:, 3, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block` of Blocks_as_parameters.blockCheckedAssignNULLBad:and:,Checking `block` for nil,Assigned,Executing `block`], "block("=>"BLOCK_CALL_SAFE(block" codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, objc_block_Blocks_as_parameters.m:109, 1, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `completion` of Blocks_as_parameters.uploadTaskWithRequestBad:fromFile:delegate:delegateQueue:completion:,Executing `completion`], "completion("=>"BLOCK_CALL_SAFE(completion" -codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, objc_block_Blocks_as_parameters.m:201, 1, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `annotate` of objc_block_Blocks_as_parameters.m:201,Executing `annotate`], "annotate("=>"BLOCK_CALL_SAFE(annotate, " diff --git a/infer/tests/codetoanalyze/objc/shared/annotations/nonnull_annotations.m.dot b/infer/tests/codetoanalyze/objc/shared/annotations/nonnull_annotations.m.dot index 7f2ba17eda0..c3474e3ed0f 100644 --- a/infer/tests/codetoanalyze/objc/shared/annotations/nonnull_annotations.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/annotations/nonnull_annotations.m.dot @@ -82,7 +82,7 @@ digraph cfg { "test2:#NonnullAnnot(class Nonnull.e479988e9efecc2c_5" -> "test2:#NonnullAnnot(class Nonnull.e479988e9efecc2c_3" ; -"test3:#NonnullAnnot#[instance].0e0a10b544f9cece_1" [label="1: Start NonnullAnnot.test3:\nFormals: self:NonnullAnnot* successBlock:_fn_(*)\nLocals: \n " color=yellow style=filled] +"test3:#NonnullAnnot#[instance].0e0a10b544f9cece_1" [label="1: Start NonnullAnnot.test3:\nFormals: self:NonnullAnnot* successBlock:(_fn_ [NSString*] -> void)(*)\nLocals: \n " color=yellow style=filled] "test3:#NonnullAnnot#[instance].0e0a10b544f9cece_1" -> "test3:#NonnullAnnot#[instance].0e0a10b544f9cece_4" ; @@ -93,11 +93,11 @@ digraph cfg { "test3:#NonnullAnnot#[instance].0e0a10b544f9cece_3" -> "test3:#NonnullAnnot#[instance].0e0a10b544f9cece_2" ; -"test3:#NonnullAnnot#[instance].0e0a10b544f9cece_4" [label="4: Call n$9 \n n$9=*&successBlock:_fn_(*) [line 34, column 3]\n n$10=_fun_NSString.stringWithUTF8String:(\"Yay\":char* const ) [line 34, column 16]\n n$11=_fun___call_objc_block(n$9:_fn_,n$10:NSString*) objc_block [line 34, column 3]\n " shape="box"] +"test3:#NonnullAnnot#[instance].0e0a10b544f9cece_4" [label="4: Call n$9 \n n$9=*&successBlock:(_fn_ [NSString*] -> void)(*) [line 34, column 3]\n n$10=_fun_NSString.stringWithUTF8String:(\"Yay\":char* const ) [line 34, column 16]\n n$11=_fun___call_objc_block(n$9:_fn_,n$10:NSString*) objc_block [line 34, column 3]\n " shape="box"] "test3:#NonnullAnnot#[instance].0e0a10b544f9cece_4" -> "test3:#NonnullAnnot#[instance].0e0a10b544f9cece_3" ; -"test4:#NonnullAnnot#[instance].4dee71de0c7397a3_1" [label="1: Start NonnullAnnot.test4:\nFormals: self:NonnullAnnot* <_Nonnull> successBlock:_fn_(*)\nLocals: \n " color=yellow style=filled] +"test4:#NonnullAnnot#[instance].4dee71de0c7397a3_1" [label="1: Start NonnullAnnot.test4:\nFormals: self:NonnullAnnot* <_Nonnull> successBlock:(_fn_ [NSString*] -> void)(*)\nLocals: \n " color=yellow style=filled] "test4:#NonnullAnnot#[instance].4dee71de0c7397a3_1" -> "test4:#NonnullAnnot#[instance].4dee71de0c7397a3_4" ; @@ -108,7 +108,7 @@ digraph cfg { "test4:#NonnullAnnot#[instance].4dee71de0c7397a3_3" -> "test4:#NonnullAnnot#[instance].4dee71de0c7397a3_2" ; -"test4:#NonnullAnnot#[instance].4dee71de0c7397a3_4" [label="4: Call n$12 \n n$12=*&successBlock:_fn_(*) [line 39, column 3]\n n$13=_fun_NSString.stringWithUTF8String:(\"Yay\":char* const ) [line 39, column 16]\n n$14=_fun___call_objc_block(n$12:_fn_,n$13:NSString*) objc_block [line 39, column 3]\n " shape="box"] +"test4:#NonnullAnnot#[instance].4dee71de0c7397a3_4" [label="4: Call n$12 \n n$12=*&successBlock:(_fn_ [NSString*] -> void)(*) [line 39, column 3]\n n$13=_fun_NSString.stringWithUTF8String:(\"Yay\":char* const ) [line 39, column 16]\n n$14=_fun___call_objc_block(n$12:_fn_,n$13:NSString*) objc_block [line 39, column 3]\n " shape="box"] "test4:#NonnullAnnot#[instance].4dee71de0c7397a3_4" -> "test4:#NonnullAnnot#[instance].4dee71de0c7397a3_3" ; diff --git a/infer/tests/codetoanalyze/objc/shared/block/BlockVar.m.dot b/infer/tests/codetoanalyze/objc/shared/block/BlockVar.m.dot index 86eb59592a7..cd457f439cf 100644 --- a/infer/tests/codetoanalyze/objc/shared/block/BlockVar.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/block/BlockVar.m.dot @@ -79,7 +79,7 @@ digraph cfg { "objc_block_BlockVar.m:57_99feb6f8.88ceda83a8e9bda1_4" -> "objc_block_BlockVar.m:57_99feb6f8.88ceda83a8e9bda1_2" ; -"navigateToURLInBackground#BlockVa.8013af6ffddfbf14_1" [label="1: Start BlockVar.navigateToURLInBackground\nFormals: \nLocals: p:int* x:int addBlock:_fn_(*) \n " color=yellow style=filled] +"navigateToURLInBackground#BlockVa.8013af6ffddfbf14_1" [label="1: Start BlockVar.navigateToURLInBackground\nFormals: \nLocals: p:int* x:int addBlock:(_fn_ [int,int] -> int)(*) \n " color=yellow style=filled] "navigateToURLInBackground#BlockVa.8013af6ffddfbf14_1" -> "navigateToURLInBackground#BlockVa.8013af6ffddfbf14_14" ; @@ -127,11 +127,11 @@ digraph cfg { "navigateToURLInBackground#BlockVa.8013af6ffddfbf14_12" -> "navigateToURLInBackground#BlockVa.8013af6ffddfbf14_5" ; -"navigateToURLInBackground#BlockVa.8013af6ffddfbf14_13" [label="13: DeclStmt \n VARIABLE_DECLARED(x:int); [line 21, column 3]\n n$5=*&addBlock:_fn_(*) [line 21, column 11]\n n$6=_fun___call_objc_block(n$5:_fn_,1:int,2:int) objc_block [line 21, column 11]\n *&x:int=n$6 [line 21, column 3]\n " shape="box"] +"navigateToURLInBackground#BlockVa.8013af6ffddfbf14_13" [label="13: DeclStmt \n VARIABLE_DECLARED(x:int); [line 21, column 3]\n n$5=*&addBlock:(_fn_ [int,int] -> int)(*) [line 21, column 11]\n n$6=_fun___call_objc_block(n$5:_fn_,1:int,2:int) objc_block [line 21, column 11]\n *&x:int=n$6 [line 21, column 3]\n " shape="box"] "navigateToURLInBackground#BlockVa.8013af6ffddfbf14_13" -> "navigateToURLInBackground#BlockVa.8013af6ffddfbf14_12" ; -"navigateToURLInBackground#BlockVa.8013af6ffddfbf14_14" [label="14: DeclStmt \n VARIABLE_DECLARED(addBlock:_fn_(*)); [line 17, column 3]\n *&addBlock:_fn_(*)=(_fun_objc_block_BlockVar.m:17) [line 17, column 3]\n " shape="box"] +"navigateToURLInBackground#BlockVa.8013af6ffddfbf14_14" [label="14: DeclStmt \n VARIABLE_DECLARED(addBlock:(_fn_ [int,int] -> int)(*)); [line 17, column 3]\n *&addBlock:(_fn_ [int,int] -> int)(*)=(_fun_objc_block_BlockVar.m:17) [line 17, column 3]\n " shape="box"] "navigateToURLInBackground#BlockVa.8013af6ffddfbf14_14" -> "navigateToURLInBackground#BlockVa.8013af6ffddfbf14_13" ; @@ -146,14 +146,14 @@ digraph cfg { "test#BlockVar#[class].9f8bbfa4e16dd084_3" -> "test#BlockVar#[class].9f8bbfa4e16dd084_2" ; -"blockPostBad#BlockVar#[instance].47932460613f653f_1" [label="1: Start BlockVar.blockPostBad\nFormals: self:BlockVar*\nLocals: my_block:_fn_(*) x:int* \n " color=yellow style=filled] +"blockPostBad#BlockVar#[instance].47932460613f653f_1" [label="1: Start BlockVar.blockPostBad\nFormals: self:BlockVar*\nLocals: my_block:(_fn_ [] -> int*)(*) x:int* \n " color=yellow style=filled] "blockPostBad#BlockVar#[instance].47932460613f653f_1" -> "blockPostBad#BlockVar#[instance].47932460613f653f_6" ; "blockPostBad#BlockVar#[instance].47932460613f653f_2" [label="2: Exit BlockVar.blockPostBad \n " color=yellow style=filled] -"blockPostBad#BlockVar#[instance].47932460613f653f_3" [label="3: Return Stmt \n n$11=*&my_block:_fn_(*) [line 34, column 11]\n n$12=_fun___call_objc_block(n$11:_fn_) objc_block [line 34, column 11]\n n$13=*n$12:int [line 34, column 10]\n " shape="box"] +"blockPostBad#BlockVar#[instance].47932460613f653f_3" [label="3: Return Stmt \n n$11=*&my_block:(_fn_ [] -> int*)(*) [line 34, column 11]\n n$12=_fun___call_objc_block(n$11:_fn_) objc_block [line 34, column 11]\n n$13=*n$12:int [line 34, column 10]\n " shape="box"] "blockPostBad#BlockVar#[instance].47932460613f653f_3" -> "blockPostBad#BlockVar#[instance].47932460613f653f_4" ; @@ -161,7 +161,7 @@ digraph cfg { "blockPostBad#BlockVar#[instance].47932460613f653f_4" -> "blockPostBad#BlockVar#[instance].47932460613f653f_2" ; -"blockPostBad#BlockVar#[instance].47932460613f653f_5" [label="5: DeclStmt \n VARIABLE_DECLARED(my_block:_fn_(*)); [line 31, column 3]\n n$14=*&x:int* [line 31, column 28]\n *&my_block:_fn_(*)=(_fun_objc_block_BlockVar.m:31,([by value]n$14 &x:int*)) [line 31, column 3]\n " shape="box"] +"blockPostBad#BlockVar#[instance].47932460613f653f_5" [label="5: DeclStmt \n VARIABLE_DECLARED(my_block:(_fn_ [] -> int*)(*)); [line 31, column 3]\n n$14=*&x:int* [line 31, column 28]\n *&my_block:(_fn_ [] -> int*)(*)=(_fun_objc_block_BlockVar.m:31,([by value]n$14 &x:int*)) [line 31, column 3]\n " shape="box"] "blockPostBad#BlockVar#[instance].47932460613f653f_5" -> "blockPostBad#BlockVar#[instance].47932460613f653f_3" ; @@ -169,14 +169,14 @@ digraph cfg { "blockPostBad#BlockVar#[instance].47932460613f653f_6" -> "blockPostBad#BlockVar#[instance].47932460613f653f_5" ; -"blockPostOk#BlockVar#[instance].a2b2d2d14542ee03_1" [label="1: Start BlockVar.blockPostOk\nFormals: self:BlockVar*\nLocals: my_block:_fn_(*) x:int* i:int \n " color=yellow style=filled] +"blockPostOk#BlockVar#[instance].a2b2d2d14542ee03_1" [label="1: Start BlockVar.blockPostOk\nFormals: self:BlockVar*\nLocals: my_block:(_fn_ [] -> int*)(*) x:int* i:int \n " color=yellow style=filled] "blockPostOk#BlockVar#[instance].a2b2d2d14542ee03_1" -> "blockPostOk#BlockVar#[instance].a2b2d2d14542ee03_7" ; "blockPostOk#BlockVar#[instance].a2b2d2d14542ee03_2" [label="2: Exit BlockVar.blockPostOk \n " color=yellow style=filled] -"blockPostOk#BlockVar#[instance].a2b2d2d14542ee03_3" [label="3: Return Stmt \n n$16=*&my_block:_fn_(*) [line 43, column 11]\n n$17=_fun___call_objc_block(n$16:_fn_) objc_block [line 43, column 11]\n n$18=*n$17:int [line 43, column 10]\n " shape="box"] +"blockPostOk#BlockVar#[instance].a2b2d2d14542ee03_3" [label="3: Return Stmt \n n$16=*&my_block:(_fn_ [] -> int*)(*) [line 43, column 11]\n n$17=_fun___call_objc_block(n$16:_fn_) objc_block [line 43, column 11]\n n$18=*n$17:int [line 43, column 10]\n " shape="box"] "blockPostOk#BlockVar#[instance].a2b2d2d14542ee03_3" -> "blockPostOk#BlockVar#[instance].a2b2d2d14542ee03_4" ; @@ -184,7 +184,7 @@ digraph cfg { "blockPostOk#BlockVar#[instance].a2b2d2d14542ee03_4" -> "blockPostOk#BlockVar#[instance].a2b2d2d14542ee03_2" ; -"blockPostOk#BlockVar#[instance].a2b2d2d14542ee03_5" [label="5: DeclStmt \n VARIABLE_DECLARED(my_block:_fn_(*)); [line 40, column 3]\n n$19=*&x:int* [line 40, column 28]\n *&my_block:_fn_(*)=(_fun_objc_block_BlockVar.m:40,([by value]n$19 &x:int*)) [line 40, column 3]\n " shape="box"] +"blockPostOk#BlockVar#[instance].a2b2d2d14542ee03_5" [label="5: DeclStmt \n VARIABLE_DECLARED(my_block:(_fn_ [] -> int*)(*)); [line 40, column 3]\n n$19=*&x:int* [line 40, column 28]\n *&my_block:(_fn_ [] -> int*)(*)=(_fun_objc_block_BlockVar.m:40,([by value]n$19 &x:int*)) [line 40, column 3]\n " shape="box"] "blockPostOk#BlockVar#[instance].a2b2d2d14542ee03_5" -> "blockPostOk#BlockVar#[instance].a2b2d2d14542ee03_3" ; @@ -196,14 +196,14 @@ digraph cfg { "blockPostOk#BlockVar#[instance].a2b2d2d14542ee03_7" -> "blockPostOk#BlockVar#[instance].a2b2d2d14542ee03_6" ; -"capturedNoNullDeref#BlockVar#[ins.0edb1a16a0d48da5_1" [label="1: Start BlockVar.capturedNoNullDeref\nFormals: self:BlockVar*\nLocals: my_block:_fn_(*) x:int* i:int \n " color=yellow style=filled] +"capturedNoNullDeref#BlockVar#[ins.0edb1a16a0d48da5_1" [label="1: Start BlockVar.capturedNoNullDeref\nFormals: self:BlockVar*\nLocals: my_block:(_fn_ [] -> int)(*) x:int* i:int \n " color=yellow style=filled] "capturedNoNullDeref#BlockVar#[ins.0edb1a16a0d48da5_1" -> "capturedNoNullDeref#BlockVar#[ins.0edb1a16a0d48da5_8" ; "capturedNoNullDeref#BlockVar#[ins.0edb1a16a0d48da5_2" [label="2: Exit BlockVar.capturedNoNullDeref \n " color=yellow style=filled] -"capturedNoNullDeref#BlockVar#[ins.0edb1a16a0d48da5_3" [label="3: Return Stmt \n n$26=*&my_block:_fn_(*) [line 61, column 10]\n n$27=_fun___call_objc_block(n$26:_fn_) objc_block [line 61, column 10]\n " shape="box"] +"capturedNoNullDeref#BlockVar#[ins.0edb1a16a0d48da5_3" [label="3: Return Stmt \n n$26=*&my_block:(_fn_ [] -> int)(*) [line 61, column 10]\n n$27=_fun___call_objc_block(n$26:_fn_) objc_block [line 61, column 10]\n " shape="box"] "capturedNoNullDeref#BlockVar#[ins.0edb1a16a0d48da5_3" -> "capturedNoNullDeref#BlockVar#[ins.0edb1a16a0d48da5_4" ; @@ -215,7 +215,7 @@ digraph cfg { "capturedNoNullDeref#BlockVar#[ins.0edb1a16a0d48da5_5" -> "capturedNoNullDeref#BlockVar#[ins.0edb1a16a0d48da5_3" ; -"capturedNoNullDeref#BlockVar#[ins.0edb1a16a0d48da5_6" [label="6: DeclStmt \n VARIABLE_DECLARED(my_block:_fn_(*)); [line 57, column 3]\n n$28=*&x:int* [line 57, column 27]\n *&my_block:_fn_(*)=(_fun_objc_block_BlockVar.m:57,([by value]n$28 &x:int*)) [line 57, column 3]\n " shape="box"] +"capturedNoNullDeref#BlockVar#[ins.0edb1a16a0d48da5_6" [label="6: DeclStmt \n VARIABLE_DECLARED(my_block:(_fn_ [] -> int)(*)); [line 57, column 3]\n n$28=*&x:int* [line 57, column 27]\n *&my_block:(_fn_ [] -> int)(*)=(_fun_objc_block_BlockVar.m:57,([by value]n$28 &x:int*)) [line 57, column 3]\n " shape="box"] "capturedNoNullDeref#BlockVar#[ins.0edb1a16a0d48da5_6" -> "capturedNoNullDeref#BlockVar#[ins.0edb1a16a0d48da5_5" ; @@ -227,14 +227,14 @@ digraph cfg { "capturedNoNullDeref#BlockVar#[ins.0edb1a16a0d48da5_8" -> "capturedNoNullDeref#BlockVar#[ins.0edb1a16a0d48da5_7" ; -"capturedNullDeref#BlockVar#[insta.53b2f4512435f496_1" [label="1: Start BlockVar.capturedNullDeref\nFormals: self:BlockVar*\nLocals: my_block:_fn_(*) x:int* \n " color=yellow style=filled] +"capturedNullDeref#BlockVar#[insta.53b2f4512435f496_1" [label="1: Start BlockVar.capturedNullDeref\nFormals: self:BlockVar*\nLocals: my_block:(_fn_ [] -> int)(*) x:int* \n " color=yellow style=filled] "capturedNullDeref#BlockVar#[insta.53b2f4512435f496_1" -> "capturedNullDeref#BlockVar#[insta.53b2f4512435f496_6" ; "capturedNullDeref#BlockVar#[insta.53b2f4512435f496_2" [label="2: Exit BlockVar.capturedNullDeref \n " color=yellow style=filled] -"capturedNullDeref#BlockVar#[insta.53b2f4512435f496_3" [label="3: Return Stmt \n n$21=*&my_block:_fn_(*) [line 51, column 10]\n n$22=_fun___call_objc_block(n$21:_fn_) objc_block [line 51, column 10]\n " shape="box"] +"capturedNullDeref#BlockVar#[insta.53b2f4512435f496_3" [label="3: Return Stmt \n n$21=*&my_block:(_fn_ [] -> int)(*) [line 51, column 10]\n n$22=_fun___call_objc_block(n$21:_fn_) objc_block [line 51, column 10]\n " shape="box"] "capturedNullDeref#BlockVar#[insta.53b2f4512435f496_3" -> "capturedNullDeref#BlockVar#[insta.53b2f4512435f496_4" ; @@ -242,7 +242,7 @@ digraph cfg { "capturedNullDeref#BlockVar#[insta.53b2f4512435f496_4" -> "capturedNullDeref#BlockVar#[insta.53b2f4512435f496_2" ; -"capturedNullDeref#BlockVar#[insta.53b2f4512435f496_5" [label="5: DeclStmt \n VARIABLE_DECLARED(my_block:_fn_(*)); [line 48, column 3]\n n$23=*&x:int* [line 48, column 27]\n *&my_block:_fn_(*)=(_fun_objc_block_BlockVar.m:48,([by value]n$23 &x:int*)) [line 48, column 3]\n " shape="box"] +"capturedNullDeref#BlockVar#[insta.53b2f4512435f496_5" [label="5: DeclStmt \n VARIABLE_DECLARED(my_block:(_fn_ [] -> int)(*)); [line 48, column 3]\n n$23=*&x:int* [line 48, column 27]\n *&my_block:(_fn_ [] -> int)(*)=(_fun_objc_block_BlockVar.m:48,([by value]n$23 &x:int*)) [line 48, column 3]\n " shape="box"] "capturedNullDeref#BlockVar#[insta.53b2f4512435f496_5" -> "capturedNullDeref#BlockVar#[insta.53b2f4512435f496_3" ; diff --git a/infer/tests/codetoanalyze/objc/shared/block/block-it.m.dot b/infer/tests/codetoanalyze/objc/shared/block/block-it.m.dot index 5ba59012cce..379e79527a0 100644 --- a/infer/tests/codetoanalyze/objc/shared/block/block-it.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/block/block-it.m.dot @@ -63,7 +63,7 @@ digraph cfg { "array#MyBlock#[instance].452aa168203e40bd_2" [label="2: Exit MyBlock.array \n " color=yellow style=filled] -"array#MyBlock#[instance].452aa168203e40bd_3" [label="3: Message Call: enumerateObjectsUsingBlock: \n n$5=*&a:NSArray* [line 19, column 4]\n n$6=_fun_NSArray.enumerateObjectsUsingBlock:(n$5:NSArray*,(_fun_objc_block_block-it.m:19):_fn_(*)) virtual [line 19, column 3]\n " shape="box"] +"array#MyBlock#[instance].452aa168203e40bd_3" [label="3: Message Call: enumerateObjectsUsingBlock: \n n$5=*&a:NSArray* [line 19, column 4]\n n$6=_fun_NSArray.enumerateObjectsUsingBlock:(n$5:NSArray*,(_fun_objc_block_block-it.m:19):(_fn_ [objc_object*,unsigned long,_Bool*] -> void)(*)) virtual [line 19, column 3]\n " shape="box"] "array#MyBlock#[instance].452aa168203e40bd_3" -> "array#MyBlock#[instance].452aa168203e40bd_2" ; @@ -71,7 +71,7 @@ digraph cfg { "array#MyBlock#[instance].452aa168203e40bd_4" -> "array#MyBlock#[instance].452aa168203e40bd_3" ; -"array_trans#MyBlock#[instance].92a91a5a6c07d842_1" [label="1: Start MyBlock.array_trans\nFormals: self:MyBlock*\nLocals: idx:unsigned long object:objc_object* stop:_Bool* enumerateObjectsUsingBlock:_fn_(*) objects:NSArray* a:NSArray* \n " color=yellow style=filled] +"array_trans#MyBlock#[instance].92a91a5a6c07d842_1" [label="1: Start MyBlock.array_trans\nFormals: self:MyBlock*\nLocals: idx:unsigned long object:objc_object* stop:_Bool* enumerateObjectsUsingBlock:(_fn_ [objc_object*,unsigned long,_Bool*] -> void)(*) objects:NSArray* a:NSArray* \n " color=yellow style=filled] "array_trans#MyBlock#[instance].92a91a5a6c07d842_1" -> "array_trans#MyBlock#[instance].92a91a5a6c07d842_20" ; @@ -124,7 +124,7 @@ digraph cfg { "array_trans#MyBlock#[instance].92a91a5a6c07d842_13" -> "array_trans#MyBlock#[instance].92a91a5a6c07d842_10" ; -"array_trans#MyBlock#[instance].92a91a5a6c07d842_14" [label="14: Call n$20 \n n$20=*&enumerateObjectsUsingBlock:_fn_(*) [line 51, column 5]\n n$21=*&object:objc_object* [line 51, column 32]\n n$22=*&idx:unsigned long [line 51, column 40]\n n$23=*&stop:_Bool* [line 51, column 45]\n n$24=_fun___call_objc_block(n$20:_fn_,n$21:objc_object*,n$22:unsigned long,n$23:_Bool*) objc_block [line 51, column 5]\n " shape="box"] +"array_trans#MyBlock#[instance].92a91a5a6c07d842_14" [label="14: Call n$20 \n n$20=*&enumerateObjectsUsingBlock:(_fn_ [objc_object*,unsigned long,_Bool*] -> void)(*) [line 51, column 5]\n n$21=*&object:objc_object* [line 51, column 32]\n n$22=*&idx:unsigned long [line 51, column 40]\n n$23=*&stop:_Bool* [line 51, column 45]\n n$24=_fun___call_objc_block(n$20:_fn_,n$21:objc_object*,n$22:unsigned long,n$23:_Bool*) objc_block [line 51, column 5]\n " shape="box"] "array_trans#MyBlock#[instance].92a91a5a6c07d842_14" -> "array_trans#MyBlock#[instance].92a91a5a6c07d842_11" ; @@ -140,7 +140,7 @@ digraph cfg { "array_trans#MyBlock#[instance].92a91a5a6c07d842_17" -> "array_trans#MyBlock#[instance].92a91a5a6c07d842_16" ; -"array_trans#MyBlock#[instance].92a91a5a6c07d842_18" [label="18: DeclStmt \n VARIABLE_DECLARED(enumerateObjectsUsingBlock:_fn_(*)); [line 37, column 3]\n *&enumerateObjectsUsingBlock:_fn_(*)=(_fun_objc_block_block-it.m:38) [line 37, column 3]\n " shape="box"] +"array_trans#MyBlock#[instance].92a91a5a6c07d842_18" [label="18: DeclStmt \n VARIABLE_DECLARED(enumerateObjectsUsingBlock:(_fn_ [objc_object*,unsigned long,_Bool*] -> void)(*)); [line 37, column 3]\n *&enumerateObjectsUsingBlock:(_fn_ [objc_object*,unsigned long,_Bool*] -> void)(*)=(_fun_objc_block_block-it.m:38) [line 37, column 3]\n " shape="box"] "array_trans#MyBlock#[instance].92a91a5a6c07d842_18" -> "array_trans#MyBlock#[instance].92a91a5a6c07d842_17" ; diff --git a/infer/tests/codetoanalyze/objc/shared/block/block.m.dot b/infer/tests/codetoanalyze/objc/shared/block/block.m.dot index 005e32e4339..e24c3b4552e 100644 --- a/infer/tests/codetoanalyze/objc/shared/block/block.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/block/block.m.dot @@ -1,6 +1,6 @@ /* @generated */ digraph cfg { -"objc_block_block.m:16_b5d94b7b.4639411e261cc5d4_1" [label="1: Start objc_block_block.m:16\nFormals: c:int d:int\nLocals: bla:int add2:int addblock2:_fn_(*)\nCaptured: [by value]&x:int \n " color=yellow style=filled] +"objc_block_block.m:16_b5d94b7b.4639411e261cc5d4_1" [label="1: Start objc_block_block.m:16\nFormals: c:int d:int\nLocals: bla:int add2:int addblock2:(_fn_ [int] -> int)(*)\nCaptured: [by value]&x:int \n " color=yellow style=filled] "objc_block_block.m:16_b5d94b7b.4639411e261cc5d4_1" -> "objc_block_block.m:16_b5d94b7b.4639411e261cc5d4_7" ; @@ -15,11 +15,11 @@ digraph cfg { "objc_block_block.m:16_b5d94b7b.4639411e261cc5d4_4" -> "objc_block_block.m:16_b5d94b7b.4639411e261cc5d4_2" ; -"objc_block_block.m:16_b5d94b7b.4639411e261cc5d4_5" [label="5: BinaryOperatorStmt: Assign \n n$13=*&addblock2:_fn_(*) [line 25, column 12]\n n$14=_fun___call_objc_block(n$13:_fn_,1:int) objc_block [line 25, column 12]\n *&add2:int=n$14 [line 25, column 5]\n " shape="box"] +"objc_block_block.m:16_b5d94b7b.4639411e261cc5d4_5" [label="5: BinaryOperatorStmt: Assign \n n$13=*&addblock2:(_fn_ [int] -> int)(*) [line 25, column 12]\n n$14=_fun___call_objc_block(n$13:_fn_,1:int) objc_block [line 25, column 12]\n *&add2:int=n$14 [line 25, column 5]\n " shape="box"] "objc_block_block.m:16_b5d94b7b.4639411e261cc5d4_5" -> "objc_block_block.m:16_b5d94b7b.4639411e261cc5d4_3" ; -"objc_block_block.m:16_b5d94b7b.4639411e261cc5d4_6" [label="6: Compound statement \n n$15=*&x:int [line 21, column 17]\n n$16=*&bla:int [line 21, column 17]\n *&addblock2:_fn_(*)=(_fun_objc_block_block.m:21,([by value]n$15 &x:int),([by value]n$16 &bla:int)) [line 21, column 5]\n n$21=*&addblock2:_fn_(*) [line 21, column 5]\n " shape="box"] +"objc_block_block.m:16_b5d94b7b.4639411e261cc5d4_6" [label="6: Compound statement \n n$15=*&x:int [line 21, column 17]\n n$16=*&bla:int [line 21, column 17]\n *&addblock2:(_fn_ [int] -> int)(*)=(_fun_objc_block_block.m:21,([by value]n$15 &x:int),([by value]n$16 &bla:int)) [line 21, column 5]\n n$21=*&addblock2:(_fn_ [int] -> int)(*) [line 21, column 5]\n " shape="box"] "objc_block_block.m:16_b5d94b7b.4639411e261cc5d4_6" -> "objc_block_block.m:16_b5d94b7b.4639411e261cc5d4_5" ; @@ -72,7 +72,7 @@ digraph cfg { "BlockMain.116013dceff96297_4" -> "BlockMain.116013dceff96297_2" ; -"main1.38f534a9576db7ec_1" [label="1: Start main1\nFormals: y:int\nLocals: addblock:_fn_(*) add2:int add1:int x:int \n " color=yellow style=filled] +"main1.38f534a9576db7ec_1" [label="1: Start main1\nFormals: y:int\nLocals: addblock:(_fn_ [int,int] -> int)(*) add2:int add1:int x:int \n " color=yellow style=filled] "main1.38f534a9576db7ec_1" -> "main1.38f534a9576db7ec_10" ; @@ -91,19 +91,19 @@ digraph cfg { "main1.38f534a9576db7ec_5" -> "main1.38f534a9576db7ec_3" ; -"main1.38f534a9576db7ec_6" [label="6: BinaryOperatorStmt: Assign \n n$3=*&addblock:_fn_(*) [line 35, column 10]\n n$4=_fun___call_objc_block(n$3:_fn_,3:int,2:int) objc_block [line 35, column 10]\n *&add2:int=n$4 [line 35, column 3]\n " shape="box"] +"main1.38f534a9576db7ec_6" [label="6: BinaryOperatorStmt: Assign \n n$3=*&addblock:(_fn_ [int,int] -> int)(*) [line 35, column 10]\n n$4=_fun___call_objc_block(n$3:_fn_,3:int,2:int) objc_block [line 35, column 10]\n *&add2:int=n$4 [line 35, column 3]\n " shape="box"] "main1.38f534a9576db7ec_6" -> "main1.38f534a9576db7ec_5" ; -"main1.38f534a9576db7ec_7" [label="7: BinaryOperatorStmt: Assign \n *&addblock:_fn_(*)=(_fun_objc_block_block.m:31) [line 31, column 3]\n " shape="box"] +"main1.38f534a9576db7ec_7" [label="7: BinaryOperatorStmt: Assign \n *&addblock:(_fn_ [int,int] -> int)(*)=(_fun_objc_block_block.m:31) [line 31, column 3]\n " shape="box"] "main1.38f534a9576db7ec_7" -> "main1.38f534a9576db7ec_6" ; -"main1.38f534a9576db7ec_8" [label="8: BinaryOperatorStmt: Assign \n n$7=*&addblock:_fn_(*) [line 29, column 10]\n n$8=_fun___call_objc_block(n$7:_fn_,1:int,2:int) objc_block [line 29, column 10]\n *&add1:int=n$8 [line 29, column 3]\n " shape="box"] +"main1.38f534a9576db7ec_8" [label="8: BinaryOperatorStmt: Assign \n n$7=*&addblock:(_fn_ [int,int] -> int)(*) [line 29, column 10]\n n$8=_fun___call_objc_block(n$7:_fn_,1:int,2:int) objc_block [line 29, column 10]\n *&add1:int=n$8 [line 29, column 3]\n " shape="box"] "main1.38f534a9576db7ec_8" -> "main1.38f534a9576db7ec_7" ; -"main1.38f534a9576db7ec_9" [label="9: Compound statement \n n$9=*&x:int [line 16, column 14]\n *&addblock:_fn_(*)=(_fun_objc_block_block.m:16,([by value]n$9 &x:int)) [line 16, column 3]\n n$22=*&addblock:_fn_(*) [line 16, column 3]\n " shape="box"] +"main1.38f534a9576db7ec_9" [label="9: Compound statement \n n$9=*&x:int [line 16, column 14]\n *&addblock:(_fn_ [int,int] -> int)(*)=(_fun_objc_block_block.m:16,([by value]n$9 &x:int)) [line 16, column 3]\n n$22=*&addblock:(_fn_ [int,int] -> int)(*) [line 16, column 3]\n " shape="box"] "main1.38f534a9576db7ec_9" -> "main1.38f534a9576db7ec_8" ; diff --git a/infer/tests/codetoanalyze/objc/shared/block/block_release.m.dot b/infer/tests/codetoanalyze/objc/shared/block/block_release.m.dot index 2ce37db2bf7..19ed0b4148f 100644 --- a/infer/tests/codetoanalyze/objc/shared/block/block_release.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/block/block_release.m.dot @@ -28,7 +28,7 @@ digraph cfg { "objc_block_block_release.m:23_bca.a75e5c2171d1b867_7" -> "objc_block_block_release.m:23_bca.a75e5c2171d1b867_3" ; -"blockReleaseNoLeak#My_manager#[in.d6f2b8011ad550e7_1" [label="1: Start My_manager.blockReleaseNoLeak\nFormals: self:My_manager*\nLocals: newImage:CGImage* context:CGContext* z:int b:_fn_(*) \n " color=yellow style=filled] +"blockReleaseNoLeak#My_manager#[in.d6f2b8011ad550e7_1" [label="1: Start My_manager.blockReleaseNoLeak\nFormals: self:My_manager*\nLocals: newImage:CGImage* context:CGContext* z:int b:(_fn_ [int] -> void)(*) \n " color=yellow style=filled] "blockReleaseNoLeak#My_manager#[in.d6f2b8011ad550e7_1" -> "blockReleaseNoLeak#My_manager#[in.d6f2b8011ad550e7_13" ; @@ -59,12 +59,12 @@ digraph cfg { "blockReleaseNoLeak#My_manager#[in.d6f2b8011ad550e7_8" -> "blockReleaseNoLeak#My_manager#[in.d6f2b8011ad550e7_5" ; -"blockReleaseNoLeak#My_manager#[in.d6f2b8011ad550e7_9" [label="9: Call n$6 \n n$6=*&b:_fn_(*) [line 27, column 3]\n n$7=*&z:int [line 27, column 5]\n n$8=_fun___call_objc_block(n$6:_fn_,n$7:int) objc_block [line 27, column 3]\n " shape="box"] +"blockReleaseNoLeak#My_manager#[in.d6f2b8011ad550e7_9" [label="9: Call n$6 \n n$6=*&b:(_fn_ [int] -> void)(*) [line 27, column 3]\n n$7=*&z:int [line 27, column 5]\n n$8=_fun___call_objc_block(n$6:_fn_,n$7:int) objc_block [line 27, column 3]\n " shape="box"] "blockReleaseNoLeak#My_manager#[in.d6f2b8011ad550e7_9" -> "blockReleaseNoLeak#My_manager#[in.d6f2b8011ad550e7_6" ; "blockReleaseNoLeak#My_manager#[in.d6f2b8011ad550e7_9" -> "blockReleaseNoLeak#My_manager#[in.d6f2b8011ad550e7_7" ; -"blockReleaseNoLeak#My_manager#[in.d6f2b8011ad550e7_10" [label="10: Compound statement \n n$9=*&newImage:CGImage* [line 23, column 7]\n *&b:_fn_(*)=(_fun_objc_block_block_release.m:23,([by value]n$9 &newImage:CGImage*)) [line 23, column 3]\n n$15=*&b:_fn_(*) [line 23, column 3]\n " shape="box"] +"blockReleaseNoLeak#My_manager#[in.d6f2b8011ad550e7_10" [label="10: Compound statement \n n$9=*&newImage:CGImage* [line 23, column 7]\n *&b:(_fn_ [int] -> void)(*)=(_fun_objc_block_block_release.m:23,([by value]n$9 &newImage:CGImage*)) [line 23, column 3]\n n$15=*&b:(_fn_ [int] -> void)(*) [line 23, column 3]\n " shape="box"] "blockReleaseNoLeak#My_manager#[in.d6f2b8011ad550e7_10" -> "blockReleaseNoLeak#My_manager#[in.d6f2b8011ad550e7_9" ; diff --git a/infer/tests/codetoanalyze/objc/shared/npe/Nonnull_attribute_example.m.dot b/infer/tests/codetoanalyze/objc/shared/npe/Nonnull_attribute_example.m.dot index a84e4b3e916..cf1bcd9def9 100644 --- a/infer/tests/codetoanalyze/objc/shared/npe/Nonnull_attribute_example.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/npe/Nonnull_attribute_example.m.dot @@ -1,13 +1,13 @@ /* @generated */ digraph cfg { -"NonnullAtrributeTest.69a49728cf7d46ab_1" [label="1: Start NonnullAtrributeTest\nFormals: <_Nonnull> callback:_fn_(_Nonnull *)\nLocals: \n " color=yellow style=filled] +"NonnullAtrributeTest.69a49728cf7d46ab_1" [label="1: Start NonnullAtrributeTest\nFormals: <_Nonnull> callback:(_fn_ [NSError*,objc_object*] -> void)(_Nonnull *)\nLocals: \n " color=yellow style=filled] "NonnullAtrributeTest.69a49728cf7d46ab_1" -> "NonnullAtrributeTest.69a49728cf7d46ab_3" ; "NonnullAtrributeTest.69a49728cf7d46ab_2" [label="2: Exit NonnullAtrributeTest \n " color=yellow style=filled] -"NonnullAtrributeTest.69a49728cf7d46ab_3" [label="3: Call n$0 \n n$0=*&callback:_fn_(_Nonnull *) [line 45, column 3]\n n$1=_fun___call_objc_block(n$0:_fn_,null:NSError*,null:objc_object*) objc_block [line 45, column 3]\n " shape="box"] +"NonnullAtrributeTest.69a49728cf7d46ab_3" [label="3: Call n$0 \n n$0=*&callback:(_fn_ [NSError*,objc_object*] -> void)(_Nonnull *) [line 45, column 3]\n n$1=_fun___call_objc_block(n$0:_fn_,null:NSError*,null:objc_object*) objc_block [line 45, column 3]\n " shape="box"] "NonnullAtrributeTest.69a49728cf7d46ab_3" -> "NonnullAtrributeTest.69a49728cf7d46ab_2" ;