[clang] remove named node_name

Summary:
A minor but persistent annoyance: named argument of a non-ambiguous type
of almost the same name. No.

Reviewed By: skcho

Differential Revision: D24991673

fbshipit-source-id: c806f9cec
master
Jules Villard 4 years ago committed by Facebook GitHub Bot
parent 29f3941600
commit 73195ca203

@ -110,7 +110,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
CLocation.location_of_stmt_info trans_state.context.translation_unit_context.source_file
stmt_info'
in
PriorityNode.compute_result_to_parent trans_state_pri sil_loc ~node_name stmt_info' res_trans
PriorityNode.compute_result_to_parent trans_state_pri sil_loc node_name stmt_info' res_trans
else res_trans
@ -1053,7 +1053,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
([binop_control], return)
in
let all_res_trans = [res_trans_e1.control; res_trans_e2.control] @ binop_control in
PriorityNode.compute_controls_to_parent trans_state_pri sil_loc ~node_name stmt_info
PriorityNode.compute_controls_to_parent trans_state_pri sil_loc node_name stmt_info
all_res_trans
|> mk_trans_result return
| _ ->
@ -1118,7 +1118,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
in
let node_name = Procdesc.Node.Call (Exp.to_string sil_fe) in
let all_res_trans = res_trans_callee :: (result_trans_params @ [res_trans_call]) in
PriorityNode.compute_results_to_parent trans_state_pri sil_loc ~node_name si
PriorityNode.compute_results_to_parent trans_state_pri sil_loc node_name si
~return:res_trans_call.return all_res_trans
@ -1137,7 +1137,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
in
let node_name = Procdesc.Node.Call (Exp.to_string sil_fe) in
let all_res_trans = [result_trans_param; res_trans_call] in
PriorityNode.compute_results_to_parent trans_state_pri sil_loc ~node_name si
PriorityNode.compute_results_to_parent trans_state_pri sil_loc node_name si
~return:res_trans_call.return all_res_trans
@ -1178,7 +1178,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
let all_res_trans =
result_trans_params @ (res_trans_call :: Option.to_list extra_res_trans)
in
PriorityNode.compute_results_to_parent trans_state_pri sil_loc ~node_name si
PriorityNode.compute_results_to_parent trans_state_pri sil_loc node_name si
~return:res_trans_call.return all_res_trans
@ -1402,7 +1402,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
let all_res_trans =
res_trans_subexpr_list @ (res_trans_call :: Option.to_list assertion_trans_opt)
in
PriorityNode.compute_results_to_parent trans_state_pri sil_loc ~node_name si
PriorityNode.compute_results_to_parent trans_state_pri sil_loc node_name si
~return:res_trans_call.return all_res_trans
@ -1452,8 +1452,8 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
in
Some
(PriorityNode.compute_results_to_parent trans_state_pri sil_loc
~node_name:(Destruction DestrVirtualBase) stmt_info_loc
~return:(mk_fresh_void_exp_typ ()) all_res_trans)
(Destruction DestrVirtualBase) stmt_info_loc ~return:(mk_fresh_void_exp_typ ())
all_res_trans)
and cxx_inject_field_destructors_in_destructor_body trans_state stmt_info =
@ -1511,9 +1511,8 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
CLocation.location_of_stmt_info context.translation_unit_context.source_file stmt_info
in
Some
(PriorityNode.compute_results_to_parent trans_state_pri sil_loc
~node_name:(Destruction DestrFields) stmt_info' ~return:(mk_fresh_void_exp_typ ())
all_res_trans)
(PriorityNode.compute_results_to_parent trans_state_pri sil_loc (Destruction DestrFields)
stmt_info' ~return:(mk_fresh_void_exp_typ ()) all_res_trans)
and destructor_calls destr_kind trans_state stmt_info vars_to_destroy =
@ -1545,9 +1544,8 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
CLocation.location_of_stmt_info context.translation_unit_context.source_file stmt_info
in
Some
(PriorityNode.compute_results_to_parent trans_state_pri sil_loc
~node_name:(Destruction destr_kind) stmt_info' ~return:(mk_fresh_void_exp_typ ())
all_res_trans)
(PriorityNode.compute_results_to_parent trans_state_pri sil_loc (Destruction destr_kind)
stmt_info' ~return:(mk_fresh_void_exp_typ ()) all_res_trans)
and inject_destructors destr_kind trans_state stmt_info =
@ -1620,8 +1618,8 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
([res_trans_b; tmp_var_res_trans], return)
in
let res_trans =
PriorityNode.compute_results_to_parent trans_state_pri sil_loc
~node_name:ConditionalStmtBranch stmt_info ~return all_res_trans
PriorityNode.compute_results_to_parent trans_state_pri sil_loc ConditionalStmtBranch
stmt_info ~return all_res_trans
in
let prune_nodes_t, prune_nodes_f = List.partition_tf ~f:is_true_prune_node prune_nodes in
let prune_nodes' = if branch then prune_nodes_t else prune_nodes_f in
@ -1733,7 +1731,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
in
L.debug Capture Verbose "op_res_trans.control=%a@\n" pp_control op_res_trans.control ;
PriorityNode.compute_results_to_parent trans_state_pri sil_loc ~return:op_res_trans.return
~node_name:BinaryConditionalStmtInit stmt_info [init_res_trans; op_res_trans]
BinaryConditionalStmtInit stmt_info [init_res_trans; op_res_trans]
| _ ->
CFrontend_errors.unimplemented __POS__ stmt_info.Clang_ast_t.si_source_range
"BinaryConditionalOperator not translated"
@ -2472,8 +2470,8 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
"InitListExp for var %a of type %a" Exp.pp var_exp (Typ.pp Pp.text) var_typ
in
let res_trans =
PriorityNode.compute_results_to_parent trans_state_pri sil_loc ~node_name:InitListExp
stmt_info ~return:(var_exp, var_typ) all_res_trans
PriorityNode.compute_results_to_parent trans_state_pri sil_loc InitListExp stmt_info
~return:(var_exp, var_typ) all_res_trans
in
{res_trans with control= {res_trans.control with initd_exps= [var_exp]}}
@ -2497,8 +2495,8 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
Sil.Call (ret_id_typ, call_exp, actuals, sil_loc, CallFlags.default)
in
let call_trans_control = {empty_control with instrs= [call_instr]} in
PriorityNode.compute_controls_to_parent trans_state_pri sil_loc
~node_name:InitializeDynamicArrayLength dynlength_stmt_info
PriorityNode.compute_controls_to_parent trans_state_pri sil_loc InitializeDynamicArrayLength
dynlength_stmt_info
[dynlength_trans_result.control; call_trans_control]
|> mk_trans_result ret_exp_typ
@ -2545,8 +2543,8 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
let all_res_trans = res_trans_ie.control :: Option.to_list assign_trans_control_opt in
L.debug Capture Verbose "sending init_expr_trans results to parent@\n" ;
let control =
PriorityNode.compute_controls_to_parent trans_state_pri sil_loc ~node_name:DeclStmt
var_stmt_info all_res_trans
PriorityNode.compute_controls_to_parent trans_state_pri sil_loc DeclStmt var_stmt_info
all_res_trans
in
mk_trans_result var_exp_typ control
@ -2817,8 +2815,8 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
in
let unary_op_control = {empty_control with instrs= instr_op} in
let all_control = [res_trans_stmt.control; unary_op_control] in
PriorityNode.compute_controls_to_parent trans_state_pri sil_loc ~node_name:UnaryOperator
stmt_info all_control
PriorityNode.compute_controls_to_parent trans_state_pri sil_loc UnaryOperator stmt_info
all_control
|> mk_trans_result (exp_op, ret_typ)
@ -2904,11 +2902,10 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
let trans_state =
PriorityNode.force_claim_priority_node trans_state_pri stmt_info
in
PriorityNode.compute_control_to_parent trans_state sil_loc ~node_name:ReturnStmt
stmt_info control )
PriorityNode.compute_control_to_parent trans_state sil_loc ReturnStmt stmt_info
control )
in
PriorityNode.compute_controls_to_parent trans_state' sil_loc ~node_name:ReturnStmt
stmt_info
PriorityNode.compute_controls_to_parent trans_state' sil_loc ReturnStmt stmt_info
(Option.to_list var_control @ [res_trans_stmt.control])
in
let ret_instrs =
@ -2928,8 +2925,8 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
let ret_control =
{empty_control with root_nodes= [ret_node]; leaf_nodes= [ret_node]; instrs= []}
in
PriorityNode.compute_controls_to_parent trans_state_pri sil_loc ~node_name:ReturnStmt
stmt_info [controls; ret_control]
PriorityNode.compute_controls_to_parent trans_state_pri sil_loc ReturnStmt stmt_info
[controls; ret_control]
|> mk_trans_result res_trans_stmt.return
| [] ->
(* return; *)
@ -3462,8 +3459,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
Option.to_list control_size @ [res_trans_placement_control; res_trans_new.control]
in
let trans_result =
PriorityNode.compute_controls_to_parent trans_state sil_loc ~node_name:CXXNewExpr stmt_info
controls
PriorityNode.compute_controls_to_parent trans_state sil_loc CXXNewExpr stmt_info controls
|> mk_trans_result res_trans_new.return
in
let var_exp_typ =
@ -3499,7 +3495,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
let stmts = create_stmts stmt_opt size_exp_opt in
let var_exp, var_typ = var_exp_typ in
initListExpr_array_trans trans_state_init init_stmt_info stmts var_exp var_typ
|> PriorityNode.compute_results_to_parent trans_state_init sil_loc ~node_name:CXXNewExpr
|> PriorityNode.compute_results_to_parent trans_state_init sil_loc CXXNewExpr
~return:var_exp_typ init_stmt_info
| _ ->
init_expr_trans trans_state_init var_exp_typ init_stmt_info stmt_opt
@ -3553,8 +3549,8 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
(* --- END OF DEAD CODE --- *)
else [result_trans_param; call_res_trans]
in
PriorityNode.compute_results_to_parent trans_state_pri sil_loc ~node_name:(Call "delete")
stmt_info ~return:call_return all_res_trans
PriorityNode.compute_results_to_parent trans_state_pri sil_loc (Call "delete") stmt_info
~return:call_return all_res_trans
and materializeTemporaryExpr_trans trans_state stmt_info stmt_list expr_info =
@ -3617,8 +3613,8 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
let res_ex = Exp.Var ret_id in
let res_trans_dynamic_cast = {empty_control with instrs= [call]} in
let all_res_trans = [res_trans_stmt.control; res_trans_dynamic_cast] in
PriorityNode.compute_controls_to_parent trans_state_pri sil_loc ~node_name:CXXDynamicCast
stmt_info all_res_trans
PriorityNode.compute_controls_to_parent trans_state_pri sil_loc CXXDynamicCast stmt_info
all_res_trans
|> mk_trans_result (res_ex, cast_type)
@ -3648,7 +3644,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
mk_trans_result (Exp.Var ret_id, ret_typ) {empty_control with instrs= [call_instr]}
in
let all_res_trans = res_trans_subexpr_list @ [res_trans_call] in
PriorityNode.compute_results_to_parent trans_state_pri sil_loc ~node_name:instr_name stmt_info
PriorityNode.compute_results_to_parent trans_state_pri sil_loc instr_name stmt_info
~return:res_trans_call.return all_res_trans
@ -3729,8 +3725,8 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
| None ->
[res_control]
in
PriorityNode.compute_controls_to_parent trans_state_pri sil_loc ~node_name:CXXTypeidExpr
stmt_info all_res_trans
PriorityNode.compute_controls_to_parent trans_state_pri sil_loc CXXTypeidExpr stmt_info
all_res_trans
|> mk_trans_result (ret_exp, typ)
@ -3754,8 +3750,8 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
in
let res_trans_call = mk_trans_result (ret_exp, typ) {empty_control with instrs= [res_instr]} in
let all_res_trans = res_trans_subexpr_list @ [res_trans_call] in
PriorityNode.compute_results_to_parent trans_state_pri sil_loc
~node_name:CXXStdInitializerListExpr stmt_info ~return:res_trans_call.return all_res_trans
PriorityNode.compute_results_to_parent trans_state_pri sil_loc CXXStdInitializerListExpr
stmt_info ~return:res_trans_call.return all_res_trans
and binaryOperator_trans_with_cond trans_state stmt_info stmt_list expr_info binop_info =
@ -3885,7 +3881,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
in
dtor_call stmt_info dtor_trans_state dtor_decl_ref temporary
|> PriorityNode.compute_result_to_parent dtor_trans_state sil_loc
~node_name:(Destruction destr_kind) stmt_info
(Destruction destr_kind) stmt_info
in
(* create prune nodes *)
let marker_id = Ident.create_fresh Ident.knormal in
@ -3947,8 +3943,8 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
expr_trans_result
| _ :: _ as destr_trans_results ->
(* wire [destr_trans_result] after [expr_trans_result] in CFG order *)
PriorityNode.compute_results_to_parent trans_state sil_loc
~node_name:(Destruction destr_kind) stmt_info ~return:expr_trans_result.return
PriorityNode.compute_results_to_parent trans_state sil_loc (Destruction destr_kind)
stmt_info ~return:expr_trans_result.return
(expr_trans_result :: destr_trans_results)
@ -4017,12 +4013,11 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
let stmt_info = {stmt_info with Clang_ast_t.si_pointer= CAst_utils.get_fresh_pointer ()} in
let trans_state = PriorityNode.force_claim_priority_node trans_state stmt_info in
let markers_init_result =
PriorityNode.compute_result_to_parent trans_state loc ~node_name:ExprWithCleanups
stmt_info
PriorityNode.compute_result_to_parent trans_state loc ExprWithCleanups stmt_info
(mk_trans_result (Exp.zero, StdTyp.boolean)
{empty_control with instrs= init_markers_to_zero_instrs})
in
PriorityNode.compute_results_to_parent trans_state loc ~node_name:ExprWithCleanups stmt_info
PriorityNode.compute_results_to_parent trans_state loc ExprWithCleanups stmt_info
~return:sub_expr_result.return
[markers_init_result; sub_expr_result]
in
@ -4179,8 +4174,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
if List.is_empty instrs then stmt_result
else
let control =
PriorityNode.compute_controls_to_parent trans_state loc ~node_name:CXXTemporaryMarkerSet
stmt_info
PriorityNode.compute_controls_to_parent trans_state loc CXXTemporaryMarkerSet stmt_info
[stmt_result.control; {empty_control with instrs}]
in
let control = {control with cxx_temporary_markers_set} in
@ -4582,8 +4576,8 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
let var_exp_typ = var_res_trans.return in
let init_expr = ctor_init.Clang_ast_t.xci_init_expr in
let init_res_trans = init_expr_trans trans_state' var_exp_typ child_stmt_info init_expr in
PriorityNode.compute_results_to_parent trans_state' sil_loc ~node_name:ConstructorInit
this_stmt_info ~return:init_res_trans.return [var_res_trans; init_res_trans]
PriorityNode.compute_results_to_parent trans_state' sil_loc ConstructorInit this_stmt_info
~return:init_res_trans.return [var_res_trans; init_res_trans]
(** Given a translation state and list of translation functions it executes translation *)

