[frontend] Clean up method creation

Summary: the tittle

Reviewed By: ezgicicek

Differential Revision: D23472326

fbshipit-source-id: 13516e6ab
master
Daiva Naudziuniene 5 years ago committed by Facebook GitHub Bot
parent 44ff6df1d6
commit 20a8890fd5

@ -96,33 +96,25 @@ module CFrontend_decl_funct (T : CModule_type.CTranslation) : CModule_type.CFron
| Some body -> | Some body ->
let procname = ms.CMethodSignature.name in let procname = ms.CMethodSignature.name in
let return_param_typ_opt = ms.CMethodSignature.return_param_typ in let return_param_typ_opt = ms.CMethodSignature.return_param_typ in
let ms', procname' = let add_method_if_create_procdesc ms procname ~is_destructor_wrapper =
if is_destructor then ( if
(* For a destructor we create two procedures: a destructor wrapper and an inner destructor *) CMethod_trans.create_local_procdesc ~set_objc_accessor_attr trans_unit_ctx cfg tenv ms
(* A destructor wrapper is called from the outside, i.e. for destructing local variables and fields *) [body] []
(* The destructor wrapper calls the inner destructor which has the actual body *) then
if add_method trans_unit_ctx tenv cfg curr_class procname body ms return_param_typ_opt
CMethod_trans.create_local_procdesc ~set_objc_accessor_attr trans_unit_ctx cfg tenv None extra_instrs ~is_destructor_wrapper
ms [body] []
then
add_method trans_unit_ctx tenv cfg curr_class procname body ms return_param_typ_opt
None extra_instrs ~is_destructor_wrapper:true ;
let new_method_name =
Config.clang_inner_destructor_prefix ^ Procname.get_method procname
in
let ms' =
{ms with name= Procname.objc_cpp_replace_method_name procname new_method_name}
in
let procname' = ms'.CMethodSignature.name in
(ms', procname') )
else (ms, procname)
in in
if ignore (add_method_if_create_procdesc ms procname ~is_destructor_wrapper:is_destructor) ;
CMethod_trans.create_local_procdesc ~set_objc_accessor_attr trans_unit_ctx cfg tenv ms' if is_destructor then
[body] [] (* For a destructor we create two procedures: a destructor wrapper and an inner destructor *)
then (* A destructor wrapper is called from the outside, i.e. for destructing local variables and fields *)
add_method trans_unit_ctx tenv cfg curr_class procname' body ms' return_param_typ_opt (* The destructor wrapper calls the inner destructor which has the actual body *)
None extra_instrs ~is_destructor_wrapper:false let new_method_name =
Config.clang_inner_destructor_prefix ^ Procname.get_method procname
in
let new_procname = Procname.objc_cpp_replace_method_name procname new_method_name in
let new_ms = {ms with name= new_procname} in
add_method_if_create_procdesc new_ms new_procname ~is_destructor_wrapper:false
| None -> | None ->
if set_objc_accessor_attr then if set_objc_accessor_attr then
ignore ignore

Loading…
Cancel
Save