From ed740600de43af9473a99bd1c59a73e008e196d3 Mon Sep 17 00:00:00 2001 From: Dulma Churchill Date: Tue, 5 Dec 2017 04:54:14 -0800 Subject: [PATCH] [cleanup] Remove hidden field and related code that is not used anymore. Reviewed By: sblackshear Differential Revision: D6459405 fbshipit-source-id: 030fab8 --- infer/src/IR/BUILTINS.ml | 4 - infer/src/IR/DecompiledExp.ml | 6 +- infer/src/IR/Mleak_buckets.ml | 50 +---------- infer/src/IR/Mleak_buckets.mli | 11 +-- infer/src/IR/Typ.ml | 42 +-------- infer/src/IR/Typ.mli | 10 --- infer/src/backend/BuiltinDefn.ml | 88 ------------------- infer/src/backend/abs.ml | 15 ---- infer/src/backend/interproc.ml | 1 - infer/src/backend/prop.ml | 15 ++-- infer/src/base/Config.ml | 5 +- infer/src/clang/CType_decl.ml | 10 +-- infer/src/clang/cMethod_trans.ml | 1 - infer/src/clang/cTrans.ml | 6 +- infer/src/clang/objcInterface_decl.ml | 5 +- .../tests/build_systems/xcodebuild/issues.exp | 1 + .../codetoanalyze/objc/errors/issues.exp | 9 -- 17 files changed, 21 insertions(+), 258 deletions(-) diff --git a/infer/src/IR/BUILTINS.ml b/infer/src/IR/BUILTINS.ml index 855f43fd5..5f8c7e98c 100644 --- a/infer/src/IR/BUILTINS.ml +++ b/infer/src/IR/BUILTINS.ml @@ -42,8 +42,6 @@ module type S = sig val __get_array_length : t - val __get_hidden_field : t - val __get_type_of : t val __global_access : t @@ -77,8 +75,6 @@ module type S = sig val __set_file_attribute : t - val __set_hidden_field : t - val __set_locked_attribute : t val __set_mem_attribute : t diff --git a/infer/src/IR/DecompiledExp.ml b/infer/src/IR/DecompiledExp.ml index ec67977c5..78dc68c7b 100644 --- a/infer/src/IR/DecompiledExp.ml +++ b/infer/src/IR/DecompiledExp.ml @@ -87,15 +87,13 @@ let rec to_string = function (* this->fieldname *) Typ.Fieldname.to_simplified_string f | Darrow (de, f) -> - if Typ.Fieldname.is_hidden f then to_string de - else if java () then to_string de ^ "." ^ Typ.Fieldname.to_flat_string f + if java () then to_string de ^ "." ^ Typ.Fieldname.to_flat_string f else to_string de ^ "->" ^ Typ.Fieldname.to_string f | Ddot (Dpvar _, fe) when eradicate_java () -> (* static field access *) Typ.Fieldname.to_simplified_string fe | Ddot (de, f) -> - if Typ.Fieldname.is_hidden f then "&" ^ to_string de - else if java () then to_string de ^ "." ^ Typ.Fieldname.to_flat_string f + if java () then to_string de ^ "." ^ Typ.Fieldname.to_flat_string f else to_string de ^ "." ^ Typ.Fieldname.to_string f | Dpvar pv -> Mangled.to_string (Pvar.get_name pv) diff --git a/infer/src/IR/Mleak_buckets.ml b/infer/src/IR/Mleak_buckets.ml index 19757f450..1c804e0d2 100644 --- a/infer/src/IR/Mleak_buckets.ml +++ b/infer/src/IR/Mleak_buckets.ml @@ -13,40 +13,14 @@ open! PVariant (** This module handles buckets of memory leaks in Objective-C/C++ *) -let objc_arc_flag = "objc_arc" - let bucket_to_message bucket = - match bucket with - | `MLeak_cf -> - "[CF]" - | `MLeak_arc -> - "[ARC]" - | `MLeak_no_arc -> - "[NO ARC]" - | `MLeak_cpp -> - "[CPP]" - | `MLeak_unknown -> - "[UNKNOWN ORIGIN]" - - -let contains_all = List.mem ~equal:PVariant.( = ) Config.ml_buckets `MLeak_all + match bucket with `MLeak_cpp -> "[CPP]" | `MLeak_unknown -> "[UNKNOWN ORIGIN]" -let contains_cf = List.mem ~equal:PVariant.( = ) Config.ml_buckets `MLeak_cf - -let contains_arc = List.mem ~equal:PVariant.( = ) Config.ml_buckets `MLeak_arc - -let contains_narc = List.mem ~equal:PVariant.( = ) Config.ml_buckets `MLeak_no_arc let contains_cpp = List.mem ~equal:PVariant.( = ) Config.ml_buckets `MLeak_cpp let contains_unknown_origin = List.mem ~equal:PVariant.( = ) Config.ml_buckets `MLeak_unknown -let should_raise_leak_cf typ = if contains_cf then Objc_models.is_core_lib_type typ else false - -let should_raise_leak_arc () = if contains_arc then !Config.arc_mode else false - -let should_raise_leak_no_arc () = if contains_narc then not !Config.arc_mode else false - let should_raise_leak_unknown_origin = contains_unknown_origin let ml_bucket_unknown_origin = bucket_to_message `MLeak_unknown @@ -54,25 +28,3 @@ let ml_bucket_unknown_origin = bucket_to_message `MLeak_unknown (* Returns whether a memory leak should be raised for a C++ object.*) (* If ml_buckets contains cpp, then check leaks from C++ objects. *) let should_raise_cpp_leak = if contains_cpp then Some (bucket_to_message `MLeak_cpp) else None - -(* Returns whether a memory leak should be raised. *) -(* If cf is passed, then check leaks from Core Foundation. *) -(* If arc is passed, check leaks from code that compiles with arc*) -(* If no arc is passed check the leaks from code that compiles without arc *) -let should_raise_objc_leak typ = - if List.is_empty Config.ml_buckets || contains_all then Some "" - else if should_raise_leak_cf typ then Some (bucket_to_message `MLeak_cf) - else if should_raise_leak_arc () then Some (bucket_to_message `MLeak_arc) - else if should_raise_leak_no_arc () then Some (bucket_to_message `MLeak_no_arc) - else None - - -(* -let bucket_to_string bucket = - match bucket with - | MLeak_cf -> "Core Foundation" - | MLeak_arc -> "Arc" - | MLeak_no_arc -> "No arc" - | MLeak_cpp -> "Cpp" - | MLeak_unknown -> "Unknown origin" -*) diff --git a/infer/src/IR/Mleak_buckets.mli b/infer/src/IR/Mleak_buckets.mli index 77474084c..ec561cd51 100644 --- a/infer/src/IR/Mleak_buckets.mli +++ b/infer/src/IR/Mleak_buckets.mli @@ -9,16 +9,7 @@ open! IStd -(** This module handles buckets of memory leaks in Objective-C *) - -val objc_arc_flag : string - -(* Returns whether a memory leak should be raised. *) -(* If cf is passed, then check leaks from Core Foundation. *) -(* If arc is passed, check leaks from code that compiles with arc*) -(* If no arc is passed check the leaks from code that compiles without arc *) - -val should_raise_objc_leak : Typ.t -> string option +(** This module handles buckets of memory leaks *) (* Returns whether a memory leak should be raised for a C++ object.*) (* If ml_buckets contains cpp, then check leaks from C++ objects. *) diff --git a/infer/src/IR/Typ.ml b/infer/src/IR/Typ.ml index 9862fb8ac..31ade56f3 100644 --- a/infer/src/IR/Typ.ml +++ b/infer/src/IR/Typ.ml @@ -1218,14 +1218,7 @@ let java_proc_return_typ pname_java : t = module Fieldname = struct type clang_field_info = {class_name: Name.t; field_name: string} [@@deriving compare] - type t = - | Hidden - (* Backend relies that Hidden is the smallest (first) field in Abs.should_raise_objc_leak *) - | Clang of clang_field_info - | Java of string - [@@deriving compare] - - let hidden_str = ".hidden" + type t = Clang of clang_field_info | Java of string [@@deriving compare] let equal = [%compare.equal : t] @@ -1239,14 +1232,7 @@ module Fieldname = struct module Map = Caml.Map.Make (T) (** Convert a fieldname to a string. *) - let to_string = function - | Hidden -> - hidden_str - | Java fname -> - fname - | Clang {field_name} -> - field_name - + let to_string = function Java fname -> fname | Clang {field_name} -> field_name (** Convert a fieldname to a simplified string with at most one-level path. *) let to_simplified_string fn = @@ -1272,12 +1258,7 @@ module Fieldname = struct match String.rsplit2 s ~on:'.' with Some (_, s2) -> s2 | _ -> s - let pp f = function - | Hidden -> - Format.fprintf f "%s" hidden_str - | Java field_name | Clang {field_name} -> - Format.fprintf f "%s" field_name - + let pp f = function Java field_name | Clang {field_name} -> Format.fprintf f "%s" field_name let class_name_replace fname ~f = match fname with @@ -1322,12 +1303,6 @@ module Fieldname = struct None - (** hidded fieldname constant *) - let hidden = Hidden - - (** hidded fieldname constant *) - let is_hidden fn = equal fn hidden - module Clang = struct let from_class_name class_name field_name = Clang {class_name; field_name} end @@ -1339,7 +1314,7 @@ module Fieldname = struct match field_name with | Java _ -> String.is_prefix ~prefix:"val$" (to_flat_string field_name) - | Hidden | Clang _ -> + | Clang _ -> false end @@ -1435,13 +1410,4 @@ module Struct = struct | _ -> None - - let objc_ref_counter_annot = [({Annot.class_name= "ref_counter"; parameters= []}, false)] - - (** Field used for objective-c reference counting *) - let objc_ref_counter_field = (Fieldname.hidden, mk (T.Tint IInt), objc_ref_counter_annot) - - let is_objc_ref_counter_field (fld, _, a) = - Fieldname.is_hidden fld && Annot.Item.equal a objc_ref_counter_annot - end diff --git a/infer/src/IR/Typ.mli b/infer/src/IR/Typ.mli index 5910e643c..63bbb7a51 100644 --- a/infer/src/IR/Typ.mli +++ b/infer/src/IR/Typ.mli @@ -600,12 +600,6 @@ module Fieldname : sig val clang_get_qual_class : t -> QualifiedCppName.t option (** get qualified classname of a field if it's coming from clang frontend. returns None otherwise *) - - val hidden : t - (** hidded fieldname constant *) - - val is_hidden : t -> bool - (** hidded fieldname constant *) end module Struct : sig @@ -644,8 +638,4 @@ module Struct : sig lookup:lookup -> Fieldname.t -> typ -> (typ * Annot.Item.t) option (** Return the type of the field [fn] and its annotation, None if [typ] has no field named [fn] *) - val objc_ref_counter_field : Fieldname.t * typ * Annot.Item.t - (** Field used for objective-c reference counting *) - - val is_objc_ref_counter_field : Fieldname.t * typ * Annot.Item.t -> bool end diff --git a/infer/src/backend/BuiltinDefn.ml b/infer/src/backend/BuiltinDefn.ml index ca5feca9f..1aa26cf5e 100644 --- a/infer/src/backend/BuiltinDefn.ml +++ b/infer/src/backend/BuiltinDefn.ml @@ -397,89 +397,6 @@ let execute___set_mem_attribute {Builtin.tenv; pdesc; prop_; path; ret_id; args; | _ -> raise (Exceptions.Wrong_argument_number __POS__) - -(** take a pointer to a struct, and return the value of a hidden field in the struct *) -let execute___get_hidden_field {Builtin.tenv; pdesc; prop_; path; ret_id; args} : Builtin.ret_typ = - match args with - | [(lexp, _)] -> - let pname = Procdesc.get_proc_name pdesc in - let n_lexp, prop = check_arith_norm_exp tenv pname lexp prop_ in - let ret_val = ref None in - let return_val p = - match !ret_val with Some e -> return_result tenv e p ret_id | None -> p - in - let foot_var = lazy (Exp.Var (Ident.create_fresh Ident.kfootprint)) in - let filter_fld_hidden (f, _) = Typ.Fieldname.is_hidden f in - let has_fld_hidden fsel = List.exists ~f:filter_fld_hidden fsel in - let do_hpred in_foot hpred = - match hpred with - | Sil.Hpointsto (e, Sil.Estruct (fsel, inst), texp) - when Exp.equal e n_lexp && not (has_fld_hidden fsel) -> - let foot_e = Lazy.force foot_var in - ret_val := Some foot_e ; - let se = Sil.Eexp (foot_e, Sil.inst_none) in - let fsel' = (Typ.Fieldname.hidden, se) :: fsel in - Sil.Hpointsto (e, Sil.Estruct (fsel', inst), texp) - | Sil.Hpointsto (e, Sil.Estruct (fsel, _), _) - when Exp.equal e n_lexp && not in_foot && has_fld_hidden fsel -> - let set_ret_val () = - match List.find ~f:filter_fld_hidden fsel with - | Some (_, Sil.Eexp (e, _)) -> - ret_val := Some e - | _ -> - () - in - set_ret_val () ; hpred - | _ -> - hpred - in - let sigma' = List.map ~f:(do_hpred false) prop.Prop.sigma in - let sigma_fp' = List.map ~f:(do_hpred true) prop.Prop.sigma_fp in - let prop' = Prop.set prop ~sigma:sigma' ~sigma_fp:sigma_fp' in - let prop'' = return_val (Prop.normalize tenv prop') in - [(prop'', path)] - | _ -> - raise (Exceptions.Wrong_argument_number __POS__) - - -(** take a pointer to a struct and a value, - and set a hidden field in the struct to the given value *) -let execute___set_hidden_field {Builtin.tenv; pdesc; prop_; path; args} : Builtin.ret_typ = - match args with - | [(lexp1, _); (lexp2, _)] -> - let pname = Procdesc.get_proc_name pdesc in - let n_lexp1, prop__ = check_arith_norm_exp tenv pname lexp1 prop_ in - let n_lexp2, prop = check_arith_norm_exp tenv pname lexp2 prop__ in - let foot_var = lazy (Exp.Var (Ident.create_fresh Ident.kfootprint)) in - let filter_fld_hidden (f, _) = Typ.Fieldname.is_hidden f in - let has_fld_hidden fsel = List.exists ~f:filter_fld_hidden fsel in - let do_hpred in_foot hpred = - match hpred with - | Sil.Hpointsto (e, Sil.Estruct (fsel, inst), texp) when Exp.equal e n_lexp1 && not in_foot -> - let se = Sil.Eexp (n_lexp2, Sil.inst_none) in - let fsel' = - (Typ.Fieldname.hidden, se) - :: List.filter ~f:(fun x -> not (filter_fld_hidden x)) fsel - in - Sil.Hpointsto (e, Sil.Estruct (fsel', inst), texp) - | Sil.Hpointsto (e, Sil.Estruct (fsel, inst), texp) - when Exp.equal e n_lexp1 && in_foot && not (has_fld_hidden fsel) -> - let foot_e = Lazy.force foot_var in - let se = Sil.Eexp (foot_e, Sil.inst_none) in - let fsel' = (Typ.Fieldname.hidden, se) :: fsel in - Sil.Hpointsto (e, Sil.Estruct (fsel', inst), texp) - | _ -> - hpred - in - let sigma' = List.map ~f:(do_hpred false) prop.Prop.sigma in - let sigma_fp' = List.map ~f:(do_hpred true) prop.Prop.sigma_fp in - let prop' = Prop.set prop ~sigma:sigma' ~sigma_fp:sigma_fp' in - let prop'' = Prop.normalize tenv prop' in - [(prop'', path)] - | _ -> - raise (Exceptions.Wrong_argument_number __POS__) - - 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 @@ -952,8 +869,6 @@ let __free_cf = Builtin.register BuiltinDecl.__free_cf (execute_free_cf PredSymb (* return the length of the array passed as a parameter *) let __get_array_length = Builtin.register BuiltinDecl.__get_array_length execute___get_array_length -let __get_hidden_field = Builtin.register BuiltinDecl.__get_hidden_field execute___get_hidden_field - let __get_type_of = Builtin.register BuiltinDecl.__get_type_of execute___get_type_of (* only used in Quandary, so ok to skip *) @@ -1005,9 +920,6 @@ let __set_file_attribute = Builtin.register BuiltinDecl.__set_file_attribute execute___set_file_attribute -(* set a hidden field in the struct to the given value *) -let __set_hidden_field = Builtin.register BuiltinDecl.__set_hidden_field execute___set_hidden_field - let __set_locked_attribute = Builtin.register BuiltinDecl.__set_locked_attribute execute___set_locked_attribute diff --git a/infer/src/backend/abs.ml b/infer/src/backend/abs.ml index 40d32952d..f85122e3c 100644 --- a/infer/src/backend/abs.ml +++ b/infer/src/backend/abs.ml @@ -989,19 +989,6 @@ let sigma_reachable root_fav sigma = !reach_set -(** Check whether the hidden counter field of a struct representing an objective-c object is - positive, and whether the leak is part of the specified buckets. In the positive case, it - returns the bucket *) -let should_raise_objc_leak hpred = - match hpred with - | Sil.Hpointsto - (_, Sil.Estruct ((fn, Sil.Eexp (Exp.Const Const.Cint i, _)) :: _, _), Exp.Sizeof {typ}) - when Typ.Fieldname.is_hidden fn && IntLit.gt i IntLit.zero (* counter > 0 *) -> - Mleak_buckets.should_raise_objc_leak typ - | _ -> - None - - let check_observer_is_unsubscribed_deallocation tenv prop e = let pvar_opt = match Attribute.get_resource tenv prop e with @@ -1124,8 +1111,6 @@ let check_junk ?original_prop pname tenv prop = in let ml_bucket_opt = match resource with - | PredSymb.Rmemory PredSymb.Mobjc -> - should_raise_objc_leak hpred | PredSymb.Rmemory PredSymb.Mnew | PredSymb.Rmemory PredSymb.Mnew_array when Config.curr_language_is Config.Clang -> diff --git a/infer/src/backend/interproc.ml b/infer/src/backend/interproc.ml index fa708a8f7..827d261ac 100644 --- a/infer/src/backend/interproc.ml +++ b/infer/src/backend/interproc.ml @@ -936,7 +936,6 @@ let perform_analysis_phase tenv (summary: Specs.summary) (proc_cfg: ProcCfg.Exce L.d_ln () ; L.d_decrease_indent 1 ; Worklist.add wl start_node ; - Config.arc_mode := Hashtbl.mem (Procdesc.get_flags pdesc) Mleak_buckets.objc_arc_flag ; ignore (path_set_put_todo wl start_node init_edgeset) ; forward_tabulate tenv proc_cfg wl in diff --git a/infer/src/backend/prop.ml b/infer/src/backend/prop.ml index 1f32d6be6..0dfcfefee 100644 --- a/infer/src/backend/prop.ml +++ b/infer/src/backend/prop.ml @@ -478,15 +478,12 @@ let rec create_strexp_of_type ~path tenv struct_init_mode (typ: Typ.t) len inst | Fld_init, Some {fields} -> (* pass len as an accumulator, so that it is passed to create_strexp_of_type for the last field, but always return None so that only the last field receives len *) - let f (fld, t, a) (flds, len) = - if Typ.Struct.is_objc_ref_counter_field (fld, t, a) then - ((fld, Sil.Eexp (Exp.one, inst)) :: flds, None) - else - ( ( fld - , create_strexp_of_type ~path:((name, fld) :: path) tenv struct_init_mode t len - inst ) - :: flds - , None ) + let f (fld, t, _) (flds, len) = + ( ( fld + , create_strexp_of_type ~path:((name, fld) :: path) tenv struct_init_mode t len inst + ) + :: flds + , None ) in let flds, _ = List.fold_right ~f fields ~init:([], len) in Estruct (flds, inst) diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index 5b8123e1b..32cb316d5 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -1506,10 +1506,7 @@ and ml_buckets = CLOpt.mk_symbol_seq ~deprecated:["ml_buckets"; "-ml_buckets"] ~long:"ml-buckets" ~default:[`MLeak_cf] ~in_help:CLOpt.([(Analyze, manual_clang)]) - {|Specify the memory leak buckets to be checked in Objective-C/C++: -- $(b,cf) checks leaks from Core Foundation (activated by default), -- $(b,arc) from code compiled in ARC mode, -- $(b,narc) from code not compiled in ARC mode, + {|Specify the memory leak buckets to be checked in C++: - $(b,cpp) from C++ code |} ~symbols:ml_bucket_symbols ~eq:PVariant.( = ) diff --git a/infer/src/clang/CType_decl.ml b/infer/src/clang/CType_decl.ml index 2f23ec545..9370a3808 100644 --- a/infer/src/clang/CType_decl.ml +++ b/infer/src/clang/CType_decl.ml @@ -241,15 +241,9 @@ and get_record_struct_type tenv definition_decl : Typ.desc = record_decl_info.rdi_is_complete_definition && not record_decl_info.rdi_is_dependent_type in - let extra_fields = - if CTrans_models.is_objc_memory_model_controlled (Typ.Name.name sil_typename) then - [Typ.Struct.objc_ref_counter_field] - else [] - in if is_translatable_definition then ( CAst_utils.update_sil_types_map type_ptr sil_desc ; - let non_statics = get_struct_fields tenv definition_decl in - let fields = CGeneral_utils.append_no_duplicates_fields non_statics extra_fields in + let fields = get_struct_fields tenv definition_decl in let statics = [] in (* Note: We treat static field same as global variables *) let methods = [] in @@ -265,7 +259,7 @@ and get_record_struct_type tenv definition_decl : Typ.desc = else ( (* There is no definition for that struct in whole translation unit. Put empty struct into tenv to prevent backend problems *) - ignore (Tenv.mk_struct tenv ~fields:extra_fields sil_typename) ; + ignore (Tenv.mk_struct tenv ~fields:[] sil_typename) ; CAst_utils.update_sil_types_map type_ptr sil_desc ; sil_desc ) ) | _ -> diff --git a/infer/src/clang/cMethod_trans.ml b/infer/src/clang/cMethod_trans.ml index c9d8d4229..896c53dfa 100644 --- a/infer/src/clang/cMethod_trans.ml +++ b/infer/src/clang/cMethod_trans.ml @@ -621,7 +621,6 @@ let create_local_procdesc ?(set_objc_accessor_attr= false) trans_unit_ctx cfg te Cfg.create_proc_desc cfg proc_attributes in if defined then ( - if !Config.arc_mode then Procdesc.set_flag procdesc Mleak_buckets.objc_arc_flag "true" ; let start_kind = Procdesc.Node.Start_node proc_name in let start_node = Procdesc.create_node procdesc loc_start start_kind [] in let exit_kind = Procdesc.Node.Exit_node proc_name in diff --git a/infer/src/clang/cTrans.ml b/infer/src/clang/cTrans.ml index 3836cdb2c..8f1eb91b9 100644 --- a/infer/src/clang/cTrans.ml +++ b/infer/src/clang/cTrans.ml @@ -374,8 +374,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s match Tenv.lookup tenv tn with | Some {fields} -> List.filter_map fields ~f:(fun (fieldname, fieldtype, _) -> - if Typ.Fieldname.is_hidden fieldname then None - else Some (Exp.Lfield (exp, fieldname, typ), fieldtype) ) + Some (Exp.Lfield (exp, fieldname, typ), fieldtype) ) | None -> assert false in @@ -2051,8 +2050,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s match Tenv.lookup tenv tname with | Some {fields} -> List.filter_map fields ~f:(fun (fieldname, fieldtype, _) -> - if Typ.Fieldname.is_hidden fieldname then None - else Some (Exp.Lfield (var_exp, fieldname, var_typ), fieldtype) ) + Some (Exp.Lfield (var_exp, fieldname, var_typ), fieldtype) ) | None -> assert false in diff --git a/infer/src/clang/objcInterface_decl.ml b/infer/src/clang/objcInterface_decl.ml index a69df871d..89ec4a112 100644 --- a/infer/src/clang/objcInterface_decl.ml +++ b/infer/src/clang/objcInterface_decl.ml @@ -116,10 +116,7 @@ let add_class_to_tenv qual_type_to_sil_type tenv decl_info name_info decl_list o (decl_fields, decl_supers) in let fields = CGeneral_utils.append_no_duplicates_fields fields fields_sc in - (* We add the special hidden counter_field for implementing reference counting *) - let modelled_fields = - Typ.Struct.objc_ref_counter_field :: CField_decl.modelled_field name_info - in + let modelled_fields = CField_decl.modelled_field name_info in let all_fields = CGeneral_utils.append_no_duplicates_fields modelled_fields fields in L.(debug Capture Verbose) "Class %a field:@\n" QualifiedCppName.pp class_name ; List.iter diff --git a/infer/tests/build_systems/xcodebuild/issues.exp b/infer/tests/build_systems/xcodebuild/issues.exp index 0d66d8144..9c0816b0a 100644 --- a/infer/tests/build_systems/xcodebuild/issues.exp +++ b/infer/tests/build_systems/xcodebuild/issues.exp @@ -1 +1,2 @@ xcodebuild/simple_app/simple_app/AppDelegate.m, f, 2, NULL_DEREFERENCE, [start of procedure f()] +xcodebuild/simple_app/simple_app/ViewController.m, Linters_dummy_method, 15, STRONG_DELEGATE_WARNING, [] diff --git a/infer/tests/codetoanalyze/objc/errors/issues.exp b/infer/tests/codetoanalyze/objc/errors/issues.exp index 7502090c4..858fde755 100644 --- a/infer/tests/codetoanalyze/objc/errors/issues.exp +++ b/infer/tests/codetoanalyze/objc/errors/issues.exp @@ -3,16 +3,9 @@ codetoanalyze/objc/errors/global_const/global_const.m, SimpleRoot_doSomethingBad codetoanalyze/objc/errors/global_const/global_const.m, SimpleRoot_doSomethingOkWithDict:andString:, 3, NULL_DEREFERENCE, [start of procedure doSomethingOkWithDict:andString:,Message stringByAppendingString: with receiver nil returns nil.] codetoanalyze/objc/errors/initialization/compound_literal.c, init_with_compound_literal, 2, DIVIDE_BY_ZERO, [start of procedure init_with_compound_literal()] codetoanalyze/objc/errors/memory_leaks_benchmark/CADisplayLinkRetainCycle.m, testCycle, 3, RETAIN_CYCLE, [start of procedure testCycle(),start of procedure init,return from a call to CADisplay_init] -codetoanalyze/objc/errors/memory_leaks_benchmark/RetainCycleStaticVar.m, RetainCSVycleStaticVar, 2, MEMORY_LEAK, [start of procedure RetainCSVycleStaticVar(),start of procedure init,return from a call to RetainCSV_init,start of procedure foo,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:,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] -codetoanalyze/objc/errors/procdescs/main.c, call_nslog, 1, MEMORY_LEAK, [start of procedure call_nslog()] codetoanalyze/objc/errors/procdescs/main.c, call_nslog, 3, MEMORY_LEAK, [start of procedure call_nslog(),Skipping NSLog(): function or method not found] -codetoanalyze/objc/errors/property/main.c, property_main, 2, MEMORY_LEAK, [start of procedure property_main(),Skipping aProperty: function or method not found] 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/warnings/ParameterNotNullableExample.m, FBAudioRecorder_FBAudioInputCallbackChain:, 2, NULL_DEREFERENCE, [start of procedure FBAudioInputCallbackChain:,Message recordState with receiver nil returns nil.] codetoanalyze/objc/errors/warnings/ParameterNotNullableExample.m, FBAudioRecorder_FBAudioInputCallbackChain:, 2, PARAMETER_NOT_NULL_CHECKED, [start of procedure FBAudioInputCallbackChain:,Message recorder with receiver nil returns nil. Message recordState with receiver nil returns nil.] @@ -27,10 +20,8 @@ codetoanalyze/objc/shared/block/BlockVar.m, BlockVar_navigateToURLInBackground, codetoanalyze/objc/shared/block/block.m, main1, 31, DIVIDE_BY_ZERO, [start of procedure main1(),start of procedure block,start of procedure block,return from a call to objc_blockobjc_blockmain1_2_3,return from a call to objc_blockmain1_2,start of procedure block,return from a call to objc_blockmain1_1] codetoanalyze/objc/shared/block/block_no_args.m, My_manager_m, 10, NULL_DEREFERENCE, [start of procedure m,start of procedure block,return from a call to objc_blockMy_manager_m_1,Condition is true] codetoanalyze/objc/shared/block/block_release.m, My_manager_blockReleaseTODO, 5, MEMORY_LEAK, [start of procedure blockReleaseTODO] -codetoanalyze/objc/shared/category_procdesc/main.c, CategoryProcdescMain, 2, MEMORY_LEAK, [start of procedure CategoryProcdescMain(),Skipping performDaysWork: function or method not found] 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/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]