@ -285,7 +285,7 @@ module PriorityNode = struct
(* It connects nodes returned by translation of stmt children and *)
(* deals with creating or not a cfg node depending of owning the *)
(* priority_node. It returns nodes, ids, instrs that should be passed to parent *)
let compute_controls_to_parent trans_state loc ~node_name stmt_info res_states_children =
let compute_controls_to_parent trans_state loc node_name stmt_info res_states_children =
let res_state = collect_controls trans_state.context.procdesc res_states_children in
L.debug Capture Verbose "collected controls: %a@\n" pp_control res_state ;
let create_node =
@ -321,18 +321,18 @@ module PriorityNode = struct
res_state )
let compute_results_to_parent trans_state loc ~node_name stmt_info ~return trans_results =
let compute_results_to_parent trans_state loc node_name stmt_info ~return trans_results =
List.map trans_results ~f:(fun trans_result -> trans_result.control)
|> compute_controls_to_parent trans_state loc ~node_name stmt_info
|> compute_controls_to_parent trans_state loc node_name stmt_info
|> mk_trans_result return
let compute_control_to_parent trans_state loc ~node_name stmt_info control =
compute_controls_to_parent trans_state loc ~node_name stmt_info [control]
let compute_control_to_parent trans_state loc node_name stmt_info control =
compute_controls_to_parent trans_state loc node_name stmt_info [control]
let compute_result_to_parent trans_state loc ~node_name stmt_info trans_result =
compute_control_to_parent trans_state loc ~node_name stmt_info trans_result.control
let compute_result_to_parent trans_state loc node_name stmt_info trans_result =
compute_control_to_parent trans_state loc node_name stmt_info trans_result.control
|> mk_trans_result trans_result.return
@ -343,11 +343,11 @@ module PriorityNode = struct
List.is_empty second_result.control.root_nodes
&& List.is_empty second_result.control.leaf_nodes
then first_result
else compute_result_to_parent trans_state loc ~node_name stmt_info first_result
else compute_result_to_parent trans_state loc node_name stmt_info first_result
in
L.debug Capture Verbose "sequential composition :@\n@[<hv2> %a@]@\n;@\n@[<hv2> %a@]@\n"
pp_control first_result.control pp_control second_result.control ;
compute_results_to_parent trans_state loc ~node_name stmt_info ~return
compute_results_to_parent trans_state loc node_name stmt_info ~return
[first_result; second_result]
@ -446,8 +446,7 @@ let alloc_trans trans_state ~alloc_builtin loc stmt_info function_type =
create_alloc_instrs integer_type_widths ~alloc_builtin loc function_type
in
let control_tmp = {empty_control with instrs} in
PriorityNode.compute_control_to_parent trans_state loc ~node_name:(Call "alloc") stmt_info
control_tmp
PriorityNode.compute_control_to_parent trans_state loc (Call "alloc") stmt_info control_tmp
|> mk_trans_result (exp, function_type)
@ -472,7 +471,7 @@ let objc_new_trans trans_state ~alloc_builtin loc stmt_info cls_name function_ty
let instrs = alloc_stmt_call @ [init_stmt_call] in
let res_trans_tmp = {empty_control with instrs} in
let node_name = Procdesc.Node.CallObjCNew in
PriorityNode.compute_control_to_parent trans_state loc ~node_name stmt_info res_trans_tmp
PriorityNode.compute_control_to_parent trans_state loc node_name stmt_info res_trans_tmp
|> mk_trans_result (Exp.Var init_ret_id, alloc_ret_type)

