[CFrontend] Replace names containing Method with ObjCMethod

Summary: since C++ has methods as well, make names more explicit
master
Andrzej Kotulski 9 years ago
parent 198c3c82e1
commit a570bf5b85

@ -388,7 +388,7 @@ struct
let type_name_crc = CRC.crc16 type_name in
Procname.mangled_c_fun name type_name_crc
let mk_procname_from_method class_name method_name method_kind =
let mk_procname_from_objc_method class_name method_name method_kind =
let mangled = Procname.mangled_of_objc_method_kind method_kind in
Procname.mangled_c_method class_name method_name mangled

@ -118,7 +118,7 @@ sig
val replicate: int -> 'a -> 'a list
val mk_procname_from_method : string -> string -> Procname.objc_method_kind -> Procname.t
val mk_procname_from_objc_method : string -> string -> Procname.objc_method_kind -> Procname.t
val mk_procname_from_function : string -> string -> Procname.t

@ -30,14 +30,14 @@ type method_call_type =
type function_method_decl_info =
| Func_decl_info of Clang_ast_t.function_decl_info * string
| Cpp_Meth_decl_info of Clang_ast_t.function_decl_info * string (* class_name *) * string (* ret_type *)
| Meth_decl_info of Clang_ast_t.obj_c_method_decl_info * string
| ObjC_Meth_decl_info of Clang_ast_t.obj_c_method_decl_info * string
| Block_decl_info of Clang_ast_t.block_decl_info * string
let is_instance_method function_method_decl_info is_instance =
match function_method_decl_info with
| Func_decl_info (function_decl_info, _) -> false
| Cpp_Meth_decl_info _ -> true
| Meth_decl_info (method_decl_info, _) ->
| ObjC_Meth_decl_info (method_decl_info, _) ->
method_decl_info.Clang_ast_t.omdi_is_instance_method
| Block_decl_info (block_decl_info, _) -> is_instance
@ -45,7 +45,7 @@ let get_class_param function_method_decl_info =
if (is_instance_method function_method_decl_info false) then
match function_method_decl_info with
| Cpp_Meth_decl_info (_, class_name, _) -> [(CFrontend_config.this, class_name, None)]
| Meth_decl_info (_, class_name) -> [(CFrontend_config.self, class_name, None)]
| ObjC_Meth_decl_info (_, class_name) -> [(CFrontend_config.self, class_name, None)]
| _ -> []
else []
@ -53,7 +53,7 @@ let get_param_decls function_method_decl_info =
match function_method_decl_info with
| Func_decl_info (function_decl_info, _)
| Cpp_Meth_decl_info (function_decl_info, _, _) -> function_decl_info.Clang_ast_t.fdi_parameters
| Meth_decl_info (method_decl_info, _) -> method_decl_info.Clang_ast_t.omdi_parameters
| ObjC_Meth_decl_info (method_decl_info, _) -> method_decl_info.Clang_ast_t.omdi_parameters
| Block_decl_info (block_decl_info, _) -> block_decl_info.Clang_ast_t.bdi_parameters
let get_parameters function_method_decl_info =
@ -74,7 +74,7 @@ let get_return_type function_method_decl_info =
| Func_decl_info (_, typ)
| Cpp_Meth_decl_info (_, _, typ)
| Block_decl_info (_, typ) -> typ
| Meth_decl_info (method_decl_info, _) ->
| ObjC_Meth_decl_info (method_decl_info, _) ->
let qt = method_decl_info.Clang_ast_t.omdi_result_type in
CTypes.get_type qt
@ -107,8 +107,8 @@ let method_signature_of_decl curr_class meth_decl block_data_opt =
let method_name = name_info.Clang_ast_t.ni_name in
let is_instance = mdi.Clang_ast_t.omdi_is_instance_method in
let method_kind = Procname.objc_method_kind_of_bool is_instance in
let procname = General_utils.mk_procname_from_method class_name method_name method_kind in
let method_decl = Meth_decl_info (mdi, class_name) in
let procname = General_utils.mk_procname_from_objc_method class_name method_name method_kind in
let method_decl = ObjC_Meth_decl_info (mdi, class_name) in
let is_generated = Ast_utils.is_generated name_info in
let ms = build_method_signature decl_info procname method_decl false false is_generated in
ms, mdi.Clang_ast_t.omdi_body, mdi.Clang_ast_t.omdi_parameters

@ -45,19 +45,19 @@ struct
let is_instance = mc_type != CMethod_trans.MCStatic in
let method_kind = Procname.objc_method_kind_of_bool is_instance in
match CTrans_models.get_predefined_model_method_signature class_name method_name
General_utils.mk_procname_from_method with
General_utils.mk_procname_from_objc_method with
| Some ms ->
ignore (CMethod_trans.create_local_procdesc context.cfg context.tenv ms [] [] is_instance);
CMethod_signature.ms_get_name ms, CMethod_trans.MCNoVirtual
| None ->
let procname = General_utils.mk_procname_from_method class_name method_name method_kind in
let procname = General_utils.mk_procname_from_objc_method class_name method_name method_kind in
try
let callee_ms = CMethod_signature.find procname in
if not (M.process_getter_setter context procname) then
(ignore (CMethod_trans.create_local_procdesc context.cfg context.tenv callee_ms [] [] is_instance));
procname, mc_type
with Not_found ->
let callee_pn = General_utils.mk_procname_from_method class_name method_name method_kind in
let callee_pn = General_utils.mk_procname_from_objc_method class_name method_name method_kind in
CMethod_trans.create_external_procdesc context.cfg callee_pn is_instance None;
callee_pn, mc_type

@ -305,7 +305,7 @@ let objc_new_trans trans_state loc stmt_info cls_name function_type =
let init_ret_id = Ident.create_fresh Ident.knormal in
let is_instance = true in
let call_flags = { Sil.cf_virtual = is_instance; Sil.cf_noreturn = false; Sil.cf_is_objc_block = false; } in
let pname = General_utils.mk_procname_from_method cls_name CFrontend_config.init Procname.Instance_objc_method in
let pname = General_utils.mk_procname_from_objc_method cls_name CFrontend_config.init Procname.Instance_objc_method in
CMethod_trans.create_external_procdesc trans_state.context.cfg pname is_instance None;
let args = [(Sil.Var alloc_ret_id, alloc_ret_type)] in
let init_stmt_call = Sil.Call([init_ret_id], (Sil.Const (Sil.Cfun pname)), args, loc, call_flags) in

@ -364,13 +364,13 @@ let get_methods curr_class decl_list =
add_properties_to_table curr_class decl_list;
let get_method decl list_methods =
match decl with
ObjCMethodDecl(decl_info, name_info, method_decl_info) as d ->
ObjCMethodDecl(decl_info, name_info, method_decl_info) ->
let is_instance = method_decl_info.Clang_ast_t.omdi_is_instance_method in
let method_kind = Procname.objc_method_kind_of_bool is_instance in
let method_name = name_info.Clang_ast_t.ni_name in
Printing.log_out " ...Adding Method '%s' \n" (class_name^"_"^method_name);
let _ = check_for_property curr_class method_name d method_decl_info.Clang_ast_t.omdi_body in
let meth_name = General_utils.mk_procname_from_method class_name method_name method_kind in
let _ = check_for_property curr_class method_name decl method_decl_info.Clang_ast_t.omdi_body in
let meth_name = General_utils.mk_procname_from_objc_method class_name method_name method_kind in
meth_name:: list_methods
| _ -> list_methods in
list_fold_right get_method decl_list []

Loading…
Cancel
Save