[cleanup] Remove unused code for finding correct fields in Objective-C

Reviewed By: sblackshear

Differential Revision: D6110019

fbshipit-source-id: 6471203
master
Dulma Churchill 7 years ago committed by Facebook Github Bot
parent b826b16a6f
commit a969b5d188

@ -131,14 +131,6 @@ let store (attr: ProcAttributes.t) =
let load_defined pname = Data.of_pname pname |> find ~defined:true 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 = let find_file_capturing_procedure pname =
match load pname with match load pname with
| None | None

@ -20,11 +20,6 @@ val load : Typ.Procname.t -> ProcAttributes.t option
val load_defined : 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 *) (** 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 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. (** 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 Return also a boolean indicating whether the procedure is defined in an

@ -614,12 +614,6 @@ module Procname = struct
let objc_cpp class_name method_name kind template_args ~is_generic_model = let objc_cpp class_name method_name kind template_args ~is_generic_model =
{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. *) (** Create an objc procedure name from a class_name and method_name. *)
let mangled_objc_block name = Block name let mangled_objc_block name = Block name

@ -374,8 +374,6 @@ module Procname : sig
-> objc_cpp -> objc_cpp
(** Create an objc procedure name from a class_name and method_name. *) (** 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 val objc_cpp_get_class_name : objc_cpp -> string
(** Get the class name of a Objective-C/C++ procedure name. *) (** Get the class name of a Objective-C/C++ procedure name. *)

@ -765,15 +765,6 @@ let execute_alloc mk can_return_null {Builtin.pdesc; tenv; prop_; path; ret_id;
in in
let size_exp, procname = let size_exp, procname =
match args with 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, _)] | [(size_exp, _)]
-> (* for malloc and __new *) -> (* for malloc and __new *)
(size_exp, PredSymb.mem_alloc_pname mk) (size_exp, PredSymb.mem_alloc_pname mk)

@ -277,12 +277,10 @@ module CFrontend_decl_funct (T : CModule_type.CTranslation) : CModule_type.CFron
-> let curr_class = CContext.ContextClsDeclPtr dec_ptr in -> let curr_class = CContext.ContextClsDeclPtr dec_ptr in
ignore (ObjcCategory_decl.category_impl_decl CType_decl.qual_type_to_sil_type tenv dec) ; 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 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 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 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) ; 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 process_methods trans_unit_ctx tenv cg cfg curr_class decl_list
| CXXMethodDecl (decl_info, _, _, _, _) | CXXMethodDecl (decl_info, _, _, _, _)
| CXXConstructorDecl (decl_info, _, _, _, _) | CXXConstructorDecl (decl_info, _, _, _, _)

@ -652,14 +652,6 @@ let create_procdesc_with_pointer context pointer class_name_opt name =
in in
create_external_procdesc context.cfg callee_name false None ; callee_name 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 = let get_procname_from_cpp_lambda context dec =
match dec with match dec with
| Clang_ast_t.CXXRecordDecl (_, _, _, _, _, _, _, cxx_rdi) -> ( | Clang_ast_t.CXXRecordDecl (_, _, _, _, _, _, _, cxx_rdi) -> (

@ -55,9 +55,6 @@ val get_method_name_from_clang :
val create_procdesc_with_pointer : val create_procdesc_with_pointer :
CContext.t -> Clang_ast_t.pointer -> Typ.Name.t option -> string -> Typ.Procname.t 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_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 val get_captures_from_cpp_lambda : Clang_ast_t.decl -> Clang_ast_t.lambda_capture_info list

Loading…
Cancel
Save