@ -191,7 +191,7 @@ module PriorityNode : sig
val compute_controls_to_parent :
trans_state
-> Location.t
-> node_name:Procdesc.Node.stmt_nodekind
-> Procdesc.Node.stmt_nodekind
-> Clang_ast_t.stmt_info
-> control list
-> control
@ -202,7 +202,7 @@ module PriorityNode : sig
val compute_control_to_parent :
trans_state
-> Location.t
-> node_name:Procdesc.Node.stmt_nodekind
-> Procdesc.Node.stmt_nodekind
-> Clang_ast_t.stmt_info
-> control
-> control
@ -212,7 +212,7 @@ module PriorityNode : sig
val compute_results_to_parent :
trans_state
-> Location.t
-> node_name:Procdesc.Node.stmt_nodekind
-> Procdesc.Node.stmt_nodekind
-> Clang_ast_t.stmt_info
-> return:Exp.t * Typ.t
-> trans_result list
@ -222,7 +222,7 @@ module PriorityNode : sig
val compute_result_to_parent :
trans_state
-> Location.t
-> node_name:Procdesc.Node.stmt_nodekind
-> Procdesc.Node.stmt_nodekind
-> Clang_ast_t.stmt_info
-> trans_result
-> trans_result

Loading…
Cancel
Save