From 43a99745b63724627837de8b4880ed9f4ddcd99f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ezgi=20=C3=87i=C3=A7ek?= Date: Thu, 30 Jan 2020 06:53:41 -0800 Subject: [PATCH] [infer] Get rid of verbose Typ.mk Tvoid Summary: Instead use `Typ.void` which does the same thing Reviewed By: ngorogiannis Differential Revision: D19640598 fbshipit-source-id: 01ff1f6a0 --- infer/src/IR/HilInstr.ml | 2 +- infer/src/IR/ProcAttributes.ml | 2 +- infer/src/absint/LowerHil.ml | 2 +- infer/src/biabduction/Absarray.ml | 6 +++--- infer/src/biabduction/Attribute.ml | 2 +- infer/src/biabduction/BuiltinDefn.ml | 18 +++++++----------- infer/src/biabduction/Prover.ml | 12 ++++++------ infer/src/biabduction/Rearrange.ml | 2 +- infer/src/biabduction/SymExec.ml | 2 +- infer/src/clang/cField_decl.ml | 2 +- infer/src/clang/cMethod_trans.ml | 2 +- infer/src/clang/cTrans.ml | 20 ++++++++++---------- infer/src/clang/cTrans_utils.ml | 12 ++++++------ infer/src/java/jTrans.ml | 20 ++++++++------------ infer/src/java/jTransExn.ml | 2 +- infer/src/java/jTransType.ml | 2 +- infer/src/nullsafe/typeCheck.ml | 12 +++++------- infer/src/unit/TaintTests.ml | 4 ++-- infer/src/unit/TraceTests.ml | 4 +--- infer/src/unit/accessPathTestUtils.ml | 2 +- infer/src/unit/accessPathTests.ml | 4 ++-- infer/src/unit/accessTreeTests.ml | 2 +- infer/src/unit/analyzerTester.ml | 2 +- 23 files changed, 63 insertions(+), 75 deletions(-) diff --git a/infer/src/IR/HilInstr.ml b/infer/src/IR/HilInstr.ml index 5f164574d..57645600f 100644 --- a/infer/src/IR/HilInstr.ml +++ b/infer/src/IR/HilInstr.ml @@ -85,7 +85,7 @@ let of_sil ~include_array_indexes ~f_resolve_id (instr : Sil.instr) = | Call ((ret_id, ret_typ), call_exp, formals, loc, call_flags) -> let hil_ret = (Var.of_id ret_id, ret_typ) in let hil_call = - match exp_of_sil call_exp (Typ.mk Tvoid) with + match exp_of_sil call_exp Typ.void with | Constant (Cfun procname) | Closure (procname, _) -> Direct procname | HilExp.AccessExpression access_expr -> diff --git a/infer/src/IR/ProcAttributes.ml b/infer/src/IR/ProcAttributes.ml index 76aaa9536..fa308b73a 100644 --- a/infer/src/IR/ProcAttributes.ml +++ b/infer/src/IR/ProcAttributes.ml @@ -89,7 +89,7 @@ let default translation_unit proc_name = ; method_annotation= Annot.Method.empty ; objc_accessor= None ; proc_name - ; ret_type= Typ.mk Typ.Tvoid } + ; ret_type= Typ.void } let pp_parameters = diff --git a/infer/src/absint/LowerHil.ml b/infer/src/absint/LowerHil.ml index a455d552a..8bec0e209 100644 --- a/infer/src/absint/LowerHil.ml +++ b/infer/src/absint/LowerHil.ml @@ -49,7 +49,7 @@ module Make (TransferFunctions : TransferFunctions.HIL) (HilConfig : HilConfig) "dump" all of the temporaries out of the id map, then execute the unlock instruction. *) let actual_state' = Bindings.fold bindings ~init:actual_state ~f:(fun id access_expr astate_acc -> - let lhs_access_path = HilExp.AccessExpression.base (id, Typ.mk Typ.Tvoid) in + let lhs_access_path = HilExp.AccessExpression.base (id, Typ.void) in let dummy_assign = HilInstr.Assign (lhs_access_path, HilExp.AccessExpression access_expr, loc) in diff --git a/infer/src/biabduction/Absarray.ml b/infer/src/biabduction/Absarray.ml index ff53b7f93..360f5ab63 100644 --- a/infer/src/biabduction/Absarray.ml +++ b/infer/src/biabduction/Absarray.ml @@ -602,7 +602,7 @@ let check_after_array_abstraction tenv prop = () | Predicates.Earray (_, esel, _) -> (* check that no more than 2 elements are in the array *) - let typ_elem = Typ.array_elem (Some (Typ.mk Tvoid)) typ in + let typ_elem = Typ.array_elem (Some Typ.void) typ in if List.length esel > 2 && array_typ_can_abstract typ then if List.for_all ~f:(check_index root offs) esel then () else report_error prop else @@ -612,13 +612,13 @@ let check_after_array_abstraction tenv prop = | Predicates.Estruct (fsel, _) -> List.iter ~f:(fun (f, se) -> - let typ_f = Struct.fld_typ ~lookup ~default:(Typ.mk Tvoid) f typ in + let typ_f = Struct.fld_typ ~lookup ~default:Typ.void f typ in check_se root (offs @ [Predicates.Off_fld (f, typ)]) typ_f se ) fsel in let check_hpred = function | Predicates.Hpointsto (root, se, texp) -> - let typ = Exp.texp_to_typ (Some (Typ.mk Tvoid)) texp in + let typ = Exp.texp_to_typ (Some Typ.void) texp in check_se root [] typ se | Predicates.Hlseg _ | Predicates.Hdllseg _ -> () diff --git a/infer/src/biabduction/Attribute.ml b/infer/src/biabduction/Attribute.ml index 7840719d9..573ef89b4 100644 --- a/infer/src/biabduction/Attribute.ml +++ b/infer/src/biabduction/Attribute.ml @@ -364,7 +364,7 @@ let find_equal_formal_path tenv e prop = | Predicates.Eexp (exp2, _) when Exp.equal exp2 e -> ( match find_in_sigma exp1 seen_hpreds with | Some vfs -> - Some (Exp.Lfield (vfs, field, Typ.mk Tvoid)) + Some (Exp.Lfield (vfs, field, Typ.void)) | None -> None ) | _ -> diff --git a/infer/src/biabduction/BuiltinDefn.ml b/infer/src/biabduction/BuiltinDefn.ml index 0d69a7bbe..d6a859580 100644 --- a/infer/src/biabduction/BuiltinDefn.ml +++ b/infer/src/biabduction/BuiltinDefn.ml @@ -624,8 +624,8 @@ let execute___cxx_typeid ({Builtin.summary; tenv; prop_; args; loc; exe_env} as let set_instr = Sil.Store { e1= field_exp - ; root_typ= Typ.mk Tvoid - ; typ= Typ.mk Tvoid + ; root_typ= Typ.void + ; typ= Typ.void ; e2= Exp.Const (Const.Cstr typ_string) ; loc } in @@ -766,8 +766,8 @@ let execute___infer_fail {Builtin.summary; tenv; prop_; path; args; loc; exe_env let set_instr = Sil.Store { e1= Exp.Lvar Predicates.custom_error - ; root_typ= Typ.mk Tvoid - ; typ= Typ.mk Tvoid + ; root_typ= Typ.void + ; typ= Typ.void ; e2= Exp.Const (Const.Cstr error_str) ; loc } in @@ -787,8 +787,8 @@ let execute___assert_fail {Builtin.summary; tenv; prop_; path; args; loc; exe_en let set_instr = Sil.Store { e1= Exp.Lvar Predicates.custom_error - ; root_typ= Typ.mk Tvoid - ; typ= Typ.mk Tvoid + ; root_typ= Typ.void + ; typ= Typ.void ; e2= Exp.Const (Const.Cstr error_str) ; loc } in @@ -801,11 +801,7 @@ let execute_objc_alloc_no_fail symb_state typ alloc_fun_opt let ptr_typ = Typ.mk (Tptr (typ, Typ.Pk_pointer)) in let sizeof_typ = Exp.Sizeof {typ; nbytes= None; dynamic_length= None; subtype= Subtype.exact} in let alloc_fun_exp = - match alloc_fun_opt with - | Some pname -> - [(Exp.Const (Const.Cfun pname), Typ.mk Tvoid)] - | None -> - [] + match alloc_fun_opt with Some pname -> [(Exp.Const (Const.Cfun pname), Typ.void)] | None -> [] in let alloc_instr = Sil.Call (ret_id_typ, alloc_fun, [(sizeof_typ, ptr_typ)] @ alloc_fun_exp, loc, CallFlags.default) diff --git a/infer/src/biabduction/Prover.ml b/infer/src/biabduction/Prover.ml index 0e62c5f42..82dafa580 100644 --- a/infer/src/biabduction/Prover.ml +++ b/infer/src/biabduction/Prover.ml @@ -1540,7 +1540,7 @@ and struct_imply tenv source calc_missing subs fsel1 fsel2 typ2 : | (f1, se1) :: fsel1', (f2, se2) :: fsel2' -> ( match Fieldname.compare f1 f2 with | 0 -> - let typ' = Struct.fld_typ ~lookup ~default:(Typ.mk Tvoid) f2 typ2 in + let typ' = Struct.fld_typ ~lookup ~default:Typ.void f2 typ2 in let subs', se_frame, se_missing = sexp_imply tenv (Exp.Lfield (source, f2, typ2)) false calc_missing subs se1 se2 typ' in @@ -1560,7 +1560,7 @@ and struct_imply tenv source calc_missing subs fsel1 fsel2 typ2 : in (subs', (f1, se1) :: fld_frame, fld_missing) | _ -> - let typ' = Struct.fld_typ ~lookup ~default:(Typ.mk Tvoid) f2 typ2 in + let typ' = Struct.fld_typ ~lookup ~default:Typ.void f2 typ2 in let subs' = sexp_imply_nolhs tenv (Exp.Lfield (source, f2, typ2)) calc_missing subs se2 typ' in @@ -1570,7 +1570,7 @@ and struct_imply tenv source calc_missing subs fsel1 fsel2 typ2 : let fld_missing' = (f2, se2) :: fld_missing in (subs', fld_frame, fld_missing') ) | [], (f2, se2) :: fsel2' -> - let typ' = Struct.fld_typ ~lookup ~default:(Typ.mk Tvoid) f2 typ2 in + let typ' = Struct.fld_typ ~lookup ~default:Typ.void f2 typ2 in let subs' = sexp_imply_nolhs tenv (Exp.Lfield (source, f2, typ2)) calc_missing subs se2 typ' in @@ -1582,7 +1582,7 @@ and struct_imply tenv source calc_missing subs fsel1 fsel2 typ2 : and array_imply tenv source calc_index_frame calc_missing subs esel1 esel2 typ2 : subst2 * (Exp.t * Predicates.strexp) list * (Exp.t * Predicates.strexp) list = - let typ_elem = Typ.array_elem (Some (Typ.mk Tvoid)) typ2 in + let typ_elem = Typ.array_elem (Some Typ.void) typ2 in match (esel1, esel2) with | _, [] -> (subs, esel1, []) @@ -2048,7 +2048,7 @@ let rec hpred_imply tenv calc_index_frame calc_missing subs prop1 sigma2 hpred2 match Prop.prop_iter_current tenv iter1' with | Predicates.Hpointsto (e1, se1, texp1), _ -> ( try - let typ2 = Exp.texp_to_typ (Some (Typ.mk Tvoid)) texp2 in + let typ2 = Exp.texp_to_typ (Some Typ.void) texp2 in let typing_frame, typing_missing = texp_imply tenv subs texp1 texp2 e1 calc_missing in let se1' = sexp_imply_preprocess se1 texp1 se2 in let subs', fld_frame, fld_missing = @@ -2371,7 +2371,7 @@ and sigma_imply tenv calc_index_frame calc_missing subs prop1 sigma2 : subst2 * let subs' = match hpred2' with | Predicates.Hpointsto (e2, se2, te2) -> - let typ2 = Exp.texp_to_typ (Some (Typ.mk Tvoid)) te2 in + let typ2 = Exp.texp_to_typ (Some Typ.void) te2 in sexp_imply_nolhs tenv e2 calc_missing subs se2 typ2 | _ -> subs diff --git a/infer/src/biabduction/Rearrange.ml b/infer/src/biabduction/Rearrange.ml index ad9bc1016..f714d9d46 100644 --- a/infer/src/biabduction/Rearrange.ml +++ b/infer/src/biabduction/Rearrange.ml @@ -422,7 +422,7 @@ let strexp_extend_values pname tenv orig_prop footprint_part kind max_stamp se t | Exp.Sizeof sizeof_data -> sizeof_data | _ -> - {Exp.typ= Typ.mk Typ.Tvoid; nbytes= None; dynamic_length= None; subtype= Subtype.exact} + {Exp.typ= Typ.void; nbytes= None; dynamic_length= None; subtype= Subtype.exact} in List.map ~f:(fun (atoms', se', typ') -> diff --git a/infer/src/biabduction/SymExec.ml b/infer/src/biabduction/SymExec.ml index 597dd7661..191e56807 100644 --- a/infer/src/biabduction/SymExec.ml +++ b/infer/src/biabduction/SymExec.ml @@ -1831,7 +1831,7 @@ and sym_exec_objc_accessor callee_pname property_accesor ret_typ tenv ret_id pde and sym_exec_alloc_model exe_env pname ret_typ tenv ret_id_typ summary loc prop path : Builtin.ret_typ = - let alloc_source_function_arg = (Exp.Const (Const.Cfun pname), Typ.mk Tvoid) in + let alloc_source_function_arg = (Exp.Const (Const.Cfun pname), Typ.void) in let args = let sizeof_exp = Exp.Sizeof {typ= ret_typ; nbytes= None; dynamic_length= None; subtype= Subtype.exact} diff --git a/infer/src/clang/cField_decl.ml b/infer/src/clang/cField_decl.ml index d20adc8ad..e8eb14028 100644 --- a/infer/src/clang/cField_decl.ml +++ b/infer/src/clang/cField_decl.ml @@ -115,7 +115,7 @@ let add_missing_fields tenv class_name missing_fields = let modelled_fields_in_classes = - [ ("NSData", "_bytes", Typ.mk (Tptr (Typ.mk Tvoid, Typ.Pk_pointer))) + [ ("NSData", "_bytes", Typ.mk (Tptr (Typ.void, Typ.Pk_pointer))) ; ("NSArray", "elementData", Typ.mk (Tint Typ.IInt)) ] diff --git a/infer/src/clang/cMethod_trans.ml b/infer/src/clang/cMethod_trans.ml index 533a5bf26..eb3ae329d 100644 --- a/infer/src/clang/cMethod_trans.ml +++ b/infer/src/clang/cMethod_trans.ml @@ -278,7 +278,7 @@ let create_external_procdesc trans_unit_ctx cfg proc_name clang_method_kind type | Some (ret_type, arg_types) -> (ret_type, List.map ~f:(fun typ -> (Mangled.from_string "x", typ)) arg_types) | None -> - (Typ.mk Typ.Tvoid, []) + (Typ.void, []) in let proc_attributes = { (ProcAttributes.default trans_unit_ctx.CFrontend_config.source_file proc_name) with diff --git a/infer/src/clang/cTrans.ml b/infer/src/clang/cTrans.ml index 73780d0ea..c095ebf7d 100644 --- a/infer/src/clang/cTrans.ml +++ b/infer/src/clang/cTrans.ml @@ -1189,7 +1189,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s decl_ref_trans ~context:(MemberOrIvar this_res_trans) trans_state si decl_ref in let res_trans = - cxx_method_construct_call_trans trans_state_pri res_trans_callee params_stmt si (Typ.mk Tvoid) + cxx_method_construct_call_trans trans_state_pri res_trans_callee params_stmt si Typ.void ~is_injected_destructor:false ~is_cpp_call_virtual:false (Some tmp_res_trans) ~is_inherited_ctor in @@ -1212,7 +1212,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s | Some res_trans_callee when Option.is_some res_trans_callee.method_name -> let is_cpp_call_virtual = res_trans_callee.is_cpp_call_virtual in Some - (cxx_method_construct_call_trans trans_state_pri res_trans_callee [] si' (Typ.mk Tvoid) + (cxx_method_construct_call_trans trans_state_pri res_trans_callee [] si' Typ.void ~is_injected_destructor ~is_cpp_call_virtual None ~is_inherited_ctor:false) | _ -> None @@ -3054,7 +3054,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s let stmt = match stmts with [stmt] -> stmt | _ -> assert false in let res_trans_stmt = exec_with_glvalue_as_reference instruction trans_state' stmt in let exp = res_trans_stmt.return in - let args = [exp; (sizeof_expr, Typ.mk Tvoid)] in + let args = [exp; (sizeof_expr, Typ.void)] in let ret_id = Ident.create_fresh Ident.knormal in let call = Sil.Call ((ret_id, cast_type), builtin, args, sil_loc, CallFlags.default) in let res_ex = Exp.Var ret_id in @@ -3097,22 +3097,22 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s and gccAsmStmt_trans trans_state stmt_info stmts = call_function_with_args Procdesc.Node.GCCAsmStmt BuiltinDecl.__infer_skip_gcc_asm_stmt - trans_state stmt_info (Typ.mk Tvoid) stmts + trans_state stmt_info Typ.void stmts and genericSelectionExprUnknown_trans trans_state stmt_info stmts = call_function_with_args Procdesc.Node.GenericSelectionExpr - BuiltinDecl.__infer_generic_selection_expr trans_state stmt_info (Typ.mk Tvoid) stmts + BuiltinDecl.__infer_generic_selection_expr trans_state stmt_info Typ.void stmts and objc_cxx_throw_trans trans_state stmt_info stmts = call_function_with_args Procdesc.Node.ObjCCPPThrow BuiltinDecl.objc_cpp_throw trans_state - stmt_info (Typ.mk Tvoid) stmts + stmt_info Typ.void stmts and cxxPseudoDestructorExpr_trans () = mk_trans_result - (Exp.Const (Const.Cfun BuiltinDecl.__infer_skip_function), Typ.mk Tvoid) + (Exp.Const (Const.Cfun BuiltinDecl.__infer_skip_function), Typ.void) empty_control @@ -3135,7 +3135,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s let fun_name = BuiltinDecl.__cxx_typeid in let sil_fun = Exp.Const (Const.Cfun fun_name) in let ret_id = Ident.create_fresh Ident.knormal in - let void_typ = Typ.mk Tvoid in + let void_typ = Typ.void in let type_info_objc = (Exp.Sizeof {typ; nbytes= None; dynamic_length= None; subtype= Subtype.exact}, void_typ) in @@ -3582,7 +3582,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s | None -> genericSelectionExprUnknown_trans trans_state stmt_info stmts ) | SizeOfPackExpr _ -> - mk_trans_result (Exp.get_undefined false, Typ.mk Tvoid) empty_control + mk_trans_result (Exp.get_undefined false, Typ.void) empty_control | GCCAsmStmt (stmt_info, stmts) -> gccAsmStmt_trans trans_state stmt_info stmts | CXXPseudoDestructorExpr _ -> @@ -3727,7 +3727,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s ((stmt_info, stmts), ret_typ) | None -> let stmt_tuple = Clang_ast_proj.get_stmt_tuple instr in - (stmt_tuple, Typ.mk Tvoid) + (stmt_tuple, Typ.void) in skip_unimplemented ~reason: diff --git a/infer/src/clang/cTrans_utils.ml b/infer/src/clang/cTrans_utils.ml index 8dcdf2918..e46b8d3bf 100644 --- a/infer/src/clang/cTrans_utils.ml +++ b/infer/src/clang/cTrans_utils.ml @@ -382,7 +382,7 @@ let create_call_to_free_cf sil_loc exp typ = let pname = BuiltinDecl.__free_cf in let stmt_call = Sil.Call - ( (Ident.create_fresh Ident.knormal, Typ.mk Tvoid) + ( (Ident.create_fresh Ident.knormal, Typ.void) , Exp.Const (Const.Cfun pname) , [(exp, typ)] , sil_loc @@ -456,9 +456,9 @@ let cast_operation cast_kind ((exp, typ) as exp_typ) cast_typ sil_loc = let trans_assertion_failure sil_loc (context : CContext.t) = let assert_fail_builtin = Exp.Const (Const.Cfun BuiltinDecl.__infer_fail) in - let args = [(Exp.Const (Const.Cstr Config.default_failure_name), Typ.mk Tvoid)] in + let args = [(Exp.Const (Const.Cstr Config.default_failure_name), Typ.void)] in let ret_id = Ident.create_fresh Ident.knormal in - let ret_typ = Typ.mk Tvoid in + let ret_typ = Typ.void in let call_instr = Sil.Call ((ret_id, ret_typ), assert_fail_builtin, args, sil_loc, CallFlags.default) in @@ -606,12 +606,12 @@ let is_logical_negation_of_int tenv ei uoi = false -let mk_fresh_void_exp_typ () = (Exp.Var (Ident.create_fresh Ident.knormal), Typ.mk Tvoid) +let mk_fresh_void_exp_typ () = (Exp.Var (Ident.create_fresh Ident.knormal), Typ.void) -let mk_fresh_void_id_typ () = (Ident.create_fresh Ident.knormal, Typ.mk Tvoid) +let mk_fresh_void_id_typ () = (Ident.create_fresh Ident.knormal, Typ.void) let mk_fresh_void_return () = - let id = Ident.create_fresh Ident.knormal and void = Typ.mk Tvoid in + let id = Ident.create_fresh Ident.knormal and void = Typ.void in ((id, void), (Exp.Var id, void)) diff --git a/infer/src/java/jTrans.ml b/infer/src/java/jTrans.ml index f60f929c5..430a613f4 100644 --- a/infer/src/java/jTrans.ml +++ b/infer/src/java/jTrans.ml @@ -119,7 +119,7 @@ let translate_locals program tenv formals bytecode jbir_code = Array.fold ~f:(fun accu jbir_var -> let var = Mangled.from_string (JBir.var_name_g jbir_var) in - collect accu (var, Typ.mk Tvoid) ) + collect accu (var, Typ.void) ) ~init:with_bytecode_vars (JBir.vars jbir_code) in snd with_jbir_vars @@ -494,7 +494,7 @@ let rec expression (context : JContext.t) pc expr = | _ -> assert false in - let args = [(sil_ex, type_of_ex); (sizeof_expr, Typ.mk Tvoid)] in + let args = [(sil_ex, type_of_ex); (sizeof_expr, Typ.void)] in let ret_id = Ident.create_fresh Ident.knormal in let call = Sil.Call ((ret_id, Typ.mk (Tint IBool)), builtin, args, loc, CallFlags.default) @@ -631,7 +631,7 @@ let method_invocation (context : JContext.t) loc pc var_opt cn ms sil_obj_opt ex let return_type = match JBasics.ms_rtype ms with | None -> - Typ.mk Tvoid + Typ.void | Some vt -> JTransType.value_type program tenv vt in @@ -648,11 +648,7 @@ let method_invocation (context : JContext.t) loc pc var_opt cn ms sil_obj_opt ex | None -> let call_instr = Sil.Call - ( (Ident.create_fresh Ident.knormal, Typ.mk Tvoid) - , callee_fun - , call_args - , loc - , call_flags ) + ((Ident.create_fresh Ident.knormal, Typ.void), callee_fun, call_args, loc, call_flags) in instrs @ [call_instr] | Some var -> @@ -690,7 +686,7 @@ let method_invocation (context : JContext.t) loc pc var_opt cn ms sil_obj_opt ex let set_file_attr = let set_builtin = Exp.Const (Const.Cfun BuiltinDecl.__set_file_attribute) in Sil.Call - ( (Ident.create_fresh Ident.knormal, Typ.mk Tvoid) + ( (Ident.create_fresh Ident.knormal, Typ.void) , set_builtin , [exp] , loc @@ -703,7 +699,7 @@ let method_invocation (context : JContext.t) loc pc var_opt cn ms sil_obj_opt ex let set_mem_attr = let set_builtin = Exp.Const (Const.Cfun BuiltinDecl.__set_mem_attribute) in Sil.Call - ( (Ident.create_fresh Ident.knormal, Typ.mk Tvoid) + ( (Ident.create_fresh Ident.knormal, Typ.void) , set_builtin , [exp] , loc @@ -773,7 +769,7 @@ let assume_not_null loc sil_expr = let not_null_expr = Exp.BinOp (Binop.Ne, sil_expr, Exp.null) in let call_args = [(not_null_expr, Typ.mk (Tint Typ.IBool))] in Sil.Call - ( (Ident.create_fresh Ident.knormal, Typ.mk Tvoid) + ( (Ident.create_fresh Ident.knormal, Typ.void) , builtin_infer_assume , call_args , loc @@ -797,7 +793,7 @@ let instruction (context : JContext.t) pc instr : translation = let builtin_const = Exp.Const (Const.Cfun builtin) in let instr = Sil.Call - ( (Ident.create_fresh Ident.knormal, Typ.mk Tvoid) + ( (Ident.create_fresh Ident.knormal, Typ.void) , builtin_const , [(sil_expr, sil_type)] , loc diff --git a/infer/src/java/jTransExn.ml b/infer/src/java/jTransExn.ml index 0608742d4..d8c6bdba8 100644 --- a/infer/src/java/jTransExn.ml +++ b/infer/src/java/jTransExn.ml @@ -84,7 +84,7 @@ let translate_exceptions (context : JContext.t) exit_nodes get_body_nodes handle [ (Exp.Var id_exn_val, Typ.mk (Tptr (exn_type, Typ.Pk_pointer))) ; ( Exp.Sizeof {typ= exn_type; nbytes= None; dynamic_length= None; subtype= Subtype.exact} - , Typ.mk Tvoid ) ] + , Typ.void ) ] in Sil.Call ( (id_instanceof, Typ.mk (Tint IBool)) diff --git a/infer/src/java/jTransType.ml b/infer/src/java/jTransType.ml index b98339a78..35a34aafe 100644 --- a/infer/src/java/jTransType.ml +++ b/infer/src/java/jTransType.ml @@ -471,4 +471,4 @@ let rec expr_type (context : JContext.t) expr = (** Returns the return type of the method based on the return type specified in ms. *) let return_type program tenv ms = - match JBasics.ms_rtype ms with None -> Typ.mk Tvoid | Some vt -> value_type program tenv vt + match JBasics.ms_rtype ms with None -> Typ.void | Some vt -> value_type program tenv vt diff --git a/infer/src/nullsafe/typeCheck.ml b/infer/src/nullsafe/typeCheck.ml index 6a74ca543..7a7864e31 100644 --- a/infer/src/nullsafe/typeCheck.ml +++ b/infer/src/nullsafe/typeCheck.ml @@ -434,7 +434,7 @@ let typecheck_expr_for_errors ~is_strict_mode find_canonical_duplicate curr_pdes tenv node instr_ref typestate1 exp1 loc1 : unit = ignore (typecheck_expr_simple ~is_strict_mode find_canonical_duplicate curr_pdesc calls_this checks - tenv node instr_ref typestate1 exp1 (Typ.mk Tvoid) TypeOrigin.Undef loc1) + tenv node instr_ref typestate1 exp1 Typ.void TypeOrigin.Undef loc1) (* Handle Preconditions.checkNotNull. *) @@ -701,8 +701,8 @@ let rec check_condition_for_sil_prune tenv idenv calls_this find_canonical_dupli let e1 = Exp.Lvar pvar in let typ, ta = typecheck_expr_simple ~is_strict_mode find_canonical_duplicate curr_pdesc calls_this - checks tenv original_node instr_ref typestate e1 (Typ.mk Tvoid) - TypeOrigin.OptimisticFallback loc + checks tenv original_node instr_ref typestate e1 Typ.void TypeOrigin.OptimisticFallback + loc in let range = (typ, ta) in let typestate1 = TypeState.add pvar range typestate in @@ -749,8 +749,7 @@ let rec check_condition_for_sil_prune tenv idenv calls_this find_canonical_dupli in let typ, inferred_nullability = typecheck_expr_simple ~is_strict_mode find_canonical_duplicate curr_pdesc calls_this checks - tenv original_node instr_ref typestate2 e' (Typ.mk Tvoid) TypeOrigin.OptimisticFallback - loc + tenv original_node instr_ref typestate2 e' Typ.void TypeOrigin.OptimisticFallback loc in if checks.eradicate then EradicateChecks.check_zero tenv find_canonical_duplicate curr_pdesc node e' typ @@ -786,8 +785,7 @@ let rec check_condition_for_sil_prune tenv idenv calls_this find_canonical_dupli in let typ, inferred_nullability = typecheck_expr_simple ~is_strict_mode find_canonical_duplicate curr_pdesc calls_this checks - tenv original_node instr_ref typestate2 e' (Typ.mk Tvoid) TypeOrigin.OptimisticFallback - loc + tenv original_node instr_ref typestate2 e' Typ.void TypeOrigin.OptimisticFallback loc in if checks.eradicate then EradicateChecks.check_nonzero tenv find_canonical_duplicate curr_pdesc original_node e' typ diff --git a/infer/src/unit/TaintTests.ml b/infer/src/unit/TaintTests.ml index 8334a2035..87538aacb 100644 --- a/infer/src/unit/TaintTests.ml +++ b/infer/src/unit/TaintTests.ml @@ -108,10 +108,10 @@ let tests = let call_sink actual_str = call_sink_with_exp (Exp.Var (ident_of_str actual_str)) in let assign_id_to_field root_str fld_str rhs_id_str = let rhs_exp = Exp.Var (ident_of_str rhs_id_str) in - make_store ~rhs_typ:(Typ.mk Tvoid) (Exp.Var (ident_of_str root_str)) fld_str ~rhs_exp + make_store ~rhs_typ:Typ.void (Exp.Var (ident_of_str root_str)) fld_str ~rhs_exp in let read_field_to_id lhs_id_str root_str fld_str = - make_load_fld ~rhs_typ:(Typ.mk Tvoid) lhs_id_str fld_str (Exp.Var (ident_of_str root_str)) + make_load_fld ~rhs_typ:Typ.void lhs_id_str fld_str (Exp.Var (ident_of_str root_str)) in let assert_empty = invariant "{ }" in let exe_env = Exe_env.mk () in diff --git a/infer/src/unit/TraceTests.ml b/infer/src/unit/TraceTests.ml index 46ed4a14a..1694458bb 100644 --- a/infer/src/unit/TraceTests.ml +++ b/infer/src/unit/TraceTests.ml @@ -116,9 +116,7 @@ let tests = let append = let append_ _ = let call_site = CallSite.dummy in - let footprint_ap = - AccessPath.Abs.Exact (AccessPath.of_id (Ident.create_none ()) (Typ.mk Tvoid)) - in + let footprint_ap = AccessPath.Abs.Exact (AccessPath.of_id (Ident.create_none ()) Typ.void) in let source_trace = MockTrace.of_source source1 in let footprint_trace = MockTrace.of_footprint footprint_ap |> MockTrace.add_sink sink1 in let expected_trace = MockTrace.of_source source1 |> MockTrace.add_sink sink1 in diff --git a/infer/src/unit/accessPathTestUtils.ml b/infer/src/unit/accessPathTestUtils.ml index b6ff658e4..c87b7111c 100644 --- a/infer/src/unit/accessPathTestUtils.ml +++ b/infer/src/unit/accessPathTestUtils.ml @@ -9,7 +9,7 @@ open! IStd let make_var var_str = Pvar.mk (Mangled.from_string var_str) Procname.empty_block -let make_base ?(typ = Typ.mk Tvoid) base_str = AccessPath.base_of_pvar (make_var base_str) typ +let make_base ?(typ = Typ.void) base_str = AccessPath.base_of_pvar (make_var base_str) typ let make_fieldname field_name = assert (not (String.contains field_name '.')) ; diff --git a/infer/src/unit/accessPathTests.ml b/infer/src/unit/accessPathTests.ml index ba7e514fb..70ebff44d 100644 --- a/infer/src/unit/accessPathTests.ml +++ b/infer/src/unit/accessPathTests.ml @@ -18,7 +18,7 @@ let tests = let xFG = make_access_path "x" ["f"; "g"] in let yF = make_access_path "y" ["f"] in let xArr = - let dummy_typ = Typ.mk Tvoid in + let dummy_typ = Typ.void in let dummy_arr_typ = Typ.mk_array dummy_typ in let base = make_base "x" ~typ:dummy_arr_typ in (base, [make_array_access dummy_typ]) @@ -67,7 +67,7 @@ let tests = in let of_exp_test = let f_resolve_id _ = None in - let dummy_typ = Typ.mk Tvoid in + let dummy_typ = Typ.void in let check_make_ap exp expected_ap ~f_resolve_id = let make_ap exp = match AccessPath.of_lhs_exp ~include_array_indexes:true exp dummy_typ ~f_resolve_id with diff --git a/infer/src/unit/accessTreeTests.ml b/infer/src/unit/accessTreeTests.ml index baccf3c60..b95c314bd 100644 --- a/infer/src/unit/accessTreeTests.ml +++ b/infer/src/unit/accessTreeTests.ml @@ -62,7 +62,7 @@ let tests = let z_base = make_base "z" in let f = make_field_access "f" in let g = make_field_access "g" in - let array = make_array_access (Typ.mk Tvoid) in + let array = make_array_access Typ.void in let x = AccessPath.Abs.Exact (make_access_path "x" []) in let xF = AccessPath.Abs.Exact (make_access_path "x" ["f"]) in let xG = AccessPath.Abs.Exact (make_access_path "x" ["g"]) in diff --git a/infer/src/unit/analyzerTester.ml b/infer/src/unit/analyzerTester.ml index f317827a4..232e2a72a 100644 --- a/infer/src/unit/analyzerTester.ml +++ b/infer/src/unit/analyzerTester.ml @@ -83,7 +83,7 @@ module StructuredSil = struct | Some ret_id_typ -> ret_id_typ | None -> - (Ident.create_fresh Ident.knormal, Typ.mk Tvoid) + (Ident.create_fresh Ident.knormal, Typ.void) in let call_exp = Exp.Const (Const.Cfun procname) in Cmd (Sil.Call (ret_id_typ, call_exp, args, dummy_loc, CallFlags.default))