[frontend] Move clang constants to Procname

Reviewed By: ngorogiannis, jvillard

Differential Revision: D19429744

fbshipit-source-id: f7e5bc41b
master
Ezgi Çiçek 5 years ago committed by Facebook Github Bot
parent 3de92484df
commit 5b86031798

@ -68,8 +68,14 @@ let __infer_assume = create_procname "__infer_assume"
let __infer_fail = create_procname "__infer_fail" let __infer_fail = create_procname "__infer_fail"
let __infer_generic_selection_expr = Procname.from_string_c_fun "__infer_generic_selection_expr"
let __infer_skip = create_procname "__infer_skip" let __infer_skip = create_procname "__infer_skip"
let __infer_skip_function = Procname.from_string_c_fun "__infer_skip_function"
let __infer_skip_gcc_asm_stmt = Procname.from_string_c_fun "__infer_skip_gcc_asm_stmt"
let __instanceof = create_procname "__instanceof" let __instanceof = create_procname "__instanceof"
let __method_set_ignore_attribute = create_procname "__method_set_ignore_attribute" let __method_set_ignore_attribute = create_procname "__method_set_ignore_attribute"

@ -12,3 +12,9 @@ open! IStd
include BUILTINS.S with type t = Procname.t include BUILTINS.S with type t = Procname.t
val is_declared : Procname.t -> bool val is_declared : Procname.t -> bool
val __infer_skip_function : Procname.t
val __infer_skip_gcc_asm_stmt : Procname.t
val __infer_generic_selection_expr : Procname.t

@ -67,12 +67,6 @@ let id_cl = "id"
let infer = "infer" let infer = "infer"
let infer_skip_fun = "__infer_skip_function"
let infer_skip_gcc_asm_stmt = "__infer_skip_gcc_asm_stmt"
let infer_generic_selection_expr = "__infer_generic_selection_expr"
let init = "init" let init = "init"
let is_kind_of_class = "isKindOfClass:" let is_kind_of_class = "isKindOfClass:"

@ -59,12 +59,6 @@ val id_cl : string
val infer : string val infer : string
val infer_skip_fun : string
val infer_skip_gcc_asm_stmt : string
val infer_generic_selection_expr : string
val init : string val init : string
val is_kind_of_class : string val is_kind_of_class : string

@ -3094,15 +3094,13 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
and gccAsmStmt_trans trans_state stmt_info stmts = and gccAsmStmt_trans trans_state stmt_info stmts =
let pname = Procname.from_string_c_fun CFrontend_config.infer_skip_gcc_asm_stmt in call_function_with_args Procdesc.Node.GCCAsmStmt BuiltinDecl.__infer_skip_gcc_asm_stmt
call_function_with_args Procdesc.Node.GCCAsmStmt pname trans_state stmt_info (Typ.mk Tvoid) trans_state stmt_info (Typ.mk Tvoid) stmts
stmts
and genericSelectionExprUnknown_trans trans_state stmt_info stmts = and genericSelectionExprUnknown_trans trans_state stmt_info stmts =
let pname = Procname.from_string_c_fun CFrontend_config.infer_generic_selection_expr in call_function_with_args Procdesc.Node.GenericSelectionExpr
call_function_with_args Procdesc.Node.GenericSelectionExpr pname trans_state stmt_info BuiltinDecl.__infer_generic_selection_expr trans_state stmt_info (Typ.mk Tvoid) stmts
(Typ.mk Tvoid) stmts
and objc_cxx_throw_trans trans_state stmt_info stmts = and objc_cxx_throw_trans trans_state stmt_info stmts =
@ -3111,8 +3109,9 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
and cxxPseudoDestructorExpr_trans () = and cxxPseudoDestructorExpr_trans () =
let fun_name = Procname.from_string_c_fun CFrontend_config.infer_skip_fun in mk_trans_result
mk_trans_result (Exp.Const (Const.Cfun fun_name), Typ.mk Tvoid) empty_control (Exp.Const (Const.Cfun BuiltinDecl.__infer_skip_function), Typ.mk Tvoid)
empty_control
and cxxTypeidExpr_trans trans_state stmt_info stmts expr_info = and cxxTypeidExpr_trans trans_state stmt_info stmts expr_info =
@ -3171,12 +3170,11 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
stmt_info stmt_info
in in
let typ = CType_decl.qual_type_to_sil_type tenv expr_info.Clang_ast_t.ei_qual_type in let typ = CType_decl.qual_type_to_sil_type tenv expr_info.Clang_ast_t.ei_qual_type in
let fun_name = Procname.from_string_c_fun CFrontend_config.infer_skip_fun in
let trans_state_pri = PriorityNode.try_claim_priority_node trans_state stmt_info in let trans_state_pri = PriorityNode.try_claim_priority_node trans_state stmt_info in
let trans_state_param = {trans_state_pri with succ_nodes= []} in let trans_state_param = {trans_state_pri with succ_nodes= []} in
let res_trans_subexpr_list = List.map ~f:(instruction trans_state_param) stmts in let res_trans_subexpr_list = List.map ~f:(instruction trans_state_param) stmts in
let params = collect_returns res_trans_subexpr_list in let params = collect_returns res_trans_subexpr_list in
let sil_fun = Exp.Const (Const.Cfun fun_name) in let sil_fun = Exp.Const (Const.Cfun BuiltinDecl.__infer_skip_function) in
let ret_id = Ident.create_fresh Ident.knormal in let ret_id = Ident.create_fresh Ident.knormal in
let ret_exp = Exp.Var ret_id in let ret_exp = Exp.Var ret_id in
let call_instr = Sil.Call ((ret_id, typ), sil_fun, params, sil_loc, CallFlags.default) in let call_instr = Sil.Call ((ret_id, typ), sil_fun, params, sil_loc, CallFlags.default) in

Loading…
Cancel
Save