From a969b5d188d9b4efe4cc96daa7fbcd84fcb1f85f Mon Sep 17 00:00:00 2001 From: Dulma Churchill Date: Fri, 20 Oct 2017 07:36:06 -0700 Subject: [PATCH] [cleanup] Remove unused code for finding correct fields in Objective-C Reviewed By: sblackshear Differential Revision: D6110019 fbshipit-source-id: 6471203 --- infer/src/IR/Attributes.ml | 8 -------- infer/src/IR/Attributes.mli | 5 ----- infer/src/IR/Typ.ml | 6 ------ infer/src/IR/Typ.mli | 2 -- infer/src/backend/BuiltinDefn.ml | 9 --------- infer/src/clang/cFrontend_decl.ml | 4 +--- infer/src/clang/cMethod_trans.ml | 8 -------- infer/src/clang/cMethod_trans.mli | 3 --- 8 files changed, 1 insertion(+), 44 deletions(-) diff --git a/infer/src/IR/Attributes.ml b/infer/src/IR/Attributes.ml index 802b79c33..89899a853 100644 --- a/infer/src/IR/Attributes.ml +++ b/infer/src/IR/Attributes.ml @@ -131,14 +131,6 @@ let store (attr: ProcAttributes.t) = let load_defined pname = Data.of_pname pname |> find ~defined:true -let get_correct_type_from_objc_class_name type_name = - (* ToDo: this function should return a type that includes a reference to the tenv computed by: - let class_method = Typ.Procname.get_default_objc_class_method (Typ.Name.name type_name); - switch (find_tenv_from_class_of_proc class_method) { - | Some tenv => - *) - Some (Typ.mk (Tstruct type_name)) - let find_file_capturing_procedure pname = match load pname with | None diff --git a/infer/src/IR/Attributes.mli b/infer/src/IR/Attributes.mli index 5f38feb75..733f28c6b 100644 --- a/infer/src/IR/Attributes.mli +++ b/infer/src/IR/Attributes.mli @@ -20,11 +20,6 @@ val load : Typ.Procname.t -> ProcAttributes.t option val load_defined : Typ.Procname.t -> ProcAttributes.t option (** Load attributes for the procedure but only if is_defined is true *) -val get_correct_type_from_objc_class_name : Typ.Name.t -> Typ.t option -(** Given the name of an ObjC class, extract the type from the tenv where the class was defined. We - do this by adding a method that is unique to each class, and then finding the tenv that - corresponds to the class definition. *) - val find_file_capturing_procedure : Typ.Procname.t -> (SourceFile.t * [`Include | `Source]) option (** Find the file where the procedure was captured, if a cfg for that file exists. Return also a boolean indicating whether the procedure is defined in an diff --git a/infer/src/IR/Typ.ml b/infer/src/IR/Typ.ml index d7e4056ba..8ae3d56c9 100644 --- a/infer/src/IR/Typ.ml +++ b/infer/src/IR/Typ.ml @@ -614,12 +614,6 @@ module Procname = struct let objc_cpp class_name method_name kind template_args ~is_generic_model = {class_name; method_name; kind; template_args; is_generic_model} - let get_default_objc_class_method objc_class = - let objc_cpp = - objc_cpp objc_class "__find_class_" ObjCInternalMethod NoTemplate ~is_generic_model:false - in - ObjC_Cpp objc_cpp - (** Create an objc procedure name from a class_name and method_name. *) let mangled_objc_block name = Block name diff --git a/infer/src/IR/Typ.mli b/infer/src/IR/Typ.mli index 56e55c4b7..4fe0edd55 100644 --- a/infer/src/IR/Typ.mli +++ b/infer/src/IR/Typ.mli @@ -374,8 +374,6 @@ module Procname : sig -> objc_cpp (** Create an objc procedure name from a class_name and method_name. *) - val get_default_objc_class_method : Name.t -> t - val objc_cpp_get_class_name : objc_cpp -> string (** Get the class name of a Objective-C/C++ procedure name. *) diff --git a/infer/src/backend/BuiltinDefn.ml b/infer/src/backend/BuiltinDefn.ml index 2b0e08c9e..8801e9604 100644 --- a/infer/src/backend/BuiltinDefn.ml +++ b/infer/src/backend/BuiltinDefn.ml @@ -765,15 +765,6 @@ let execute_alloc mk can_return_null {Builtin.pdesc; tenv; prop_; path; ret_id; in let size_exp, procname = match args with - | [((Exp.Sizeof ({typ= {Typ.desc= Tstruct (ObjcClass _ as name)}} as sizeof_data) as e), _)] - -> let e' = - match Attributes.get_correct_type_from_objc_class_name name with - | Some struct_type - -> Exp.Sizeof {sizeof_data with typ= struct_type} - | None - -> e - in - (e', pname) | [(size_exp, _)] -> (* for malloc and __new *) (size_exp, PredSymb.mem_alloc_pname mk) diff --git a/infer/src/clang/cFrontend_decl.ml b/infer/src/clang/cFrontend_decl.ml index b61771f74..06fddc9c1 100644 --- a/infer/src/clang/cFrontend_decl.ml +++ b/infer/src/clang/cFrontend_decl.ml @@ -277,12 +277,10 @@ module CFrontend_decl_funct (T : CModule_type.CTranslation) : CModule_type.CFron -> let curr_class = CContext.ContextClsDeclPtr dec_ptr in ignore (ObjcCategory_decl.category_impl_decl CType_decl.qual_type_to_sil_type tenv dec) ; process_methods trans_unit_ctx tenv cg cfg curr_class decl_list - | ObjCImplementationDecl (decl_info, _, decl_list, _, _) + | ObjCImplementationDecl (_, _, decl_list, _, _) -> let curr_class = CContext.ContextClsDeclPtr dec_ptr in - let class_typename = CType_decl.get_record_typename ~tenv dec in let qual_type_to_sil_type = CType_decl.qual_type_to_sil_type in ignore (ObjcInterface_decl.interface_impl_declaration qual_type_to_sil_type tenv dec) ; - CMethod_trans.add_default_method_for_class trans_unit_ctx class_typename decl_info ; process_methods trans_unit_ctx tenv cg cfg curr_class decl_list | CXXMethodDecl (decl_info, _, _, _, _) | CXXConstructorDecl (decl_info, _, _, _, _) diff --git a/infer/src/clang/cMethod_trans.ml b/infer/src/clang/cMethod_trans.ml index 2f867062a..8437ca61a 100644 --- a/infer/src/clang/cMethod_trans.ml +++ b/infer/src/clang/cMethod_trans.ml @@ -652,14 +652,6 @@ let create_procdesc_with_pointer context pointer class_name_opt name = in create_external_procdesc context.cfg callee_name false None ; callee_name -let add_default_method_for_class trans_unit_ctx class_name decl_info = - let loc = - CLocation.get_sil_location_from_range trans_unit_ctx decl_info.Clang_ast_t.di_source_range true - in - let proc_name = Typ.Procname.get_default_objc_class_method class_name in - let attrs = {(ProcAttributes.default proc_name Config.Clang) with loc} in - Attributes.store attrs - let get_procname_from_cpp_lambda context dec = match dec with | Clang_ast_t.CXXRecordDecl (_, _, _, _, _, _, _, cxx_rdi) -> ( diff --git a/infer/src/clang/cMethod_trans.mli b/infer/src/clang/cMethod_trans.mli index 6f2a41c55..d137d5815 100644 --- a/infer/src/clang/cMethod_trans.mli +++ b/infer/src/clang/cMethod_trans.mli @@ -55,9 +55,6 @@ val get_method_name_from_clang : val create_procdesc_with_pointer : CContext.t -> Clang_ast_t.pointer -> Typ.Name.t option -> string -> Typ.Procname.t -val add_default_method_for_class : - CFrontend_config.translation_unit_context -> Typ.Name.t -> Clang_ast_t.decl_info -> unit - val get_procname_from_cpp_lambda : CContext.t -> Clang_ast_t.decl -> Typ.Procname.t val get_captures_from_cpp_lambda : Clang_ast_t.decl -> Clang_ast_t.lambda_capture_info list