diff --git a/infer/src/IR/BUILTINS.ml b/infer/src/IR/BUILTINS.ml index 2b1218099..49fede7b5 100644 --- a/infer/src/IR/BUILTINS.ml +++ b/infer/src/IR/BUILTINS.ml @@ -67,14 +67,8 @@ module type S = sig val __objc_dictionary_literal : t - val __objc_release : t - - val __objc_release_autorelease_pool : t - val __objc_release_cf : t - val __objc_retain : t - val __objc_retain_cf : t val __placement_delete : t @@ -87,8 +81,6 @@ module type S = sig val __set_array_length : t - val __set_autorelease_attribute : t - val __set_file_attribute : t val __set_hidden_field : t diff --git a/infer/src/backend/BuiltinDefn.ml b/infer/src/backend/BuiltinDefn.ml index dc00e0090..ad6e7b797 100644 --- a/infer/src/backend/BuiltinDefn.ml +++ b/infer/src/backend/BuiltinDefn.ml @@ -17,8 +17,6 @@ module F = Format type t = Builtin.registered -let execute___no_op prop path : Builtin.ret_typ = [(prop, path)] - (** model va_arg as always returning 0 *) let execute___builtin_va_arg {Builtin.pdesc; tenv; prop_; path; ret_id; args; loc} : Builtin.ret_typ = @@ -544,11 +542,6 @@ let execute___objc_retain_impl ({Builtin.tenv; prop_; args; ret_id} as builtin_a raise (Exceptions.Wrong_argument_number __POS__) -let execute___objc_retain builtin_args : Builtin.ret_typ = - if Config.objc_memory_model_on then execute___objc_retain_impl builtin_args - else execute___no_op builtin_args.Builtin.prop_ builtin_args.Builtin.path - - let execute___objc_retain_cf builtin_args : Builtin.ret_typ = execute___objc_retain_impl builtin_args @@ -559,61 +552,10 @@ let execute___objc_release_impl ({Builtin.args} as builtin_args) : Builtin.ret_t {builtin_args with Builtin.args= args'} -let execute___objc_release builtin_args : Builtin.ret_typ = - if Config.objc_memory_model_on then execute___objc_release_impl builtin_args - else execute___no_op builtin_args.Builtin.prop_ builtin_args.Builtin.path - - let execute___objc_release_cf builtin_args : Builtin.ret_typ = execute___objc_release_impl builtin_args -(** Set the attibute of the value as objc autoreleased *) -let execute___set_autorelease_attribute {Builtin.tenv; pdesc; prop_; path; ret_id; args} - : Builtin.ret_typ = - match (args, ret_id) with - | [(lexp, _)], _ -> - let pname = Procdesc.get_proc_name pdesc in - let prop = return_result tenv lexp prop_ ret_id in - if Config.objc_memory_model_on then - let n_lexp, prop = check_arith_norm_exp tenv pname lexp prop in - let prop' = Attribute.add_or_replace tenv prop (Apred (Aautorelease, [n_lexp])) in - [(prop', path)] - else execute___no_op prop path - | _ -> - raise (Exceptions.Wrong_argument_number __POS__) - - -(** Release all the objects in the pool *) -let execute___release_autorelease_pool ({Builtin.tenv; prop_; path} as builtin_args) - : Builtin.ret_typ = - if Config.objc_memory_model_on then - let autoreleased_objects = Attribute.get_for_symb prop_ Aautorelease in - let prop_without_attribute = Attribute.remove_for_attr tenv prop_ Aautorelease in - let call_release res atom = - match (res, atom) with - | (prop', path') :: _, Sil.Apred (_, exp :: _) -> - List.find - ~f:(function Sil.Hpointsto (e1, _, _) -> Exp.equal e1 exp | _ -> false) - prop_.Prop.sigma - |> Option.value_map - ~f:(function - | Sil.Hpointsto (_, _, Exp.Sizeof {typ}) -> - let res1 = - execute___objc_release - {builtin_args with Builtin.args= [(exp, typ)]; prop_= prop'; path= path'} - in - res1 - | _ -> - res) - ~default:res - | _ -> - res - in - List.fold ~f:call_release ~init:[(prop_without_attribute, path)] autoreleased_objects - else execute___no_op prop_ path - - let set_attr tenv pdesc prop path exp attr = let pname = Procdesc.get_proc_name pdesc in let n_lexp, prop = check_arith_norm_exp tenv pname exp prop in @@ -1151,17 +1093,8 @@ let __objc_cast = Builtin.register BuiltinDecl.__objc_cast execute___objc_cast let __objc_dictionary_literal = Builtin.register BuiltinDecl.__objc_dictionary_literal execute___objc_dictionary_literal - -let __objc_release = Builtin.register BuiltinDecl.__objc_release execute___objc_release - -let __objc_release_autorelease_pool = - Builtin.register BuiltinDecl.__objc_release_autorelease_pool execute___release_autorelease_pool - - let __objc_release_cf = Builtin.register BuiltinDecl.__objc_release_cf execute___objc_release_cf -let __objc_retain = Builtin.register BuiltinDecl.__objc_retain execute___objc_retain - let __objc_retain_cf = Builtin.register BuiltinDecl.__objc_retain_cf execute___objc_retain_cf let __placement_delete = Builtin.register BuiltinDecl.__placement_delete execute_skip @@ -1175,13 +1108,8 @@ let __print_value = Builtin.register BuiltinDecl.__print_value execute___print_v let __require_allocated_array = Builtin.register BuiltinDecl.__require_allocated_array execute___require_allocated_array - let __set_array_length = Builtin.register BuiltinDecl.__set_array_length execute___set_array_length -let __set_autorelease_attribute = - Builtin.register BuiltinDecl.__set_autorelease_attribute execute___set_autorelease_attribute - - let __set_file_attribute = Builtin.register BuiltinDecl.__set_file_attribute execute___set_file_attribute diff --git a/infer/src/clang/cArithmetic_trans.ml b/infer/src/clang/cArithmetic_trans.ml index f1a944cf9..ed258d71d 100644 --- a/infer/src/clang/cArithmetic_trans.ml +++ b/infer/src/clang/cArithmetic_trans.ml @@ -12,48 +12,6 @@ open! IStd module L = Logging -(* Returns the translation of assignment when ARC mode is enabled in Obj-C *) -(* For __weak and __unsafe_unretained the translation is the same as non-ARC *) -(* (this is because, in these cases, there is no change in the reference counter *) -(* of the pointee).*) -(* The difference is when the lvalue is a __strong or __autoreleasing. In those*) -(* case we need to add proper retain/release.*) -(* See document: "Objective-C Automatic Reference Counting" describing the semantics *) -let assignment_arc_mode e1 typ e2 loc rhs_owning_method is_e1_decl = - let assign = Sil.Store (e1, typ, e2, loc) in - let retain_pname = BuiltinDecl.__objc_retain in - let release_pname = BuiltinDecl.__objc_release in - let autorelease_pname = BuiltinDecl.__set_autorelease_attribute in - let mk_call procname e t = - let bi_retain = Exp.Const (Const.Cfun procname) in - Sil.Call (None, bi_retain, [(e, t)], loc, CallFlags.default) - in - match typ.Typ.desc with - | Typ.Tptr (_, Typ.Pk_pointer) when not rhs_owning_method && not is_e1_decl -> - (* for __strong e1 = e2 the semantics is*) - (* retain(e2); tmp=e1; e1=e2; release(tmp); *) - let retain = mk_call retain_pname e2 typ in - let id = Ident.create_fresh Ident.knormal in - let tmp_assign = Sil.Load (id, e1, typ, loc) in - let release = mk_call release_pname (Exp.Var id) typ in - (e1, [retain; tmp_assign; assign; release]) - | Typ.Tptr (_, Typ.Pk_pointer) when not rhs_owning_method && is_e1_decl -> - (* for A __strong *e1 = e2 the semantics is*) - (* retain(e2); e1=e2; *) - let retain = mk_call retain_pname e2 typ in - (e1, [retain; assign]) - | Typ.Tptr (_, Typ.Pk_objc_weak) | Typ.Tptr (_, Typ.Pk_objc_unsafe_unretained) -> - (e1, [assign]) - | Typ.Tptr (_, Typ.Pk_objc_autoreleasing) -> - (* for __autoreleasing e1 = e2 the semantics is*) - (* retain(e2); autorelease(e2); e1=e2; *) - let retain = mk_call retain_pname e2 typ in - let autorelease = mk_call autorelease_pname e2 typ in - (e1, [retain; autorelease; assign]) - | _ -> - (e1, [assign]) - - (* Returns a pair ([binary_expression], instructions) for binary operator representing a *) (* CompoundAssignment. "binary_expression" is returned when we are calculating an expression*) (* "instructions" is not empty when the binary operator is actually a statement like an *) @@ -103,7 +61,7 @@ let compound_assignment_binary_operation_instruction boi e1 typ e2 loc = (* is returned when we are calculating an expression "instructions" is not *) (* empty when the binary operator is actually a statement like an *) (* assignment. *) -let binary_operation_instruction boi e1 typ e2 loc rhs_owning_method = +let binary_operation_instruction boi e1 typ e2 loc = let binop_exp op = Exp.BinOp (op, e1, e2) in match boi.Clang_ast_t.boi_kind with | `Add -> @@ -143,9 +101,7 @@ let binary_operation_instruction boi e1 typ e2 loc rhs_owning_method = | `LOr -> (binop_exp Binop.LOr, []) | `Assign -> - if !Config.arc_mode && ObjcInterface_decl.is_pointer_to_objc_class typ then - assignment_arc_mode e1 typ e2 loc rhs_owning_method false - else (e1, [Sil.Store (e1, typ, e2, loc)]) + (e1, [Sil.Store (e1, typ, e2, loc)]) | `Comma -> (e2, []) (* C99 6.5.17-2 *) | `MulAssign @@ -292,4 +248,3 @@ let sil_const_plus_one const = Exp.Const (Const.Cint (IntLit.add n IntLit.one)) | _ -> Exp.BinOp (Binop.PlusA, const, Exp.Const (Const.Cint IntLit.one)) - diff --git a/infer/src/clang/cArithmetic_trans.mli b/infer/src/clang/cArithmetic_trans.mli index 51ad13109..28b6aa5fa 100644 --- a/infer/src/clang/cArithmetic_trans.mli +++ b/infer/src/clang/cArithmetic_trans.mli @@ -14,14 +14,11 @@ open! IStd val bin_op_to_string : Clang_ast_t.binary_operator_info -> string val binary_operation_instruction : - Clang_ast_t.binary_operator_info -> Exp.t -> Typ.t -> Exp.t -> Location.t -> bool + Clang_ast_t.binary_operator_info -> Exp.t -> Typ.t -> Exp.t -> Location.t -> Exp.t * Sil.instr list val unary_operation_instruction : CFrontend_config.translation_unit_context -> Clang_ast_t.unary_operator_info -> Exp.t -> Typ.t -> Location.t -> Exp.t * Sil.instr list -val assignment_arc_mode : - Exp.t -> Typ.t -> Exp.t -> Location.t -> bool -> bool -> Exp.t * Sil.instr list - val sil_const_plus_one : Exp.t -> Exp.t diff --git a/infer/src/clang/cTrans.ml b/infer/src/clang/cTrans.ml index 1d1ac5cb4..72d79a645 100644 --- a/infer/src/clang/cTrans.ml +++ b/infer/src/clang/cTrans.ml @@ -76,21 +76,6 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s (proc_name, mc_type) - let add_autorelease_call context exp typ sil_loc = - let method_name = Typ.Procname.get_method (Procdesc.get_proc_name context.CContext.procdesc) in - if !Config.arc_mode && not (CTrans_utils.is_owning_name method_name) - && ObjcInterface_decl.is_pointer_to_objc_class typ - then - let fname = BuiltinDecl.__set_autorelease_attribute in - let ret_id = Some (Ident.create_fresh Ident.knormal, Typ.mk Typ.Tvoid) in - (* TODO(jjb): change ret_id to None? *) - let stmt_call = - Sil.Call (ret_id, Exp.Const (Const.Cfun fname), [(exp, typ)], sil_loc, CallFlags.default) - in - [stmt_call] - else [] - - let rec is_block_expr s = let open Clang_ast_t in match s with @@ -973,7 +958,6 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s match stmt_list with | [s1; s2] -> (* Assumption: We expect precisely 2 stmt corresponding to the 2 operands*) - let rhs_owning_method = CTrans_utils.is_owning_method s2 in (* NOTE: we create a node only if required. In that case this node *) (* becomes the successor of the nodes that may be created when *) (* translating the operands. *) @@ -998,7 +982,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s else let exp_op, instr_bin = CArithmetic_trans.binary_operation_instruction binary_operator_info var_exp typ - sil_e2 sil_loc rhs_owning_method + sil_e2 sil_loc in (* Create a node if the priority if free and there are instructions *) let creating_node = @@ -2310,22 +2294,9 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s extract_exp_from_list res_trans_ie.exps "WARNING: In DeclStmt we expect only one expression returned in recursive call@\n" in - let rhs_owning_method = CTrans_utils.is_owning_method ie in let _, instrs_assign = (* variable might be initialized already - do nothing in that case*) if List.exists ~f:(Exp.equal var_exp) res_trans_ie.initd_exps then ([], []) - else if !Config.arc_mode - && ( CTrans_utils.is_method_call ie - || ObjcInterface_decl.is_pointer_to_objc_class ie_typ ) - then - (* In arc mode, if it's a method call or we are initializing - with a pointer to objc class *) - (* we need to add retain/release *) - let e, instrs = - CArithmetic_trans.assignment_arc_mode var_exp ie_typ sil_e1' sil_loc - rhs_owning_method true - in - ([(e, ie_typ)], instrs) else ([], [Sil.Store (var_exp, ie_typ, sil_e1', sil_loc)]) in let res_trans_assign = {empty_res_trans with instrs= instrs_assign} in @@ -2608,8 +2579,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s if List.exists ~f:(Exp.equal ret_exp) res_trans_stmt.initd_exps then [] else [Sil.Store (ret_exp, ret_type, sil_expr, sil_loc)] in - let autorelease_instrs = add_autorelease_call context sil_expr ret_type sil_loc in - let instrs = var_instrs @ res_trans_stmt.instrs @ ret_instrs @ autorelease_instrs in + let instrs = var_instrs @ res_trans_stmt.instrs @ ret_instrs in let ret_node = mk_ret_node instrs in List.iter ~f:(fun n -> Procdesc.node_set_succs_exn procdesc n [ret_node] []) @@ -2707,27 +2677,6 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s instruction trans_state message_stmt - (** When objects are autoreleased, they get added a flag AUTORELEASE. All these objects will be - ignored when checking for memory leaks. When the end of the block autoreleasepool is reached, - then those objects are released and the autorelease flag is removed. *) - and objcAutoreleasePool_trans trans_state stmt_info stmts = - let context = trans_state.context in - let sil_loc = CLocation.get_sil_location stmt_info context in - let fname = BuiltinDecl.__objc_release_autorelease_pool in - let ret_id = Some (Ident.create_fresh Ident.knormal, Typ.mk Tvoid) in - (* TODO(jjb): change ret_id to None? *) - let autorelease_pool_vars = CVar_decl.compute_autorelease_pool_vars context stmts in - let stmt_call = - Sil.Call - (ret_id, Exp.Const (Const.Cfun fname), autorelease_pool_vars, sil_loc, CallFlags.default) - in - let node_kind = Procdesc.Node.Stmt_node "Release the autorelease pool" in - let call_node = create_node node_kind [stmt_call] sil_loc context in - Procdesc.node_set_succs_exn context.procdesc call_node trans_state.succ_nodes [] ; - let trans_state' = {trans_state with continuation= None; succ_nodes= [call_node]} in - instructions trans_state' stmts - - (* Assumption: stmt_list contains 2 items, the first can be ObjCMessageExpr or ParenExpr *) (* We ignore this item since we don't deal with the concurrency problem yet *) (* For the same reason we also ignore the stmt_info that @@ -3338,7 +3287,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s | BlockExpr (stmt_info, _, expr_info, decl) -> blockExpr_trans trans_state stmt_info expr_info decl | ObjCAutoreleasePoolStmt (stmt_info, stmts) -> - objcAutoreleasePool_trans trans_state stmt_info stmts + compoundStmt_trans trans_state stmt_info stmts | ObjCAtTryStmt (stmt_info, stmts) -> compoundStmt_trans trans_state stmt_info stmts | CXXTryStmt (stmt_info, stmts) -> diff --git a/infer/src/clang/cTrans_models.ml b/infer/src/clang/cTrans_models.ml index 10c243af3..cc6f0d222 100644 --- a/infer/src/clang/cTrans_models.ml +++ b/infer/src/clang/cTrans_models.ml @@ -57,19 +57,6 @@ let is_release_predefined_model typ pname = || Core_foundation_model.is_core_graphics_release typ funct -let is_retain_method funct = String.equal funct CFrontend_config.retain - -let is_release_method funct = String.equal funct CFrontend_config.release - -let is_autorelease_method funct = String.equal funct CFrontend_config.autorelease - -let get_builtinname method_name = - if is_retain_method method_name then Some BuiltinDecl.__objc_retain - else if is_autorelease_method method_name then Some BuiltinDecl.__set_autorelease_attribute - else if is_release_method method_name then Some BuiltinDecl.__objc_release - else None - - let is_modeled_builtin funct = String.equal funct CFrontend_config.builtin_memset_chk let is_modeled_attribute attr_name = @@ -120,10 +107,6 @@ let is_handleFailureInMethod funct = || String.equal funct CFrontend_config.handleFailureInFunction -let is_retain_or_release funct = - is_retain_method funct || is_release_method funct || is_autorelease_method funct - - let is_toll_free_bridging pn = let funct = Typ.Procname.to_string pn in String.equal funct CFrontend_config.cf_bridging_release @@ -183,44 +166,6 @@ let get_predefined_ms_stringWithUTF8String class_name method_name mk_procname la mk_procname lang args id_type [] None -let get_predefined_ms_retain_release method_name mk_procname lang = - let condition = is_retain_or_release method_name in - let return_type = - if is_retain_method method_name || is_autorelease_method method_name then - Ast_expressions.create_id_type - else Ast_expressions.create_void_type - in - let class_typename = Typ.Name.Objc.from_string CFrontend_config.nsobject_cl in - let class_type = Ast_expressions.create_class_qual_type class_typename in - let args = [(Mangled.from_string CFrontend_config.self, class_type)] in - get_predefined_ms_method condition class_typename method_name Typ.Procname.ObjCInstanceMethod - mk_procname lang args return_type [] (get_builtinname method_name) - - -let get_predefined_ms_autoreleasepool_init class_name method_name mk_procname lang = - let condition = - String.equal method_name CFrontend_config.init - && class_equal class_name CFrontend_config.nsautorelease_pool_cl - in - let class_type = Ast_expressions.create_class_qual_type class_name in - get_predefined_ms_method condition class_name method_name Typ.Procname.ObjCInstanceMethod - mk_procname lang [(Mangled.from_string CFrontend_config.self, class_type)] - Ast_expressions.create_void_type [] None - - -let get_predefined_ms_nsautoreleasepool_release class_name method_name mk_procname lang = - let condition = - ( String.equal method_name CFrontend_config.release - || String.equal method_name CFrontend_config.drain ) - && class_equal class_name CFrontend_config.nsautorelease_pool_cl - in - let class_type = Ast_expressions.create_class_qual_type class_name in - let args = [(Mangled.from_string CFrontend_config.self, class_type)] in - get_predefined_ms_method condition class_name method_name Typ.Procname.ObjCInstanceMethod - mk_procname lang args Ast_expressions.create_void_type [] - (Some BuiltinDecl.__objc_release_autorelease_pool) - - let get_predefined_ms_is_kind_of_class class_name method_name mk_procname lang = let condition = String.equal method_name CFrontend_config.is_kind_of_class in let class_type = Ast_expressions.create_class_qual_type class_name in @@ -231,10 +176,7 @@ let get_predefined_ms_is_kind_of_class class_name method_name mk_procname lang = let get_predefined_model_method_signature class_name method_name mk_procname lang = let next_predefined f = function Some _ as x -> x | None -> f method_name mk_procname lang in - get_predefined_ms_nsautoreleasepool_release class_name method_name mk_procname lang - |> next_predefined get_predefined_ms_retain_release - |> next_predefined (get_predefined_ms_stringWithUTF8String class_name) - |> next_predefined (get_predefined_ms_autoreleasepool_init class_name) + None |> next_predefined (get_predefined_ms_stringWithUTF8String class_name) |> next_predefined (get_predefined_ms_is_kind_of_class class_name) diff --git a/infer/src/clang/cTrans_utils.ml b/infer/src/clang/cTrans_utils.ml index a86d36899..114c9cdce 100644 --- a/infer/src/clang/cTrans_utils.ml +++ b/infer/src/clang/cTrans_utils.ml @@ -724,44 +724,6 @@ module Self = struct end -(* From the manual: A selector is in a certain selector family if, ignoring any leading underscores, *) -(* the first component of the selector either consists entirely of the name of *) -(* the method family or it begins with that followed by character other than lower case letter.*) -(* For example: '__perform:with' and 'performWith:' would fall into the 'perform' family (if we had one),*) -(* but 'performing:with' would not. *) -let is_owning_name n = - let is_family fam s' = - if String.length s' < String.length fam then false - else - let prefix = Str.string_before s' (String.length fam) in - let suffix = Str.string_after s' (String.length fam) in - String.equal prefix fam && not (Str.string_match (Str.regexp "[a-z]") suffix 0) - in - match Str.split (Str.regexp_string ":") n with - | fst :: _ -> ( - match Str.split (Str.regexp "['_']+") fst with - | [no_und] | _ :: no_und :: _ -> - is_family CFrontend_config.alloc no_und || is_family CFrontend_config.copy no_und - || is_family CFrontend_config.new_str no_und - || is_family CFrontend_config.mutableCopy no_und || is_family CFrontend_config.init no_und - | _ -> - assert false ) - | _ -> - assert false - - -let rec is_owning_method s = - match s with - | Clang_ast_t.ObjCMessageExpr (_, _, _, mei) -> - is_owning_name mei.Clang_ast_t.omei_selector - | _ -> - match snd (Clang_ast_proj.get_stmt_tuple s) with - | [] -> - false - | s'' :: _ -> - is_owning_method s'' - - let rec is_method_call s = match s with | Clang_ast_t.ObjCMessageExpr _ -> diff --git a/infer/src/clang/cTrans_utils.mli b/infer/src/clang/cTrans_utils.mli index bc7d99a59..d6578c429 100644 --- a/infer/src/clang/cTrans_utils.mli +++ b/infer/src/clang/cTrans_utils.mli @@ -81,10 +81,6 @@ val cast_operation : val trans_assertion : trans_state -> Location.t -> trans_result -val is_owning_method : Clang_ast_t.stmt -> bool - -val is_owning_name : string -> bool - val is_method_call : Clang_ast_t.stmt -> bool val contains_opaque_value_expr : Clang_ast_t.stmt -> bool diff --git a/infer/tests/codetoanalyze/objc/errors/Makefile b/infer/tests/codetoanalyze/objc/errors/Makefile index d4bd3b86c..8d43ed679 100644 --- a/infer/tests/codetoanalyze/objc/errors/Makefile +++ b/infer/tests/codetoanalyze/objc/errors/Makefile @@ -24,7 +24,6 @@ INFERPRINT_OPTIONS = --issues-tests SOURCES_DEFAULT = \ field_superclass/B.m \ memory_leaks_benchmark/MemoryLeakRaii.m \ - memory_leaks_benchmark/NSMakeCollectableExample.m \ memory_leaks_benchmark/NSString_models_tests.m \ memory_leaks_benchmark/NSData_models_tests.m \ memory_leaks_benchmark/RetainReleaseExampleBucketing.m \ @@ -80,7 +79,6 @@ SOURCES_BUCKET_ALL = \ shared/block/dispatch_in_macro.m \ shared/category_procdesc/main.c \ shared/field_superclass/SuperExample.m \ - shared/memory_leaks_benchmark/RetainReleaseExample2.m \ shared/npe/npe_malloc.m \ warnings/ParameterNotNullableExample.m \ diff --git a/infer/tests/codetoanalyze/objc/errors/issues.exp b/infer/tests/codetoanalyze/objc/errors/issues.exp index a4112d32c..a7579d759 100644 --- a/infer/tests/codetoanalyze/objc/errors/issues.exp +++ b/infer/tests/codetoanalyze/objc/errors/issues.exp @@ -6,7 +6,7 @@ codetoanalyze/objc/errors/memory_leaks_benchmark/CADisplayLinkRetainCycle.m, tes codetoanalyze/objc/errors/memory_leaks_benchmark/RetainCycleStaticVar.m, RetainCSVycleStaticVar, 2, RETAIN_CYCLE, [start of procedure RetainCSVycleStaticVar(),start of procedure init,return from a call to RetainCSV_init,start of procedure foo,start of procedure block,start of procedure init,return from a call to RetainCSV_init,return from a call to __objc_anonymous_block_RetainCSV_foo______3,start of procedure block,start of procedure init,return from a call to RetainCSV_init,return from a call to __objc_anonymous_block_RetainCSV_foo______2,return from a call to RetainCSV_foo] codetoanalyze/objc/errors/npe/blockenum.m, BlockEnumA_allResultsList:, 1, MEMORY_LEAK, [start of procedure allResultsList:,Skipping init: function or method not found] codetoanalyze/objc/errors/npe/blockenum.m, BlockEnumA_foo1:, 2, MEMORY_LEAK, [start of procedure foo1:,Skipping init: function or method not found] -codetoanalyze/objc/errors/npe/nil_param.m, NilParamMain, 4, MEMORY_LEAK, [start of procedure NilParamMain(),start of procedure test1:,Message test2 with receiver nil returns nil.,return from a call to NilParamA_test1:] +codetoanalyze/objc/errors/npe/nil_param.m, NilParamMain, 4, MEMORY_LEAK, [start of procedure NilParamMain(),start of procedure test1:,Message test2 with receiver nil returns nil.,return from a call to NilParamA_test1:,Skipping release: function or method not found] codetoanalyze/objc/errors/npe/null_returned_by_method.m, NullReturnedByMethodA_test1, 1, NULL_DEREFERENCE, [start of procedure test1,start of procedure test,return from a call to NullReturnedByMethodA_test] codetoanalyze/objc/errors/procdescs/main.c, ProcdescMain, 2, MEMORY_LEAK, [start of procedure ProcdescMain(),Skipping plusX:andY:: function or method not found] codetoanalyze/objc/errors/procdescs/main.c, ProcdescMain, 3, MEMORY_LEAK, [start of procedure ProcdescMain(),Skipping plusX:andY:: function or method not found] @@ -36,10 +36,6 @@ codetoanalyze/objc/shared/category_procdesc/main.c, CategoryProcdescMain, 2, MEM codetoanalyze/objc/shared/category_procdesc/main.c, CategoryProcdescMain, 3, MEMORY_LEAK, [start of procedure CategoryProcdescMain(),Skipping performDaysWork: function or method not found] codetoanalyze/objc/shared/field_superclass/SuperExample.m, ASuper_init, 2, NULL_DEREFERENCE, [start of procedure init,start of procedure init,return from a call to BSuper_init] codetoanalyze/objc/shared/field_superclass/SuperExample.m, super_example_main, 2, MEMORY_LEAK, [start of procedure super_example_main(),Skipping init: function or method not found] -codetoanalyze/objc/shared/memory_leaks_benchmark/RetainReleaseExample2.m, test3, 0, MEMORY_LEAK, [start of procedure test3(),start of procedure retain_release2_test(),start of procedure init,return from a call to RR2_init,return from a call to retain_release2_test] -codetoanalyze/objc/shared/memory_leaks_benchmark/RetainReleaseExample2.m, test4, 3, MEMORY_LEAK, [start of procedure test4(),start of procedure retain_release2_test(),start of procedure init,return from a call to RR2_init,return from a call to retain_release2_test] -codetoanalyze/objc/shared/memory_leaks_benchmark/RetainReleaseExample2.m, test5, 2, MEMORY_LEAK, [start of procedure test5(),start of procedure init,return from a call to RR2_init] -codetoanalyze/objc/shared/memory_leaks_benchmark/RetainReleaseExample2.m, test6, 3, MEMORY_LEAK, [start of procedure test6(),start of procedure init,return from a call to RR2_init] codetoanalyze/objc/errors/field_superclass/SubtypingExample.m, Employee_initWithName:andAge:andEducation:, 3, NULL_TEST_AFTER_DEREFERENCE, [start of procedure initWithName:andAge:andEducation:,start of procedure initWithName:andAge:,return from a call to Person_initWithName:andAge:,Condition is false] codetoanalyze/objc/errors/field_superclass/SubtypingExample.m, Employee_initWithName:andAge:andEducation:, 6, DIVIDE_BY_ZERO, [start of procedure initWithName:andAge:andEducation:,start of procedure initWithName:andAge:,return from a call to Person_initWithName:andAge:,Condition is true] codetoanalyze/objc/errors/field_superclass/SubtypingExample.m, subtyping_test, 0, DIVIDE_BY_ZERO, [start of procedure subtyping_test(),start of procedure testFields(),start of procedure setEmployeeEducation:,return from a call to Employee_setEmployeeEducation:,start of procedure setAge:,return from a call to Person_setAge:,start of procedure setEmployeeEducation:,return from a call to Employee_setEmployeeEducation:,start of procedure getAge,return from a call to Person_getAge,return from a call to testFields] @@ -105,6 +101,7 @@ codetoanalyze/objc/errors/npe/ivar_blocks.m, MyClass_ivar_npe, 1, IVAR_NOT_NULL_ codetoanalyze/objc/errors/npe/skip_method_with_nil_object.m, SkipMethodNilA_testBug:, 6, PARAMETER_NOT_NULL_CHECKED, [start of procedure testBug:,Message get_a with receiver nil returns nil.,Message skip_method with receiver nil returns nil.,Condition is false] codetoanalyze/objc/errors/property/main.c, property_main, 3, MEMORY_LEAK, [start of procedure property_main(),Skipping aProperty: function or method not found] codetoanalyze/objc/errors/resource_leaks/Dispatch_sources.m, __objc_anonymous_block_ProcessContentsOfFile______2, 6, MEMORY_LEAK, [start of procedure block,Skipping dispatch_source_get_data(): function or method not found,Condition is true,Skipping MyProcessFileData(): function or method not found] +codetoanalyze/objc/errors/resource_leaks/ResourceLeakExample.m, NSFileHandle_fileHandleForLoggingAtPath:mode:, 9, RESOURCE_LEAK, [start of procedure fileHandleForLoggingAtPath:mode:,Condition is true,Skipping fileSystemRepresentation: function or method not found,Condition is false,Condition is true,Skipping autorelease: function or method not found] codetoanalyze/objc/shared/annotations/nonnull_annotations.m, A_test1:, 2, PARAMETER_NOT_NULL_CHECKED, [start of procedure test1:,Message child with receiver nil returns nil.] codetoanalyze/objc/shared/annotations/nonnull_annotations.m, A_test3:, 1, PARAMETER_NOT_NULL_CHECKED, [start of procedure test3:] codetoanalyze/objc/shared/annotations/nullable_annotations.m, User_otherUserName, 2, NULL_DEREFERENCE, [start of procedure otherUserName,Skipping otherUser: function or method not found] diff --git a/infer/tests/codetoanalyze/objc/errors/memory_leaks_benchmark/NSMakeCollectableExample.m b/infer/tests/codetoanalyze/objc/errors/memory_leaks_benchmark/NSMakeCollectableExample.m deleted file mode 100644 index 82b5a4e44..000000000 --- a/infer/tests/codetoanalyze/objc/errors/memory_leaks_benchmark/NSMakeCollectableExample.m +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2015 - 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 E : NSObject - -@end - -@implementation E - -- (CFReadStreamRef)readStream { - return nil; -} - -- (void)handleStreamError { - NSError* underlyingError = NSMakeCollectable([(NSError*)CFReadStreamCopyError( - (CFReadStreamRef)[self readStream]) autorelease]); -} - -@end diff --git a/infer/tests/codetoanalyze/objc/frontend/noarc/Makefile b/infer/tests/codetoanalyze/objc/frontend/noarc/Makefile index b74b3f4ea..a64080bf3 100644 --- a/infer/tests/codetoanalyze/objc/frontend/noarc/Makefile +++ b/infer/tests/codetoanalyze/objc/frontend/noarc/Makefile @@ -50,7 +50,6 @@ SOURCES = \ ../shared/memory_leaks_benchmark/AutoreleaseExample.m \ ../shared/memory_leaks_benchmark/MemoryLeakExample.m \ ../shared/memory_leaks_benchmark/RetainReleaseExample.m \ - ../shared/memory_leaks_benchmark/RetainReleaseExample2.m \ ../shared/memory_leaks_benchmark/TollBridgeExample.m \ ../shared/npe/npe_malloc.m \ ../shared/property/GetterExample.m \ diff --git a/infer/tests/codetoanalyze/objc/frontend/types/attributes.m.dot b/infer/tests/codetoanalyze/objc/frontend/types/attributes.m.dot index e884b4cfb..696debc40 100644 --- a/infer/tests/codetoanalyze/objc/frontend/types/attributes.m.dot +++ b/infer/tests/codetoanalyze/objc/frontend/types/attributes.m.dot @@ -11,35 +11,35 @@ digraph iCFG { "main.fad58de7366495db4650cfefac2fcd61_3" -> "main.fad58de7366495db4650cfefac2fcd61_2" ; -"main.fad58de7366495db4650cfefac2fcd61_4" [label="4: BinaryOperatorStmt: Assign \n n$0=*&aStdRef:A* [line 39, column 22]\n _fun___objc_retain(n$0:A*) [line 39, column 3]\n n$1=*&anUnsafeUnretRef:A* [line 39, column 3]\n *&anUnsafeUnretRef:A*=n$0 [line 39, column 3]\n _fun___objc_release(n$1:A*) [line 39, column 3]\n " shape="box"] +"main.fad58de7366495db4650cfefac2fcd61_4" [label="4: BinaryOperatorStmt: Assign \n n$0=*&aStdRef:A* [line 39, column 22]\n *&anUnsafeUnretRef:A*=n$0 [line 39, column 3]\n " shape="box"] "main.fad58de7366495db4650cfefac2fcd61_4" -> "main.fad58de7366495db4650cfefac2fcd61_3" ; -"main.fad58de7366495db4650cfefac2fcd61_5" [label="5: BinaryOperatorStmt: Assign \n n$2=*&aStdRef:A* [line 37, column 18]\n _fun___objc_retain(n$2:A*) [line 37, column 3]\n n$3=*&anAutoRelRef:A* [line 37, column 3]\n *&anAutoRelRef:A*=n$2 [line 37, column 3]\n _fun___objc_release(n$3:A*) [line 37, column 3]\n " shape="box"] +"main.fad58de7366495db4650cfefac2fcd61_5" [label="5: BinaryOperatorStmt: Assign \n n$1=*&aStdRef:A* [line 37, column 18]\n *&anAutoRelRef:A*=n$1 [line 37, column 3]\n " shape="box"] "main.fad58de7366495db4650cfefac2fcd61_5" -> "main.fad58de7366495db4650cfefac2fcd61_4" ; -"main.fad58de7366495db4650cfefac2fcd61_6" [label="6: BinaryOperatorStmt: Assign \n n$4=*&aStdRef:A* [line 35, column 14]\n _fun___objc_retain(n$4:A*) [line 35, column 3]\n n$5=*&aWeakRef:A* [line 35, column 3]\n *&aWeakRef:A*=n$4 [line 35, column 3]\n _fun___objc_release(n$5:A*) [line 35, column 3]\n " shape="box"] +"main.fad58de7366495db4650cfefac2fcd61_6" [label="6: BinaryOperatorStmt: Assign \n n$2=*&aStdRef:A* [line 35, column 14]\n *&aWeakRef:A*=n$2 [line 35, column 3]\n " shape="box"] "main.fad58de7366495db4650cfefac2fcd61_6" -> "main.fad58de7366495db4650cfefac2fcd61_5" ; -"main.fad58de7366495db4650cfefac2fcd61_7" [label="7: BinaryOperatorStmt: Assign \n _fun___objc_retain(null:A*) [line 33, column 3]\n n$6=*&aStrongRef:A* [line 33, column 3]\n *&aStrongRef:A*=null [line 33, column 3]\n _fun___objc_release(n$6:A*) [line 33, column 3]\n " shape="box"] +"main.fad58de7366495db4650cfefac2fcd61_7" [label="7: BinaryOperatorStmt: Assign \n *&aStrongRef:A*=null [line 33, column 3]\n " shape="box"] "main.fad58de7366495db4650cfefac2fcd61_7" -> "main.fad58de7366495db4650cfefac2fcd61_6" ; -"main.fad58de7366495db4650cfefac2fcd61_8" [label="8: BinaryOperatorStmt: Assign \n n$7=*&aStrongRef:A* [line 31, column 13]\n _fun___objc_retain(n$7:A*) [line 31, column 3]\n n$8=*&aStdRef:A* [line 31, column 3]\n *&aStdRef:A*=n$7 [line 31, column 3]\n _fun___objc_release(n$8:A*) [line 31, column 3]\n " shape="box"] +"main.fad58de7366495db4650cfefac2fcd61_8" [label="8: BinaryOperatorStmt: Assign \n n$3=*&aStrongRef:A* [line 31, column 13]\n *&aStdRef:A*=n$3 [line 31, column 3]\n " shape="box"] "main.fad58de7366495db4650cfefac2fcd61_8" -> "main.fad58de7366495db4650cfefac2fcd61_7" ; -"main.fad58de7366495db4650cfefac2fcd61_9" [label="9: BinaryOperatorStmt: Assign \n n$9=_fun___objc_alloc_no_fail(sizeof(t=A):unsigned long) [line 29, column 16]\n *&aStrongRef:A*=n$9 [line 29, column 3]\n " shape="box"] +"main.fad58de7366495db4650cfefac2fcd61_9" [label="9: BinaryOperatorStmt: Assign \n n$4=_fun___objc_alloc_no_fail(sizeof(t=A):unsigned long) [line 29, column 16]\n *&aStrongRef:A*=n$4 [line 29, column 3]\n " shape="box"] "main.fad58de7366495db4650cfefac2fcd61_9" -> "main.fad58de7366495db4650cfefac2fcd61_8" ; -"main.fad58de7366495db4650cfefac2fcd61_10" [label="10: DeclStmt \n _fun___objc_retain(null:A*) [line 26, column 3]\n *&aStdRef:A*=null [line 26, column 3]\n " shape="box"] +"main.fad58de7366495db4650cfefac2fcd61_10" [label="10: DeclStmt \n *&aStdRef:A*=null [line 26, column 3]\n " shape="box"] "main.fad58de7366495db4650cfefac2fcd61_10" -> "main.fad58de7366495db4650cfefac2fcd61_9" ; -"main.fad58de7366495db4650cfefac2fcd61_11" [label="11: DeclStmt \n _fun___objc_retain(null:A__autoreleasing *) [line 25, column 3]\n _fun___set_autorelease_attribute(null:A__autoreleasing *) [line 25, column 3]\n *&anAutoRelRef:A__autoreleasing *=null [line 25, column 3]\n " shape="box"] +"main.fad58de7366495db4650cfefac2fcd61_11" [label="11: DeclStmt \n *&anAutoRelRef:A__autoreleasing *=null [line 25, column 3]\n " shape="box"] "main.fad58de7366495db4650cfefac2fcd61_11" -> "main.fad58de7366495db4650cfefac2fcd61_10" ; @@ -47,7 +47,7 @@ digraph iCFG { "main.fad58de7366495db4650cfefac2fcd61_12" -> "main.fad58de7366495db4650cfefac2fcd61_11" ; -"main.fad58de7366495db4650cfefac2fcd61_13" [label="13: DeclStmt \n _fun___objc_retain(null:A*) [line 23, column 3]\n *&aStrongRef:A*=null [line 23, column 3]\n " shape="box"] +"main.fad58de7366495db4650cfefac2fcd61_13" [label="13: DeclStmt \n *&aStrongRef:A*=null [line 23, column 3]\n " shape="box"] "main.fad58de7366495db4650cfefac2fcd61_13" -> "main.fad58de7366495db4650cfefac2fcd61_12" ; diff --git a/infer/tests/codetoanalyze/objc/frontend/vardecl/initlist.m.dot b/infer/tests/codetoanalyze/objc/frontend/vardecl/initlist.m.dot index 1d52efc96..5c2bf0eff 100644 --- a/infer/tests/codetoanalyze/objc/frontend/vardecl/initlist.m.dot +++ b/infer/tests/codetoanalyze/objc/frontend/vardecl/initlist.m.dot @@ -18,7 +18,7 @@ digraph iCFG { "test.098f6bcd4621d373cade4e832627b4f6_2" [label="2: Exit test \n " color=yellow style=filled] -"test.098f6bcd4621d373cade4e832627b4f6_3" [label="3: DeclStmt \n n$0=*&c1:C* [line 25, column 15]\n n$1=_fun_NSObject_init(n$0:C*) virtual [line 25, column 14]\n *&a[0]:C*=n$1 [line 25, column 13]\n n$2=*&c1:C* [line 25, column 25]\n _fun___objc_retain(n$2:C*) [line 25, column 13]\n *&a[1]:C*=n$2 [line 25, column 13]\n n$3=*&c2:C* [line 25, column 29]\n _fun___objc_retain(n$3:C*) [line 25, column 13]\n *&a[2]:C*=n$3 [line 25, column 13]\n " shape="box"] +"test.098f6bcd4621d373cade4e832627b4f6_3" [label="3: DeclStmt \n n$0=*&c1:C* [line 25, column 15]\n n$1=_fun_NSObject_init(n$0:C*) virtual [line 25, column 14]\n *&a[0]:C*=n$1 [line 25, column 13]\n n$2=*&c1:C* [line 25, column 25]\n *&a[1]:C*=n$2 [line 25, column 13]\n n$3=*&c2:C* [line 25, column 29]\n *&a[2]:C*=n$3 [line 25, column 13]\n " shape="box"] "test.098f6bcd4621d373cade4e832627b4f6_3" -> "test.098f6bcd4621d373cade4e832627b4f6_2" ; diff --git a/infer/tests/codetoanalyze/objc/shared/field_superclass/SuperExample.m.dot b/infer/tests/codetoanalyze/objc/shared/field_superclass/SuperExample.m.dot index c17c4b604..792f9f038 100644 --- a/infer/tests/codetoanalyze/objc/shared/field_superclass/SuperExample.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/field_superclass/SuperExample.m.dot @@ -3,18 +3,14 @@ digraph iCFG { "super_example_main.e3ebe95e6c5ae811733f235c29fbbf6d_1" [label="1: Start super_example_main\nFormals: argc:int argv:char**\nLocals: a:objc_object* \n DECLARE_LOCALS(&return,&a); [line 40, column 1]\n " color=yellow style=filled] - "super_example_main.e3ebe95e6c5ae811733f235c29fbbf6d_1" -> "super_example_main.e3ebe95e6c5ae811733f235c29fbbf6d_4" ; + "super_example_main.e3ebe95e6c5ae811733f235c29fbbf6d_1" -> "super_example_main.e3ebe95e6c5ae811733f235c29fbbf6d_3" ; "super_example_main.e3ebe95e6c5ae811733f235c29fbbf6d_2" [label="2: Exit super_example_main \n " color=yellow style=filled] -"super_example_main.e3ebe95e6c5ae811733f235c29fbbf6d_3" [label="3: Release the autorelease pool \n n$0=_fun___objc_release_autorelease_pool() [line 41, column 3]\n " shape="box"] +"super_example_main.e3ebe95e6c5ae811733f235c29fbbf6d_3" [label="3: DeclStmt \n n$0=_fun___objc_alloc_no_fail(sizeof(t=ASuper):unsigned long) [line 42, column 21]\n n$1=_fun_NSObject_init(n$0:ASuper*) virtual [line 42, column 21]\n *&a:objc_object*=n$1 [line 42, column 5]\n " shape="box"] "super_example_main.e3ebe95e6c5ae811733f235c29fbbf6d_3" -> "super_example_main.e3ebe95e6c5ae811733f235c29fbbf6d_2" ; -"super_example_main.e3ebe95e6c5ae811733f235c29fbbf6d_4" [label="4: DeclStmt \n n$1=_fun___objc_alloc_no_fail(sizeof(t=ASuper):unsigned long) [line 42, column 21]\n n$2=_fun_NSObject_init(n$1:ASuper*) virtual [line 42, column 21]\n *&a:objc_object*=n$2 [line 42, column 5]\n " shape="box"] - - - "super_example_main.e3ebe95e6c5ae811733f235c29fbbf6d_4" -> "super_example_main.e3ebe95e6c5ae811733f235c29fbbf6d_3" ; "init#ASuper#instance.9832dae2a83c036d9d82b45709c4855e_1" [label="1: Start ASuper_init\nFormals: self:ASuper*\nLocals: \n DECLARE_LOCALS(&return); [line 32, column 1]\n " color=yellow style=filled] diff --git a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/ArcExample.m.dot b/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/ArcExample.m.dot index 3cbea1e23..e144f7094 100644 --- a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/ArcExample.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/ArcExample.m.dot @@ -7,11 +7,11 @@ digraph iCFG { "getS#ArcA#instance.a6d142da8215d5903690f8a054289ac7_2" [label="2: Exit ArcA_getS \n " color=yellow style=filled] -"getS#ArcA#instance.a6d142da8215d5903690f8a054289ac7_3" [label="3: Return Stmt \n n$0=*&s:NSString* [line 24, column 10]\n *&return:NSString*=n$0 [line 24, column 3]\n n$1=_fun___set_autorelease_attribute(n$0:NSString*) [line 24, column 3]\n " shape="box"] +"getS#ArcA#instance.a6d142da8215d5903690f8a054289ac7_3" [label="3: Return Stmt \n n$0=*&s:NSString* [line 24, column 10]\n *&return:NSString*=n$0 [line 24, column 3]\n " shape="box"] "getS#ArcA#instance.a6d142da8215d5903690f8a054289ac7_3" -> "getS#ArcA#instance.a6d142da8215d5903690f8a054289ac7_2" ; -"getS#ArcA#instance.a6d142da8215d5903690f8a054289ac7_4" [label="4: DeclStmt \n n$2=_fun___objc_alloc_no_fail(sizeof(t=NSString):unsigned long) [line 23, column 17]\n *&s:NSString*=n$2 [line 23, column 3]\n " shape="box"] +"getS#ArcA#instance.a6d142da8215d5903690f8a054289ac7_4" [label="4: DeclStmt \n n$1=_fun___objc_alloc_no_fail(sizeof(t=NSString):unsigned long) [line 23, column 17]\n *&s:NSString*=n$1 [line 23, column 3]\n " shape="box"] "getS#ArcA#instance.a6d142da8215d5903690f8a054289ac7_4" -> "getS#ArcA#instance.a6d142da8215d5903690f8a054289ac7_3" ; @@ -22,11 +22,11 @@ digraph iCFG { "newS#ArcA#instance.9d1f2aa4ea1ccfd32c1438724cfc19ba_2" [label="2: Exit ArcA_newS \n " color=yellow style=filled] -"newS#ArcA#instance.9d1f2aa4ea1ccfd32c1438724cfc19ba_3" [label="3: Return Stmt \n n$3=*&s:NSString* [line 30, column 10]\n *&return:NSString*=n$3 [line 30, column 3]\n " shape="box"] +"newS#ArcA#instance.9d1f2aa4ea1ccfd32c1438724cfc19ba_3" [label="3: Return Stmt \n n$2=*&s:NSString* [line 30, column 10]\n *&return:NSString*=n$2 [line 30, column 3]\n " shape="box"] "newS#ArcA#instance.9d1f2aa4ea1ccfd32c1438724cfc19ba_3" -> "newS#ArcA#instance.9d1f2aa4ea1ccfd32c1438724cfc19ba_2" ; -"newS#ArcA#instance.9d1f2aa4ea1ccfd32c1438724cfc19ba_4" [label="4: DeclStmt \n n$4=_fun___objc_alloc_no_fail(sizeof(t=NSString):unsigned long) [line 29, column 17]\n *&s:NSString*=n$4 [line 29, column 3]\n " shape="box"] +"newS#ArcA#instance.9d1f2aa4ea1ccfd32c1438724cfc19ba_4" [label="4: DeclStmt \n n$3=_fun___objc_alloc_no_fail(sizeof(t=NSString):unsigned long) [line 29, column 17]\n *&s:NSString*=n$3 [line 29, column 3]\n " shape="box"] "newS#ArcA#instance.9d1f2aa4ea1ccfd32c1438724cfc19ba_4" -> "newS#ArcA#instance.9d1f2aa4ea1ccfd32c1438724cfc19ba_3" ; diff --git a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/AutoreleaseExample.m.dot b/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/AutoreleaseExample.m.dot index f229f6d15..d32d05ce8 100644 --- a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/AutoreleaseExample.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/AutoreleaseExample.m.dot @@ -7,7 +7,7 @@ digraph iCFG { "createA.48a5d7f480131d59bba69d521715b836_2" [label="2: Exit createA \n " color=yellow style=filled] -"createA.48a5d7f480131d59bba69d521715b836_3" [label="3: Return Stmt \n n$0=*&s1:Auto* [line 31, column 11]\n n$1=_fun___set_autorelease_attribute(n$0:Auto*) [line 31, column 10]\n *&return:Auto*=n$1 [line 31, column 3]\n " shape="box"] +"createA.48a5d7f480131d59bba69d521715b836_3" [label="3: Return Stmt \n n$0=*&s1:Auto* [line 31, column 11]\n n$1=_fun_Auto_autorelease(n$0:Auto*) virtual [line 31, column 10]\n *&return:Auto*=n$1 [line 31, column 3]\n " shape="box"] "createA.48a5d7f480131d59bba69d521715b836_3" -> "createA.48a5d7f480131d59bba69d521715b836_2" ; @@ -18,7 +18,7 @@ digraph iCFG { "autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_1" [label="1: Start autorelease_test1\nFormals: \nLocals: s3:Auto* s2:Auto* s1:Auto* \n DECLARE_LOCALS(&return,&s3,&s2,&s1); [line 34, column 1]\n " color=yellow style=filled] - "autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_1" -> "autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_11" ; + "autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_1" -> "autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_10" ; "autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_2" [label="2: Exit autorelease_test1 \n " color=yellow style=filled] @@ -26,42 +26,38 @@ digraph iCFG { "autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_3" -> "autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_2" ; -"autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_4" [label="4: Release the autorelease pool \n n$0=_fun___objc_release_autorelease_pool(&s3:Auto*,&s1:Auto*,&s2:Auto*) [line 38, column 3]\n " shape="box"] +"autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_4" [label="4: BinaryOperatorStmt: Assign \n n$0=_fun_createA() [line 42, column 10]\n *&s3:Auto*=n$0 [line 42, column 5]\n " shape="box"] "autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_4" -> "autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_3" ; -"autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_5" [label="5: BinaryOperatorStmt: Assign \n n$1=_fun_createA() [line 42, column 10]\n *&s3:Auto*=n$1 [line 42, column 5]\n " shape="box"] +"autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_5" [label="5: BinaryOperatorStmt: Assign \n n$1=_fun_createA() [line 41, column 10]\n *&s2:Auto*=n$1 [line 41, column 5]\n " shape="box"] "autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_5" -> "autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_4" ; -"autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_6" [label="6: BinaryOperatorStmt: Assign \n n$2=_fun_createA() [line 41, column 10]\n *&s2:Auto*=n$2 [line 41, column 5]\n " shape="box"] +"autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_6" [label="6: Message Call: retain \n n$2=*&s1:Auto* [line 40, column 6]\n n$3=_fun_Auto_retain(n$2:Auto*) virtual [line 40, column 5]\n " shape="box"] "autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_6" -> "autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_5" ; -"autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_7" [label="7: Message Call: retain \n n$3=*&s1:Auto* [line 40, column 6]\n n$4=_fun___objc_retain(n$3:Auto*) [line 40, column 5]\n " shape="box"] +"autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_7" [label="7: BinaryOperatorStmt: Assign \n n$4=_fun_createA() [line 39, column 10]\n *&s1:Auto*=n$4 [line 39, column 5]\n " shape="box"] "autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_7" -> "autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_6" ; -"autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_8" [label="8: BinaryOperatorStmt: Assign \n n$5=_fun_createA() [line 39, column 10]\n *&s1:Auto*=n$5 [line 39, column 5]\n " shape="box"] +"autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_8" [label="8: DeclStmt \n *&s3:Auto*=null [line 37, column 3]\n " shape="box"] "autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_8" -> "autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_7" ; -"autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_9" [label="9: DeclStmt \n *&s3:Auto*=null [line 37, column 3]\n " shape="box"] +"autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_9" [label="9: DeclStmt \n *&s2:Auto*=null [line 36, column 3]\n " shape="box"] "autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_9" -> "autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_8" ; -"autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_10" [label="10: DeclStmt \n *&s2:Auto*=null [line 36, column 3]\n " shape="box"] +"autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_10" [label="10: DeclStmt \n *&s1:Auto*=null [line 35, column 3]\n " shape="box"] "autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_10" -> "autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_9" ; -"autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_11" [label="11: DeclStmt \n *&s1:Auto*=null [line 35, column 3]\n " shape="box"] - - - "autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_11" -> "autorelease_test1.8f3499e28c7129f0f6b2300d214d7864_10" ; "autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_1" [label="1: Start autorelease_test2\nFormals: \nLocals: s3:Auto* s2:Auto* s1:Auto* \n DECLARE_LOCALS(&return,&s3,&s2,&s1); [line 47, column 1]\n " color=yellow style=filled] - "autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_1" -> "autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_10" ; + "autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_1" -> "autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_9" ; "autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_2" [label="2: Exit autorelease_test2 \n " color=yellow style=filled] @@ -69,34 +65,30 @@ digraph iCFG { "autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_3" -> "autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_2" ; -"autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_4" [label="4: Release the autorelease pool \n n$0=_fun___objc_release_autorelease_pool(&s2:Auto*,&s3:Auto*,&s1:Auto*) [line 51, column 3]\n " shape="box"] +"autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_4" [label="4: BinaryOperatorStmt: Assign \n n$0=_fun_createA() [line 54, column 10]\n *&s3:Auto*=n$0 [line 54, column 5]\n " shape="box"] "autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_4" -> "autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_3" ; -"autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_5" [label="5: BinaryOperatorStmt: Assign \n n$1=_fun_createA() [line 54, column 10]\n *&s3:Auto*=n$1 [line 54, column 5]\n " shape="box"] +"autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_5" [label="5: BinaryOperatorStmt: Assign \n n$1=_fun_createA() [line 53, column 10]\n *&s2:Auto*=n$1 [line 53, column 5]\n " shape="box"] "autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_5" -> "autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_4" ; -"autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_6" [label="6: BinaryOperatorStmt: Assign \n n$2=_fun_createA() [line 53, column 10]\n *&s2:Auto*=n$2 [line 53, column 5]\n " shape="box"] +"autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_6" [label="6: BinaryOperatorStmt: Assign \n n$2=_fun_createA() [line 52, column 10]\n *&s1:Auto*=n$2 [line 52, column 5]\n " shape="box"] "autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_6" -> "autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_5" ; -"autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_7" [label="7: BinaryOperatorStmt: Assign \n n$3=_fun_createA() [line 52, column 10]\n *&s1:Auto*=n$3 [line 52, column 5]\n " shape="box"] +"autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_7" [label="7: DeclStmt \n *&s3:Auto*=null [line 50, column 3]\n " shape="box"] "autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_7" -> "autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_6" ; -"autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_8" [label="8: DeclStmt \n *&s3:Auto*=null [line 50, column 3]\n " shape="box"] +"autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_8" [label="8: DeclStmt \n *&s2:Auto*=null [line 49, column 3]\n " shape="box"] "autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_8" -> "autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_7" ; -"autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_9" [label="9: DeclStmt \n *&s2:Auto*=null [line 49, column 3]\n " shape="box"] +"autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_9" [label="9: DeclStmt \n *&s1:Auto*=null [line 48, column 3]\n " shape="box"] "autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_9" -> "autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_8" ; -"autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_10" [label="10: DeclStmt \n *&s1:Auto*=null [line 48, column 3]\n " shape="box"] - - - "autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_10" -> "autorelease_test2.d978c6e21f1931e19bc731b4ffb90225_9" ; "autorelease_test3.5fa2e6ceb6075e26a47f9b8c9cdf65ba_1" [label="1: Start autorelease_test3\nFormals: \nLocals: c:NSString* string:NSString* pool:NSAutoreleasePool* \n DECLARE_LOCALS(&return,&c,&string,&pool); [line 59, column 1]\n " color=yellow style=filled] @@ -108,11 +100,11 @@ digraph iCFG { "autorelease_test3.5fa2e6ceb6075e26a47f9b8c9cdf65ba_3" -> "autorelease_test3.5fa2e6ceb6075e26a47f9b8c9cdf65ba_2" ; -"autorelease_test3.5fa2e6ceb6075e26a47f9b8c9cdf65ba_4" [label="4: Message Call: release \n n$1=*&pool:NSAutoreleasePool* [line 63, column 4]\n _fun___objc_release_autorelease_pool(n$1:NSAutoreleasePool*) [line 63, column 3]\n " shape="box"] +"autorelease_test3.5fa2e6ceb6075e26a47f9b8c9cdf65ba_4" [label="4: Message Call: release \n n$1=*&pool:NSAutoreleasePool* [line 63, column 4]\n _fun_NSAutoreleasePool_release(n$1:NSAutoreleasePool*) virtual [line 63, column 3]\n " shape="box"] "autorelease_test3.5fa2e6ceb6075e26a47f9b8c9cdf65ba_4" -> "autorelease_test3.5fa2e6ceb6075e26a47f9b8c9cdf65ba_3" ; -"autorelease_test3.5fa2e6ceb6075e26a47f9b8c9cdf65ba_5" [label="5: DeclStmt \n n$2=_fun___objc_alloc_no_fail(sizeof(t=NSString):unsigned long) [line 61, column 23]\n n$3=_fun___set_autorelease_attribute(n$2:NSString*) [line 61, column 22]\n *&string:NSString*=n$3 [line 61, column 3]\n " shape="box"] +"autorelease_test3.5fa2e6ceb6075e26a47f9b8c9cdf65ba_5" [label="5: DeclStmt \n n$2=_fun___objc_alloc_no_fail(sizeof(t=NSString):unsigned long) [line 61, column 23]\n n$3=_fun_NSString_autorelease(n$2:NSString*) virtual [line 61, column 22]\n *&string:NSString*=n$3 [line 61, column 3]\n " shape="box"] "autorelease_test3.5fa2e6ceb6075e26a47f9b8c9cdf65ba_5" -> "autorelease_test3.5fa2e6ceb6075e26a47f9b8c9cdf65ba_4" ; @@ -127,7 +119,7 @@ digraph iCFG { "autorelease_main#Auto#instance.dbdd003a511fe2beb7e0a817d39f6fd8_2" [label="2: Exit Auto_autorelease_main \n " color=yellow style=filled] -"autorelease_main#Auto#instance.dbdd003a511fe2beb7e0a817d39f6fd8_3" [label="3: Return Stmt \n n$0=*&s:NSString* [line 24, column 11]\n n$1=_fun___set_autorelease_attribute(n$0:NSString*) [line 24, column 10]\n *&return:NSString*=n$1 [line 24, column 3]\n " shape="box"] +"autorelease_main#Auto#instance.dbdd003a511fe2beb7e0a817d39f6fd8_3" [label="3: Return Stmt \n n$0=*&s:NSString* [line 24, column 11]\n n$1=_fun_NSString_autorelease(n$0:NSString*) virtual [line 24, column 10]\n *&return:NSString*=n$1 [line 24, column 3]\n " shape="box"] "autorelease_main#Auto#instance.dbdd003a511fe2beb7e0a817d39f6fd8_3" -> "autorelease_main#Auto#instance.dbdd003a511fe2beb7e0a817d39f6fd8_2" ; diff --git a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m.dot b/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m.dot index f6d29d02b..6a1c64d97 100644 --- a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m.dot @@ -112,7 +112,7 @@ digraph iCFG { "layoutSubviews#MemoryLeakExample#instance.2b3151f18431bcdbc08267ea4ff96f53_2" [label="2: Exit MemoryLeakExample_layoutSubviews \n " color=yellow style=filled] -"layoutSubviews#MemoryLeakExample#instance.2b3151f18431bcdbc08267ea4ff96f53_3" [label="3: Message Call: release \n n$0=*&attachmentContainerView:UIView* [line 25, column 4]\n _fun___objc_release(n$0:UIView*) [line 25, column 3]\n " shape="box"] +"layoutSubviews#MemoryLeakExample#instance.2b3151f18431bcdbc08267ea4ff96f53_3" [label="3: Message Call: release \n n$0=*&attachmentContainerView:UIView* [line 25, column 4]\n _fun_UIView_release(n$0:UIView*) virtual [line 25, column 3]\n " shape="box"] "layoutSubviews#MemoryLeakExample#instance.2b3151f18431bcdbc08267ea4ff96f53_3" -> "layoutSubviews#MemoryLeakExample#instance.2b3151f18431bcdbc08267ea4ff96f53_2" ; diff --git a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/RetainReleaseExample.m.dot b/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/RetainReleaseExample.m.dot index 9619f4801..b1b1326fa 100644 --- a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/RetainReleaseExample.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/RetainReleaseExample.m.dot @@ -7,11 +7,11 @@ digraph iCFG { "retain_release_test.65a9467f2c991ef519f3b0d97687f937_2" [label="2: Exit retain_release_test \n " color=yellow style=filled] -"retain_release_test.65a9467f2c991ef519f3b0d97687f937_3" [label="3: Message Call: release \n n$0=*&a:RRA* [line 27, column 4]\n _fun___objc_release(n$0:RRA*) [line 27, column 3]\n " shape="box"] +"retain_release_test.65a9467f2c991ef519f3b0d97687f937_3" [label="3: Message Call: release \n n$0=*&a:RRA* [line 27, column 4]\n _fun_RRA_release(n$0:RRA*) virtual [line 27, column 3]\n " shape="box"] "retain_release_test.65a9467f2c991ef519f3b0d97687f937_3" -> "retain_release_test.65a9467f2c991ef519f3b0d97687f937_2" ; -"retain_release_test.65a9467f2c991ef519f3b0d97687f937_4" [label="4: Message Call: retain \n n$1=*&a:RRA* [line 26, column 4]\n n$2=_fun___objc_retain(n$1:RRA*) [line 26, column 3]\n " shape="box"] +"retain_release_test.65a9467f2c991ef519f3b0d97687f937_4" [label="4: Message Call: retain \n n$1=*&a:RRA* [line 26, column 4]\n n$2=_fun_RRA_retain(n$1:RRA*) virtual [line 26, column 3]\n " shape="box"] "retain_release_test.65a9467f2c991ef519f3b0d97687f937_4" -> "retain_release_test.65a9467f2c991ef519f3b0d97687f937_3" ; diff --git a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/RetainReleaseExample2.m b/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/RetainReleaseExample2.m deleted file mode 100644 index 5fb883a3e..000000000 --- a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/RetainReleaseExample2.m +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2014 - 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 RR2 : NSObject - -@end - -@implementation RR2 - -- init { - return self; -} - -@end - -void __objc_release(RR2*); // infer builtin -RR2* g; - -// no leak -RR2* retain_release2_test() { - RR2* a = [[RR2 alloc] init]; - [a retain]; - [a release]; - - return a; -} - -// no leak -void retain_release2_test2() { - - RR2* b = retain_release2_test(); - g = b; -} - -// leak -void test3() { RR2* b = retain_release2_test(); } - -// no leak -void test4() { - - RR2* b = retain_release2_test(); - [b release]; -} - -// No leak -void test5() { - RR2* a = [[RR2 alloc] init]; - [a release]; -} - -// leak -void test6() { - RR2* a = [[RR2 alloc] init]; - [a retain]; - [a release]; -} - -// Creates specs -void test7(RR2* a) { - if (a) - __objc_release(a); -} diff --git a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/RetainReleaseExample2.m.dot b/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/RetainReleaseExample2.m.dot index 84febfa5e..e859fa90a 100644 --- a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/RetainReleaseExample2.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/RetainReleaseExample2.m.dot @@ -11,11 +11,11 @@ digraph iCFG { "retain_release2_test.7ec6637f213ea568e9cee49c4a91f673_3" -> "retain_release2_test.7ec6637f213ea568e9cee49c4a91f673_2" ; -"retain_release2_test.7ec6637f213ea568e9cee49c4a91f673_4" [label="4: Message Call: release \n n$1=*&a:RR2* [line 31, column 4]\n _fun___objc_release(n$1:RR2*) [line 31, column 3]\n " shape="box"] +"retain_release2_test.7ec6637f213ea568e9cee49c4a91f673_4" [label="4: Message Call: release \n n$1=*&a:RR2* [line 31, column 4]\n _fun_RR2_release(n$1:RR2*) virtual [line 31, column 3]\n " shape="box"] "retain_release2_test.7ec6637f213ea568e9cee49c4a91f673_4" -> "retain_release2_test.7ec6637f213ea568e9cee49c4a91f673_3" ; -"retain_release2_test.7ec6637f213ea568e9cee49c4a91f673_5" [label="5: Message Call: retain \n n$2=*&a:RR2* [line 30, column 4]\n n$3=_fun___objc_retain(n$2:RR2*) [line 30, column 3]\n " shape="box"] +"retain_release2_test.7ec6637f213ea568e9cee49c4a91f673_5" [label="5: Message Call: retain \n n$2=*&a:RR2* [line 30, column 4]\n n$3=_fun_RR2_retain(n$2:RR2*) virtual [line 30, column 3]\n " shape="box"] "retain_release2_test.7ec6637f213ea568e9cee49c4a91f673_5" -> "retain_release2_test.7ec6637f213ea568e9cee49c4a91f673_4" ; @@ -56,7 +56,7 @@ digraph iCFG { "test4.86985e105f79b95d6bc918fb45ec7727_2" [label="2: Exit test4 \n " color=yellow style=filled] -"test4.86985e105f79b95d6bc918fb45ec7727_3" [label="3: Message Call: release \n n$0=*&b:RR2* [line 50, column 4]\n _fun___objc_release(n$0:RR2*) [line 50, column 3]\n " shape="box"] +"test4.86985e105f79b95d6bc918fb45ec7727_3" [label="3: Message Call: release \n n$0=*&b:RR2* [line 50, column 4]\n _fun_RR2_release(n$0:RR2*) virtual [line 50, column 3]\n " shape="box"] "test4.86985e105f79b95d6bc918fb45ec7727_3" -> "test4.86985e105f79b95d6bc918fb45ec7727_2" ; @@ -71,7 +71,7 @@ digraph iCFG { "test5.e3d704f3542b44a621ebed70dc0efe13_2" [label="2: Exit test5 \n " color=yellow style=filled] -"test5.e3d704f3542b44a621ebed70dc0efe13_3" [label="3: Message Call: release \n n$0=*&a:RR2* [line 56, column 4]\n _fun___objc_release(n$0:RR2*) [line 56, column 3]\n " shape="box"] +"test5.e3d704f3542b44a621ebed70dc0efe13_3" [label="3: Message Call: release \n n$0=*&a:RR2* [line 56, column 4]\n _fun_RR2_release(n$0:RR2*) virtual [line 56, column 3]\n " shape="box"] "test5.e3d704f3542b44a621ebed70dc0efe13_3" -> "test5.e3d704f3542b44a621ebed70dc0efe13_2" ; @@ -86,11 +86,11 @@ digraph iCFG { "test6.4cfad7076129962ee70c36839a1e3e15_2" [label="2: Exit test6 \n " color=yellow style=filled] -"test6.4cfad7076129962ee70c36839a1e3e15_3" [label="3: Message Call: release \n n$0=*&a:RR2* [line 63, column 4]\n _fun___objc_release(n$0:RR2*) [line 63, column 3]\n " shape="box"] +"test6.4cfad7076129962ee70c36839a1e3e15_3" [label="3: Message Call: release \n n$0=*&a:RR2* [line 63, column 4]\n _fun_RR2_release(n$0:RR2*) virtual [line 63, column 3]\n " shape="box"] "test6.4cfad7076129962ee70c36839a1e3e15_3" -> "test6.4cfad7076129962ee70c36839a1e3e15_2" ; -"test6.4cfad7076129962ee70c36839a1e3e15_4" [label="4: Message Call: retain \n n$1=*&a:RR2* [line 62, column 4]\n n$2=_fun___objc_retain(n$1:RR2*) [line 62, column 3]\n " shape="box"] +"test6.4cfad7076129962ee70c36839a1e3e15_4" [label="4: Message Call: retain \n n$1=*&a:RR2* [line 62, column 4]\n n$2=_fun_RR2_retain(n$1:RR2*) virtual [line 62, column 3]\n " shape="box"] "test6.4cfad7076129962ee70c36839a1e3e15_4" -> "test6.4cfad7076129962ee70c36839a1e3e15_3" ; diff --git a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/arc_methods.m.dot b/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/arc_methods.m.dot index 6f23919da..df1424f53 100644 --- a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/arc_methods.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/arc_methods.m.dot @@ -22,11 +22,11 @@ digraph iCFG { "someA#ArcMethodsA#class.b84b222a4d332a9b8f3f1d6626af9c8f_2" [label="2: Exit ArcMethodsA_someA \n " color=yellow style=filled] -"someA#ArcMethodsA#class.b84b222a4d332a9b8f3f1d6626af9c8f_3" [label="3: Return Stmt \n n$3=*&a:ArcMethodsA* [line 30, column 10]\n *&return:ArcMethodsA*=n$3 [line 30, column 3]\n n$4=_fun___set_autorelease_attribute(n$3:ArcMethodsA*) [line 30, column 3]\n " shape="box"] +"someA#ArcMethodsA#class.b84b222a4d332a9b8f3f1d6626af9c8f_3" [label="3: Return Stmt \n n$3=*&a:ArcMethodsA* [line 30, column 10]\n *&return:ArcMethodsA*=n$3 [line 30, column 3]\n " shape="box"] "someA#ArcMethodsA#class.b84b222a4d332a9b8f3f1d6626af9c8f_3" -> "someA#ArcMethodsA#class.b84b222a4d332a9b8f3f1d6626af9c8f_2" ; -"someA#ArcMethodsA#class.b84b222a4d332a9b8f3f1d6626af9c8f_4" [label="4: DeclStmt \n n$5=_fun___objc_alloc_no_fail(sizeof(t=ArcMethodsA):unsigned long) [line 28, column 21]\n n$6=_fun_NSObject_init(n$5:ArcMethodsA*) virtual [line 28, column 20]\n *&a:ArcMethodsA*=n$6 [line 28, column 3]\n " shape="box"] +"someA#ArcMethodsA#class.b84b222a4d332a9b8f3f1d6626af9c8f_4" [label="4: DeclStmt \n n$4=_fun___objc_alloc_no_fail(sizeof(t=ArcMethodsA):unsigned long) [line 28, column 21]\n n$5=_fun_NSObject_init(n$4:ArcMethodsA*) virtual [line 28, column 20]\n *&a:ArcMethodsA*=n$5 [line 28, column 3]\n " shape="box"] "someA#ArcMethodsA#class.b84b222a4d332a9b8f3f1d6626af9c8f_4" -> "someA#ArcMethodsA#class.b84b222a4d332a9b8f3f1d6626af9c8f_3" ; @@ -41,15 +41,15 @@ digraph iCFG { "main_arc_methods.6924ccbb58d8dbb03048861dcbd6134b_3" -> "main_arc_methods.6924ccbb58d8dbb03048861dcbd6134b_2" ; -"main_arc_methods.6924ccbb58d8dbb03048861dcbd6134b_4" [label="4: DeclStmt \n n$0=*&a2:ArcMethodsA* [line 45, column 21]\n _fun___objc_retain(n$0:ArcMethodsA*) [line 45, column 3]\n *&ab:ArcMethodsA*=n$0 [line 45, column 3]\n " shape="box"] +"main_arc_methods.6924ccbb58d8dbb03048861dcbd6134b_4" [label="4: DeclStmt \n n$0=*&a2:ArcMethodsA* [line 45, column 21]\n *&ab:ArcMethodsA*=n$0 [line 45, column 3]\n " shape="box"] "main_arc_methods.6924ccbb58d8dbb03048861dcbd6134b_4" -> "main_arc_methods.6924ccbb58d8dbb03048861dcbd6134b_3" ; -"main_arc_methods.6924ccbb58d8dbb03048861dcbd6134b_5" [label="5: DeclStmt \n n$1=_fun_ArcMethodsA_someA() [line 44, column 21]\n _fun___objc_retain(n$1:ArcMethodsA*) [line 44, column 3]\n *&a2:ArcMethodsA*=n$1 [line 44, column 3]\n " shape="box"] +"main_arc_methods.6924ccbb58d8dbb03048861dcbd6134b_5" [label="5: DeclStmt \n n$1=_fun_ArcMethodsA_someA() [line 44, column 21]\n *&a2:ArcMethodsA*=n$1 [line 44, column 3]\n " shape="box"] "main_arc_methods.6924ccbb58d8dbb03048861dcbd6134b_5" -> "main_arc_methods.6924ccbb58d8dbb03048861dcbd6134b_4" ; -"main_arc_methods.6924ccbb58d8dbb03048861dcbd6134b_6" [label="6: DeclStmt \n n$2=*&a1:ArcMethodsA* [line 43, column 21]\n _fun___objc_retain(n$2:ArcMethodsA*) [line 43, column 3]\n *&aa:ArcMethodsA*=n$2 [line 43, column 3]\n " shape="box"] +"main_arc_methods.6924ccbb58d8dbb03048861dcbd6134b_6" [label="6: DeclStmt \n n$2=*&a1:ArcMethodsA* [line 43, column 21]\n *&aa:ArcMethodsA*=n$2 [line 43, column 3]\n " shape="box"] "main_arc_methods.6924ccbb58d8dbb03048861dcbd6134b_6" -> "main_arc_methods.6924ccbb58d8dbb03048861dcbd6134b_5" ; 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 a320ec0a7..8cf002310 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 @@ -18,7 +18,7 @@ digraph iCFG { "getA#NonnullA#instance.d4b29ece551a370c3f0c0c12526b3def_2" [label="2: Exit NonnullA_getA \n " color=yellow style=filled] -"getA#NonnullA#instance.d4b29ece551a370c3f0c0c12526b3def_3" [label="3: Return Stmt \n n$0=_fun___objc_alloc_no_fail(sizeof(t=NonnullA):unsigned long) [line 26, column 10]\n n$1=_fun_NSObject_init(n$0:NonnullA*) virtual [line 26, column 10]\n *&return:NonnullA*=n$1 [line 26, column 3]\n n$2=_fun___set_autorelease_attribute(n$1:NonnullA*) [line 26, column 3]\n " shape="box"] +"getA#NonnullA#instance.d4b29ece551a370c3f0c0c12526b3def_3" [label="3: Return Stmt \n n$0=_fun___objc_alloc_no_fail(sizeof(t=NonnullA):unsigned long) [line 26, column 10]\n n$1=_fun_NSObject_init(n$0:NonnullA*) virtual [line 26, column 10]\n *&return:NonnullA*=n$1 [line 26, column 3]\n " shape="box"] "getA#NonnullA#instance.d4b29ece551a370c3f0c0c12526b3def_3" -> "getA#NonnullA#instance.d4b29ece551a370c3f0c0c12526b3def_2" ; @@ -37,7 +37,7 @@ digraph iCFG { "initWithCoder:and:#NonnullC#instance.0360cbf0c434f47ea58689c925d7c008_4" -> "initWithCoder:and:#NonnullC#instance.0360cbf0c434f47ea58689c925d7c008_3" ; -"initWithCoder:and:#NonnullC#instance.0360cbf0c434f47ea58689c925d7c008_5" [label="5: DeclStmt \n n$3=*&a:NonnullA* [line 39, column 19]\n n$4=_fun_NonnullA_getA(n$3:NonnullA*) virtual [line 39, column 18]\n _fun___objc_retain(n$4:NonnullA*) [line 39, column 3]\n *&a1:NonnullA*=n$4 [line 39, column 3]\n " shape="box"] +"initWithCoder:and:#NonnullC#instance.0360cbf0c434f47ea58689c925d7c008_5" [label="5: DeclStmt \n n$3=*&a:NonnullA* [line 39, column 19]\n n$4=_fun_NonnullA_getA(n$3:NonnullA*) virtual [line 39, column 18]\n *&a1:NonnullA*=n$4 [line 39, column 3]\n " shape="box"] "initWithCoder:and:#NonnullC#instance.0360cbf0c434f47ea58689c925d7c008_5" -> "initWithCoder:and:#NonnullC#instance.0360cbf0c434f47ea58689c925d7c008_4" ; diff --git a/infer/tests/codetoanalyze/objc/shared/property/PropertyAttributes.m.dot b/infer/tests/codetoanalyze/objc/shared/property/PropertyAttributes.m.dot index c2be1152e..7147e0a7e 100644 --- a/infer/tests/codetoanalyze/objc/shared/property/PropertyAttributes.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/property/PropertyAttributes.m.dot @@ -11,7 +11,7 @@ digraph iCFG { "test.098f6bcd4621d373cade4e832627b4f6_3" -> "test.098f6bcd4621d373cade4e832627b4f6_2" ; -"test.098f6bcd4621d373cade4e832627b4f6_4" [label="4: Message Call: release \n n$0=*&a:PropertyA* [line 45, column 4]\n _fun___objc_release(n$0:PropertyA*) [line 45, column 3]\n " shape="box"] +"test.098f6bcd4621d373cade4e832627b4f6_4" [label="4: Message Call: release \n n$0=*&a:PropertyA* [line 45, column 4]\n _fun_PropertyA_release(n$0:PropertyA*) virtual [line 45, column 3]\n " shape="box"] "test.098f6bcd4621d373cade4e832627b4f6_4" -> "test.098f6bcd4621d373cade4e832627b4f6_3" ;