|
|
@ -94,6 +94,7 @@ module CFrontend_decl_funct (T : CModule_type.CTranslation) : CModule_type.CFron
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let function_decl trans_unit_ctx tenv cfg func_decl block_data_opt =
|
|
|
|
let function_decl trans_unit_ctx tenv cfg func_decl block_data_opt =
|
|
|
|
|
|
|
|
try
|
|
|
|
let captured_vars, outer_context_opt =
|
|
|
|
let captured_vars, outer_context_opt =
|
|
|
|
match block_data_opt with
|
|
|
|
match block_data_opt with
|
|
|
|
| Some (outer_context, _, _, captured_vars) ->
|
|
|
|
| Some (outer_context, _, _, captured_vars) ->
|
|
|
@ -109,15 +110,20 @@ module CFrontend_decl_funct (T : CModule_type.CTranslation) : CModule_type.CFron
|
|
|
|
(* Only in the case the function declaration has a defined body we create a procdesc *)
|
|
|
|
(* Only in the case the function declaration has a defined body we create a procdesc *)
|
|
|
|
let procname = CMethod_signature.ms_get_name ms in
|
|
|
|
let procname = CMethod_signature.ms_get_name ms in
|
|
|
|
let return_param_typ_opt = CMethod_signature.ms_get_return_param_typ ms in
|
|
|
|
let return_param_typ_opt = CMethod_signature.ms_get_return_param_typ ms in
|
|
|
|
if CMethod_trans.create_local_procdesc trans_unit_ctx cfg tenv ms [body] captured_vars then
|
|
|
|
if CMethod_trans.create_local_procdesc trans_unit_ctx cfg tenv ms [body] captured_vars
|
|
|
|
|
|
|
|
then
|
|
|
|
add_method trans_unit_ctx tenv cfg CContext.ContextNoCls procname body ms
|
|
|
|
add_method trans_unit_ctx tenv cfg CContext.ContextNoCls procname body ms
|
|
|
|
return_param_typ_opt false outer_context_opt extra_instrs
|
|
|
|
return_param_typ_opt false outer_context_opt extra_instrs
|
|
|
|
| None ->
|
|
|
|
| None ->
|
|
|
|
()
|
|
|
|
()
|
|
|
|
|
|
|
|
with CFrontend_config.IncorrectAssumption e ->
|
|
|
|
|
|
|
|
ClangLogging.log_caught_exception trans_unit_ctx "IncorrectAssumption" e.position
|
|
|
|
|
|
|
|
e.source_range e.ast_node
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let process_method_decl ?(set_objc_accessor_attr= false) ?(is_destructor= false) trans_unit_ctx
|
|
|
|
let process_method_decl ?(set_objc_accessor_attr= false) ?(is_destructor= false) trans_unit_ctx
|
|
|
|
tenv cfg curr_class meth_decl ~is_objc =
|
|
|
|
tenv cfg curr_class meth_decl ~is_objc =
|
|
|
|
|
|
|
|
try
|
|
|
|
let ms, body_opt, extra_instrs =
|
|
|
|
let ms, body_opt, extra_instrs =
|
|
|
|
CMethod_trans.method_signature_of_decl trans_unit_ctx tenv meth_decl None
|
|
|
|
CMethod_trans.method_signature_of_decl trans_unit_ctx tenv meth_decl None
|
|
|
|
in
|
|
|
|
in
|
|
|
@ -130,8 +136,8 @@ module CFrontend_decl_funct (T : CModule_type.CTranslation) : CModule_type.CFron
|
|
|
|
(* For a destructor we create two procedures: a destructor wrapper and an inner destructor *)
|
|
|
|
(* For a destructor we create two procedures: a destructor wrapper and an inner destructor *)
|
|
|
|
(* A destructor wrapper is called from the outside, i.e. for destructing local variables and fields *)
|
|
|
|
(* A destructor wrapper is called from the outside, i.e. for destructing local variables and fields *)
|
|
|
|
(* The destructor wrapper calls the inner destructor which has the actual body *)
|
|
|
|
(* The destructor wrapper calls the inner destructor which has the actual body *)
|
|
|
|
if CMethod_trans.create_local_procdesc ~set_objc_accessor_attr trans_unit_ctx cfg tenv
|
|
|
|
if CMethod_trans.create_local_procdesc ~set_objc_accessor_attr trans_unit_ctx cfg
|
|
|
|
ms [body] []
|
|
|
|
tenv ms [body] []
|
|
|
|
then
|
|
|
|
then
|
|
|
|
add_method trans_unit_ctx tenv cfg curr_class procname body ms return_param_typ_opt
|
|
|
|
add_method trans_unit_ctx tenv cfg curr_class procname body ms return_param_typ_opt
|
|
|
|
is_objc None extra_instrs ~is_destructor_wrapper:true ;
|
|
|
|
is_objc None extra_instrs ~is_destructor_wrapper:true ;
|
|
|
@ -146,16 +152,19 @@ module CFrontend_decl_funct (T : CModule_type.CTranslation) : CModule_type.CFron
|
|
|
|
(ms', procname') )
|
|
|
|
(ms', procname') )
|
|
|
|
else (ms, procname)
|
|
|
|
else (ms, procname)
|
|
|
|
in
|
|
|
|
in
|
|
|
|
if CMethod_trans.create_local_procdesc ~set_objc_accessor_attr trans_unit_ctx cfg tenv ms'
|
|
|
|
if CMethod_trans.create_local_procdesc ~set_objc_accessor_attr trans_unit_ctx cfg tenv
|
|
|
|
[body] []
|
|
|
|
ms' [body] []
|
|
|
|
then
|
|
|
|
then
|
|
|
|
add_method trans_unit_ctx tenv cfg curr_class procname' body ms' return_param_typ_opt
|
|
|
|
add_method trans_unit_ctx tenv cfg curr_class procname' body ms' return_param_typ_opt
|
|
|
|
is_objc None extra_instrs ~is_destructor_wrapper:false
|
|
|
|
is_objc None extra_instrs ~is_destructor_wrapper:false
|
|
|
|
| None ->
|
|
|
|
| None ->
|
|
|
|
if set_objc_accessor_attr then
|
|
|
|
if set_objc_accessor_attr then
|
|
|
|
ignore
|
|
|
|
ignore
|
|
|
|
(CMethod_trans.create_local_procdesc ~set_objc_accessor_attr trans_unit_ctx cfg tenv ms
|
|
|
|
(CMethod_trans.create_local_procdesc ~set_objc_accessor_attr trans_unit_ctx cfg tenv
|
|
|
|
[] [])
|
|
|
|
ms [] [])
|
|
|
|
|
|
|
|
with CFrontend_config.IncorrectAssumption e ->
|
|
|
|
|
|
|
|
ClangLogging.log_caught_exception trans_unit_ctx "IncorrectAssumption" e.position
|
|
|
|
|
|
|
|
e.source_range e.ast_node
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let process_property_implementation trans_unit_ctx tenv cfg curr_class
|
|
|
|
let process_property_implementation trans_unit_ctx tenv cfg curr_class
|
|
|
|