From dfe2ad52299764d1eee6f8927e10c7be5beea702 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Wed, 9 May 2018 07:07:01 -0700 Subject: [PATCH] [camel] call `Format.pp_print_*` directly where appropriate Summary: This is an attempt to make things more consistent, and maybe save some work from the `Format` module in case flambda doesn't have our backs. Reviewed By: jberdine Differential Revision: D7775496 fbshipit-source-id: 59a6314 --- infer/src/IR/AccessPath.ml | 4 +- infer/src/IR/CallFlags.ml | 6 +- infer/src/IR/Const.ml | 6 +- infer/src/IR/Const.mli | 2 - infer/src/IR/DecompiledExp.ml | 82 +++++++++---------- infer/src/IR/Exp.ml | 6 +- infer/src/IR/HilExp.ml | 2 +- infer/src/IR/Ident.ml | 4 +- infer/src/IR/IntLit.ml | 2 +- infer/src/IR/Localise.ml | 5 +- infer/src/IR/Mangled.ml | 2 +- infer/src/IR/Procdesc.ml | 14 ++-- infer/src/IR/Pvar.ml | 2 +- infer/src/IR/QualifiedCppName.ml | 2 +- infer/src/IR/Sil.ml | 25 ++---- infer/src/IR/Subtype.ml | 4 +- infer/src/IR/Tenv.ml | 2 +- infer/src/IR/Typ.ml | 37 +++++---- infer/src/IR/Unop.ml | 2 +- infer/src/IR/Unop.mli | 2 +- infer/src/IR/Var.ml | 2 +- infer/src/absint/AbstractDomain.ml | 12 ++- infer/src/backend/InferPrint.ml | 18 ++-- infer/src/backend/cluster.ml | 4 +- infer/src/backend/clusterMakefile.ml | 2 +- infer/src/backend/crashcontext.ml | 2 +- infer/src/backend/dotty.ml | 14 ++-- infer/src/backend/inferconfig.ml | 16 ++-- infer/src/backend/specs.ml | 20 ++--- infer/src/base/FileDiff.ml | 11 +-- infer/src/base/IssueType.ml | 2 +- infer/src/base/Logging.ml | 2 +- infer/src/base/SourceFile.ml | 2 +- infer/src/base/SymOp.ml | 2 +- infer/src/biabduction/Paths.ml | 2 +- infer/src/biabduction/Prop.ml | 5 +- infer/src/biabduction/RetainCyclesType.ml | 4 +- infer/src/biabduction/Tabulation.ml | 2 +- infer/src/bufferoverrun/absLoc.ml | 6 +- .../src/bufferoverrun/bufferOverrunDomain.ml | 11 +-- infer/src/bufferoverrun/bufferOverrunTrace.ml | 2 +- infer/src/bufferoverrun/itv.ml | 21 +++-- infer/src/checkers/Ownership.ml | 2 +- infer/src/checkers/Passthrough.ml | 3 +- infer/src/checkers/Trace.ml | 4 +- infer/src/checkers/accessTree.ml | 6 +- infer/src/clang/Capture.ml | 2 +- infer/src/clang/cTL.ml | 12 +-- infer/src/concurrency/RacerD.ml | 6 +- infer/src/concurrency/RacerDDomain.ml | 14 ++-- infer/src/eradicate/typeCheck.ml | 7 +- infer/src/eradicate/typeState.ml | 2 +- infer/src/infer.ml | 2 +- infer/src/integration/Clang.ml | 22 ++--- infer/src/integration/Diff.ml | 2 +- infer/src/istd/Pp.ml | 2 +- infer/src/java/JavaProfilerSamples.ml | 18 ++-- infer/src/quandary/ClangTrace.ml | 16 ++-- infer/src/quandary/JavaTrace.ml | 37 ++++----- infer/src/unit/DifferentialFiltersTests.ml | 2 +- infer/src/unit/TaintTests.ml | 8 +- infer/src/unit/TraceTests.ml | 7 +- infer/src/unit/abstractInterpreterTests.ml | 2 +- infer/src/unit/accessTreeTests.ml | 2 +- infer/src/unit/analyzerTester.ml | 8 +- infer/src/unit/schedulerTests.ml | 6 +- .../arithmetic/compound_assignment.c.dot | 10 +-- .../initialization/struct_initlistexpr.c.dot | 2 +- .../nestedoperators/nestedassignment.c.dot | 4 +- .../frontend/initialization/init_list.cpp.dot | 2 +- .../literals/scalar_value_init.cpp.dot | 4 +- .../constructors/constructor_new.cpp.dot | 4 +- .../cpp/shared/namespace/namespace.cpp.dot | 2 +- .../cpp/shared/types/casts.cpp.dot | 2 +- .../objc/frontend/boxing/Boxing.m.dot | 8 +- .../objc/frontend/vardecl/initlist.m.dot | 2 +- .../MemoryLeakExample.m.dot | 4 +- .../TollBridgeExample.m.dot | 2 +- 78 files changed, 291 insertions(+), 320 deletions(-) diff --git a/infer/src/IR/AccessPath.ml b/infer/src/IR/AccessPath.ml index 115fb6dd7..64e809d71 100644 --- a/infer/src/IR/AccessPath.ml +++ b/infer/src/IR/AccessPath.ml @@ -35,13 +35,13 @@ module Raw = struct | FieldAccess field_name -> Typ.Fieldname.pp fmt field_name | ArrayAccess (_, []) -> - F.fprintf fmt "[_]" + F.pp_print_string fmt "[_]" | ArrayAccess (_, index_aps) -> F.fprintf fmt "[%a]" (PrettyPrintable.pp_collection ~pp_item:pp) index_aps and pp_access_list fmt accesses = - let pp_sep _ _ = F.fprintf fmt "." in + let pp_sep fmt () = F.pp_print_char fmt '.' in F.pp_print_list ~pp_sep pp_access fmt accesses diff --git a/infer/src/IR/CallFlags.ml b/infer/src/IR/CallFlags.ml index bec62b0ba..b8db70854 100644 --- a/infer/src/IR/CallFlags.ml +++ b/infer/src/IR/CallFlags.ml @@ -24,9 +24,9 @@ type t = [@@deriving compare] let pp f cf = - if cf.cf_virtual then F.fprintf f " virtual" ; - if cf.cf_noreturn then F.fprintf f " noreturn" ; - if cf.cf_with_block_parameters then F.fprintf f " block_params" + if cf.cf_virtual then F.pp_print_string f " virtual" ; + if cf.cf_noreturn then F.pp_print_string f " noreturn" ; + if cf.cf_with_block_parameters then F.pp_print_string f " block_params" let default = diff --git a/infer/src/IR/Const.ml b/infer/src/IR/Const.ml index 46a29e3ab..910005279 100644 --- a/infer/src/IR/Const.ml +++ b/infer/src/IR/Const.ml @@ -51,13 +51,11 @@ let pp pe f = function | Cstr s -> F.fprintf f "\"%s\"" (String.escaped s) | Cfloat v -> - F.fprintf f "%f" v + F.pp_print_float f v | Cclass c -> - F.fprintf f "%a" Ident.pp_name c + Ident.pp_name f c -let to_string c = F.asprintf "%a" (pp Pp.text) c - let iszero_int_float = function Cint i -> IntLit.iszero i | Cfloat 0.0 -> true | _ -> false let isone_int_float = function Cint i -> IntLit.isone i | Cfloat 1.0 -> true | _ -> false diff --git a/infer/src/IR/Const.mli b/infer/src/IR/Const.mli index 3bc141563..06363b85f 100644 --- a/infer/src/IR/Const.mli +++ b/infer/src/IR/Const.mli @@ -30,8 +30,6 @@ val kind_equal : t -> t -> bool val pp : Pp.env -> F.formatter -> t -> unit (** Pretty print a const *) -val to_string : t -> string - val iszero_int_float : t -> bool val isone_int_float : t -> bool diff --git a/infer/src/IR/DecompiledExp.ml b/infer/src/IR/DecompiledExp.ml index 4d9e18bc2..c907fdeac 100644 --- a/infer/src/IR/DecompiledExp.ml +++ b/infer/src/IR/DecompiledExp.ml @@ -43,38 +43,35 @@ let builtin_functions_to_string pn = if Typ.Procname.equal pn BuiltinDecl.__objc_alloc_no_fail then Some "alloc" else None -(** convert a dexp to a string *) -let rec to_string = function +let rec pp fmt = function | Darray (de1, de2) -> - to_string de1 ^ "[" ^ to_string de2 ^ "]" + F.fprintf fmt "%a[%a]" pp de1 pp de2 | Dbinop (op, de1, de2) -> - "(" ^ to_string de1 ^ Binop.str Pp.text op ^ to_string de2 ^ ")" - | Dconst (Cfun pn) - -> ( - let procname_str = Typ.Procname.to_simplified_string pn in - match builtin_functions_to_string pn with - | Some str -> - str - | None -> + F.fprintf fmt "(%a%a%a)" pp de1 (Pp.to_string ~f:(Binop.str Pp.text)) op pp de2 + | Dconst (Cfun pn) -> ( + match builtin_functions_to_string pn with + | Some str -> + F.pp_print_string fmt str + | None -> + let procname_str = Typ.Procname.to_simplified_string pn in match pn with | Typ.Procname.ObjC_Cpp {kind= ObjCInstanceMethod} | Typ.Procname.ObjC_Cpp {kind= ObjCClassMethod} -> ( match String.lsplit2 ~on:':' procname_str with | Some (base_name, _) -> - base_name + F.pp_print_string fmt base_name | None -> - procname_str ) + F.pp_print_string fmt procname_str ) | _ -> - procname_str ) + F.pp_print_string fmt procname_str ) | Dconst c -> - Const.to_string c + (Const.pp Pp.text) fmt c | Dderef de -> - "*" ^ to_string de + F.fprintf fmt "*%a" pp de | Dfcall (fun_dexp, args, _, {cf_virtual= isvirtual}) -> - let pp_arg fmt de = F.fprintf fmt "%s" (to_string de) in let pp_args fmt des = - if eradicate_java () then ( if des <> [] then F.fprintf fmt "..." ) - else Pp.comma_seq pp_arg fmt des + if eradicate_java () then ( if des <> [] then F.pp_print_string fmt "..." ) + else Pp.comma_seq pp fmt des in let pp_fun fmt = function | Dconst (Cfun pname) -> @@ -85,9 +82,9 @@ let rec to_string = function | _ -> Typ.Procname.to_string pname in - F.fprintf fmt "%s" s + F.pp_print_string fmt s | de -> - F.fprintf fmt "%s" (to_string de) + pp fmt de in let receiver, args' = match args with @@ -98,26 +95,28 @@ let rec to_string = function | _ -> (None, args) in - let pp fmt = - let pp_receiver fmt = function None -> () | Some arg -> F.fprintf fmt "%a." pp_arg arg in - F.fprintf fmt "%a%a(%a)" pp_receiver receiver pp_fun fun_dexp pp_args args' - in - F.asprintf "%t" pp + let pp_receiver fmt = function None -> () | Some arg -> F.fprintf fmt "%a." pp arg in + F.fprintf fmt "%a%a(%a)" pp_receiver receiver pp_fun fun_dexp pp_args args' | Darrow (Dpvar pv, f) when Pvar.is_this pv -> (* this->fieldname *) - Typ.Fieldname.to_simplified_string f + F.pp_print_string fmt (Typ.Fieldname.to_simplified_string f) | Darrow (de, f) -> - if Language.curr_language_is Java then to_string de ^ "." ^ Typ.Fieldname.to_flat_string f - else to_string de ^ "->" ^ Typ.Fieldname.to_string f + if Language.curr_language_is Java then + F.fprintf fmt "%a.%s" pp de (Typ.Fieldname.to_flat_string f) + else F.fprintf fmt "%a->%s" pp de (Typ.Fieldname.to_string f) | Ddot (Dpvar _, fe) when eradicate_java () -> (* static field access *) - Typ.Fieldname.to_simplified_string fe + F.pp_print_string fmt (Typ.Fieldname.to_simplified_string fe) | Ddot (de, f) -> - if Language.curr_language_is Java then to_string de ^ "." ^ Typ.Fieldname.to_flat_string f - else to_string de ^ "." ^ Typ.Fieldname.to_string f + let field_text = + if Language.curr_language_is Java then Typ.Fieldname.to_flat_string f + else Typ.Fieldname.to_string f + in + F.fprintf fmt "%a.%s" pp de field_text | Dpvar pv -> let var_name = Mangled.to_string (Pvar.get_name pv) in - if Language.curr_language_is Clang then split_var_clang var_name else var_name + let s = if Language.curr_language_is Clang then split_var_clang var_name else var_name in + F.pp_print_string fmt s | Dpvaraddr pv -> let var_name = Mangled.to_string (Pvar.get_name pv) in let s = @@ -125,20 +124,19 @@ let rec to_string = function else if Language.curr_language_is Clang then split_var_clang var_name else Mangled.to_string (Pvar.get_name pv) in - let ampersand = if eradicate_java () then "" else "&" in - ampersand ^ s + let pp_ampersand fmt = if not (eradicate_java ()) then F.pp_print_string fmt "&" in + F.fprintf fmt "%t%s" pp_ampersand s | Dunop (op, de) -> - Unop.str op ^ to_string de + F.fprintf fmt "%s%a" (Unop.to_string op) pp de | Dsizeof (typ, _, _) -> - F.asprintf "%a" (Typ.pp_full Pp.text) typ + (Typ.pp_full Pp.text) fmt typ | Dunknown -> - "unknown" + F.pp_print_string fmt "unknown" | Dretcall (de, _, _, _) -> - "returned by " ^ to_string de + F.fprintf fmt "returned by %a" pp de -(** Pretty print a dexp. *) -let pp fmt de = F.fprintf fmt "%s" (to_string de) +let to_string de = F.asprintf "%a" pp de (** Pretty print a value path *) let pp_vpath pe fmt vpath = @@ -146,7 +144,7 @@ let pp_vpath pe fmt vpath = if Pp.equal_print_kind pe.Pp.kind Pp.HTML then F.fprintf fmt " %a{vpath: %a}%a" Io_infer.Html.pp_start_color Pp.Orange pp vpath Io_infer.Html.pp_end_color () - else F.fprintf fmt "%a" pp vpath + else pp fmt vpath let rec has_tmp_var = function diff --git a/infer/src/IR/Exp.ml b/infer/src/IR/Exp.ml index 75f2a9010..d6b8f7d61 100644 --- a/infer/src/IR/Exp.ml +++ b/infer/src/IR/Exp.ml @@ -211,11 +211,11 @@ let rec pp_ pe pp_t f e = | Var id -> Ident.pp f id | Const c -> - F.fprintf f "%a" (Const.pp pe) c + (Const.pp pe) f c | Cast (typ, e) -> F.fprintf f "(%a)%a" pp_t typ pp_exp e | UnOp (op, e, _) -> - F.fprintf f "%s%a" (Unop.str op) pp_exp e + F.fprintf f "%s%a" (Unop.to_string op) pp_exp e | BinOp (op, Const c, e2) when Config.smt_output -> print_binop_stm_output (Const c) op e2 | BinOp (op, e1, e2) -> @@ -249,7 +249,7 @@ let rec pp_ pe pp_t f e = and pp_captured_var pe pp_t f (exp, var, typ) = match exp with | Lvar evar when Pvar.equal var evar -> - F.fprintf f "%a" (Pvar.pp pe) var + (Pvar.pp pe) f var | _ -> F.fprintf f "(%a %a:%a)" (pp_ pe pp_t) exp (Pvar.pp pe) var (Typ.pp pe) typ diff --git a/infer/src/IR/HilExp.ml b/infer/src/IR/HilExp.ml index 3bfb86f47..fbfaefe14 100644 --- a/infer/src/IR/HilExp.ml +++ b/infer/src/IR/HilExp.ml @@ -26,7 +26,7 @@ let rec pp fmt = function | AccessExpression access_expr -> AccessExpression.pp fmt access_expr | UnaryOperator (op, e, _) -> - F.fprintf fmt "%s%a" (Unop.str op) pp e + F.fprintf fmt "%s%a" (Unop.to_string op) pp e | BinaryOperator (op, e1, e2) -> F.fprintf fmt "%a %s %a" pp e1 (Binop.str Pp.text op) pp e2 | Exception e -> diff --git a/infer/src/IR/Ident.ml b/infer/src/IR/Ident.ml index 99380c715..f3355b6a5 100644 --- a/infer/src/IR/Ident.ml +++ b/infer/src/IR/Ident.ml @@ -228,10 +228,10 @@ let to_string id = (** Pretty print a name. *) -let pp_name f name = F.fprintf f "%s" (name_to_string name) +let pp_name f name = F.pp_print_string f (name_to_string name) (** Pretty print an identifier. *) -let pp f id = F.fprintf f "%s" (to_string id) +let pp f id = F.pp_print_string f (to_string id) (** pretty printer for lists of identifiers *) let pp_list = Pp.comma_seq pp diff --git a/infer/src/IR/IntLit.ml b/infer/src/IR/IntLit.ml index 67ff9f701..5d5ca7bdd 100644 --- a/infer/src/IR/IntLit.ml +++ b/infer/src/IR/IntLit.ml @@ -130,7 +130,7 @@ let shift_right (unsigned1, i1, ptr1) (_, i2, _) = let pp f (unsigned, n, ptr) = - if ptr && Int64.equal n 0L then F.fprintf f "null" + if ptr && Int64.equal n 0L then F.pp_print_string f "null" else if unsigned then F.fprintf f "%Lu" n else F.fprintf f "%Ld" n diff --git a/infer/src/IR/Localise.ml b/infer/src/IR/Localise.ml index 8043d4928..e41406a80 100644 --- a/infer/src/IR/Localise.ml +++ b/infer/src/IR/Localise.ml @@ -71,10 +71,7 @@ let verbatim_desc s = {no_desc with descriptions= [s]} let custom_desc description tags = {no_desc with descriptions= [description]; tags} (** pretty print an error description *) -let pp_error_desc fmt err_desc = - let pp_item fmt s = F.fprintf fmt "%s" s in - Pp.seq pp_item fmt err_desc.descriptions - +let pp_error_desc fmt err_desc = Pp.seq F.pp_print_string fmt err_desc.descriptions let error_desc_get_dotty err_desc = err_desc.dotty diff --git a/infer/src/IR/Mangled.ml b/infer/src/IR/Mangled.ml index fb39644e2..36825ae3b 100644 --- a/infer/src/IR/Mangled.ml +++ b/infer/src/IR/Mangled.ml @@ -32,7 +32,7 @@ let to_string_full (pn: t) = (** Pretty print a mangled name *) -let pp f pn = F.fprintf f "%s" (to_string pn) +let pp f pn = F.pp_print_string f (to_string pn) module Set = Caml.Set.Make (struct type nonrec t = t diff --git a/infer/src/IR/Procdesc.ml b/infer/src/IR/Procdesc.ml index 2026e47b0..7c05e50ff 100644 --- a/infer/src/IR/Procdesc.ml +++ b/infer/src/IR/Procdesc.ml @@ -114,7 +114,7 @@ module Node = struct match List.rev (get_instrs n) with instr :: _ -> Sil.instr_get_loc instr | [] -> n.loc - let pp_id f id = F.fprintf f "%d" id + let pp_id f id = F.pp_print_int f id let pp f node = pp_id f (get_id node) @@ -162,13 +162,13 @@ module Node = struct | Prune_node (_, _, descr) -> F.fprintf fmt "assume %s" descr | Exit_node _ -> - F.fprintf fmt "exit" + F.pp_print_string fmt "exit" | Skip_node s -> F.fprintf fmt "skip (%s)" s | Start_node _ -> - F.fprintf fmt "start" + F.pp_print_string fmt "start" | Join_node -> - F.fprintf fmt "join" + F.pp_print_string fmt "join" in F.fprintf fmt " %a " Location.pp (get_loc node) @@ -404,7 +404,7 @@ let is_loop_head pdesc (node: Node.t) = let pp_var_attributes fmt attrs = let pp_attribute fmt attr = - match attr with ProcAttributes.Modify_in_block -> Format.fprintf fmt "__block" + match attr with ProcAttributes.Modify_in_block -> Format.pp_print_string fmt "__block" in if List.is_empty attrs then () else F.fprintf fmt "(%a)" (Pp.seq ~sep:"," pp_attribute) attrs @@ -415,11 +415,11 @@ let pp_local fmt (var_data: ProcAttributes.var_data) = let pp_locals_list fmt etl = - if List.is_empty etl then Format.fprintf fmt "None" else List.iter ~f:(pp_local fmt) etl + if List.is_empty etl then Format.pp_print_string fmt "None" else List.iter ~f:(pp_local fmt) etl let pp_variable_list fmt etl = - if List.is_empty etl then Format.fprintf fmt "None" + if List.is_empty etl then Format.pp_print_string fmt "None" else List.iter ~f:(fun (id, ty) -> Format.fprintf fmt " %a:%a" Mangled.pp id (Typ.pp_full Pp.text) ty) diff --git a/infer/src/IR/Pvar.ml b/infer/src/IR/Pvar.ml index cbb98d8ae..505f2dfd3 100644 --- a/infer/src/IR/Pvar.ml +++ b/infer/src/IR/Pvar.ml @@ -69,7 +69,7 @@ let pp_ f pv = let name = pv.pv_name in match pv.pv_kind with | Local_var n -> - if !Config.pp_simple then F.fprintf f "%a" Mangled.pp name + if !Config.pp_simple then Mangled.pp f name else F.fprintf f "%a$%a" Typ.Procname.pp n Mangled.pp name | Callee_var n -> if !Config.pp_simple then F.fprintf f "%a|callee" Mangled.pp name diff --git a/infer/src/IR/QualifiedCppName.ml b/infer/src/IR/QualifiedCppName.ml index 8ae616994..3e08fb8b5 100644 --- a/infer/src/IR/QualifiedCppName.ml +++ b/infer/src/IR/QualifiedCppName.ml @@ -70,7 +70,7 @@ let to_separated_string quals ~sep = List.rev quals |> String.concat ~sep let to_qual_string = to_separated_string ~sep:cpp_separator -let pp fmt quals = Format.fprintf fmt "%s" (to_qual_string quals) +let pp fmt quals = Format.pp_print_string fmt (to_qual_string quals) module Match = struct type quals_matcher = Str.regexp diff --git a/infer/src/IR/Sil.ml b/infer/src/IR/Sil.ml index 4d7f56381..bb3f9c034 100644 --- a/infer/src/IR/Sil.ml +++ b/infer/src/IR/Sil.ml @@ -269,10 +269,10 @@ let pp_seq_diff pp pe0 f = () | [x] -> let _, changed = color_pre_wrapper pe0 f x in - F.fprintf f "%a" pp x ; color_post_wrapper changed f + pp f x ; color_post_wrapper changed f | x :: l -> let _, changed = color_pre_wrapper pe0 f x in - F.fprintf f "%a" pp x ; color_post_wrapper changed f ; F.fprintf f ", " ; doit l + pp f x ; color_post_wrapper changed f ; F.pp_print_string f ", " ; doit l in doit @@ -329,9 +329,9 @@ let d_texp_full (te: Exp.t) = L.add_print_action (L.PTtexp_full, Obj.repr te) (** Pretty print an offset *) let pp_offset pe f = function | Off_fld (fld, _) -> - F.fprintf f "%a" Typ.Fieldname.pp fld + Typ.Fieldname.pp f fld | Off_index exp -> - F.fprintf f "%a" (pp_exp_printenv pe) exp + (pp_exp_printenv pe) f exp (** Convert an offset to a string *) @@ -460,7 +460,7 @@ let pp_atom pe0 f a = let pe, changed = color_pre_wrapper pe0 f a in ( match a with | Aeq (BinOp (op, e1, e2), Const (Cint i)) when IntLit.isone i -> - F.fprintf f "%a" (pp_exp_printenv pe) (Exp.BinOp (op, e1, e2)) + (pp_exp_printenv pe) f (Exp.BinOp (op, e1, e2)) | Aeq (e1, e2) -> F.fprintf f "%a = %a" (pp_exp_printenv pe) e1 (pp_exp_printenv pe) e2 | Aneq (e1, e2) -> @@ -475,17 +475,10 @@ let pp_atom pe0 f a = (** dump an atom *) let d_atom (a: atom) = L.add_print_action (L.PTatom, Obj.repr a) -let pp_lseg_kind f = function Lseg_NE -> F.fprintf f "ne" | Lseg_PE -> () +let pp_lseg_kind f = function Lseg_NE -> F.pp_print_string f "ne" | Lseg_PE -> () (** Print a *-separated sequence. *) -let rec pp_star_seq pp f = function - | [] -> - () - | [x] -> - F.fprintf f "%a" pp x - | x :: l -> - F.fprintf f "%a * %a" pp x (pp_star_seq pp) l - +let pp_star_seq pp f l = Pp.seq ~sep:" * " pp f l (** Module Predicates records the occurrences of predicates as parameters of (doubly -)linked lists and Epara. Provides unique numbering @@ -915,9 +908,7 @@ let pp_hpred pe f = pp_hpred_env pe None f let d_sexp (se: strexp) = L.add_print_action (L.PTsexp, Obj.repr se) (** Pretty print a list of expressions. *) -let pp_sexp_list pe f sel = - F.fprintf f "%a" (Pp.seq (fun f se -> F.fprintf f "%a" (pp_sexp pe) se)) sel - +let pp_sexp_list pe f sel = (Pp.seq (fun f se -> (pp_sexp pe) f se)) f sel (** dump a hpred. *) let d_hpred (hpred: hpred) = L.add_print_action (L.PThpred, Obj.repr hpred) diff --git a/infer/src/IR/Subtype.ml b/infer/src/IR/Subtype.ml index 8d0288e4a..8cae3be0c 100644 --- a/infer/src/IR/Subtype.ml +++ b/infer/src/IR/Subtype.ml @@ -111,9 +111,9 @@ let pp f (t, flag) = if Config.print_types then match t with | Exact -> - F.fprintf f "%s" (flag_to_string flag) + F.pp_print_string f (flag_to_string flag) | Subtypes list -> - F.fprintf f "%s" (list_to_string list ^ flag_to_string flag) + F.fprintf f "%s%s" (list_to_string list) (flag_to_string flag) let exact = (Exact, NORMAL) diff --git a/infer/src/IR/Tenv.ml b/infer/src/IR/Tenv.ml index fb8735dc8..074cba743 100644 --- a/infer/src/IR/Tenv.ml +++ b/infer/src/IR/Tenv.ml @@ -145,7 +145,7 @@ let store_debug_file tenv tenv_filename = let debug_filename = DB.filename_to_string (DB.filename_add_suffix tenv_filename ".debug") in let out_channel = Out_channel.create debug_filename in let fmt = Format.formatter_of_out_channel out_channel in - Format.fprintf fmt "%a" pp tenv ; Out_channel.close out_channel + pp fmt tenv ; Out_channel.close out_channel let store_debug_file_for_source source_file tenv = diff --git a/infer/src/IR/Typ.ml b/infer/src/IR/Typ.ml index e3b25db65..a76d3a017 100644 --- a/infer/src/IR/Typ.ml +++ b/infer/src/IR/Typ.ml @@ -197,32 +197,37 @@ let escape pe = if Pp.equal_print_kind pe.Pp.kind Pp.HTML then Escape.escape_xml (** Pretty print a type with all the details, using the C syntax. *) let rec pp_full pe f typ = let pp_quals f {quals} = - if is_const quals then F.fprintf f " const " ; - if is_restrict quals then F.fprintf f " __restrict " ; - if is_volatile quals then F.fprintf f " volatile " + if is_const quals then F.pp_print_string f " const " ; + if is_restrict quals then F.pp_print_string f " __restrict " ; + if is_volatile quals then F.pp_print_string f " volatile " in let pp_desc f {desc} = match desc with | Tstruct tname -> - F.fprintf f "%a" (pp_name_c_syntax pe) tname + (pp_name_c_syntax pe) f tname | TVar name -> - F.fprintf f "%s" name + F.pp_print_string f name | Tint ik -> - F.fprintf f "%s" (ikind_to_string ik) + F.pp_print_string f (ikind_to_string ik) | Tfloat fk -> - F.fprintf f "%s" (fkind_to_string fk) + F.pp_print_string f (fkind_to_string fk) | Tvoid -> - F.fprintf f "void" + F.pp_print_string f "void" | Tfun {no_return= false} -> - F.fprintf f "_fn_" + F.pp_print_string f "_fn_" | Tfun {no_return= true} -> - F.fprintf f "_fn_noreturn_" + F.pp_print_string f "_fn_noreturn_" | Tptr (({desc= Tarray _ | Tfun _} as typ), pk) -> F.fprintf f "%a(%s)" (pp_full pe) typ (ptr_kind_string pk |> escape pe) | Tptr (typ, pk) -> F.fprintf f "%a%s" (pp_full pe) typ (ptr_kind_string pk |> escape pe) | Tarray {elt; length; stride} -> - let pp_int_opt fmt = function Some x -> IntLit.pp fmt x | None -> F.fprintf fmt "_" in + let pp_int_opt fmt = function + | Some x -> + IntLit.pp fmt x + | None -> + F.pp_print_char fmt '_' + in F.fprintf f "%a[%a*%a]" (pp_full pe) elt pp_int_opt length pp_int_opt stride in F.fprintf f "%a%a" pp_desc typ pp_quals typ @@ -230,11 +235,11 @@ let rec pp_full pe f typ = and pp_name_c_syntax pe f = function | CStruct name | CUnion name | ObjcClass name | ObjcProtocol name -> - F.fprintf f "%a" QualifiedCppName.pp name + QualifiedCppName.pp f name | CppClass (name, template_spec) -> F.fprintf f "%a%a" QualifiedCppName.pp name (pp_template_spec_info pe) template_spec | JavaClass name -> - F.fprintf f "%a" Mangled.pp name + Mangled.pp f name and pp_template_spec_info pe f = function @@ -1043,7 +1048,7 @@ module Procname = struct (** Pretty print a proc name *) - let pp f pn = F.fprintf f "%s" (to_string pn) + let pp f pn = F.pp_print_string f (to_string pn) (** hash function for procname *) let hash_pname = Hashtbl.hash @@ -1179,7 +1184,7 @@ module Fieldname = struct match String.rsplit2 s ~on:'.' with Some (_, s2) -> s2 | _ -> s - let pp f = function Java field_name | Clang {field_name} -> Format.fprintf f "%s" field_name + let pp f = function Java field_name | Clang {field_name} -> Format.pp_print_string f field_name let class_name_replace fname ~f = match fname with @@ -1276,7 +1281,7 @@ module Struct = struct supers (Pp.seq (fun f m -> F.fprintf f "@\n\t\t%a" Procname.pp m)) methods Annot.Item.pp annots - else F.fprintf f "%a" Name.pp name + else Name.pp f name let internal_mk_struct ?default ?fields ?statics ?methods ?supers ?annots () = diff --git a/infer/src/IR/Unop.ml b/infer/src/IR/Unop.ml index 2f8201a67..5988abaa2 100644 --- a/infer/src/IR/Unop.ml +++ b/infer/src/IR/Unop.ml @@ -22,4 +22,4 @@ type t = let equal = [%compare.equal : t] (** String representation of unary operator. *) -let str = function Neg -> "-" | BNot -> "~" | LNot -> "!" +let to_string = function Neg -> "-" | BNot -> "~" | LNot -> "!" diff --git a/infer/src/IR/Unop.mli b/infer/src/IR/Unop.mli index 671127025..f2ed5d4a2 100644 --- a/infer/src/IR/Unop.mli +++ b/infer/src/IR/Unop.mli @@ -21,5 +21,5 @@ type t = val equal : t -> t -> bool -val str : t -> string +val to_string : t -> string (** String representation of a unary operator. *) diff --git a/infer/src/IR/Var.ml b/infer/src/IR/Var.ml index 3af18702f..7b8b2c6f3 100644 --- a/infer/src/IR/Var.ml +++ b/infer/src/IR/Var.ml @@ -47,7 +47,7 @@ let appears_in_source_code = function let pp fmt = function | ProgramVar pv -> - F.fprintf fmt "%s" (Pvar.get_simplified_name pv) + F.pp_print_string fmt (Pvar.get_simplified_name pv) | LogicalVar id -> Ident.pp fmt id diff --git a/infer/src/absint/AbstractDomain.ml b/infer/src/absint/AbstractDomain.ml index 8854413ed..ba724e0a6 100644 --- a/infer/src/absint/AbstractDomain.ml +++ b/infer/src/absint/AbstractDomain.ml @@ -89,7 +89,11 @@ module BottomLifted (Domain : S) = struct NonBottom (Domain.widen ~prev ~next ~num_iters) - let pp fmt = function Bottom -> F.fprintf fmt "_|_" | NonBottom astate -> Domain.pp fmt astate + let pp fmt = function + | Bottom -> + F.pp_print_string fmt "_|_" + | NonBottom astate -> + Domain.pp fmt astate end module TopLifted (Domain : S) = struct @@ -129,7 +133,7 @@ module TopLifted (Domain : S) = struct NonTop (Domain.widen ~prev ~next ~num_iters) - let pp fmt = function Top -> F.fprintf fmt "T" | NonTop astate -> Domain.pp fmt astate + let pp fmt = function Top -> F.pp_print_char fmt 'T' | NonTop astate -> Domain.pp fmt astate end module Pair (Domain1 : S) (Domain2 : S) = struct @@ -285,7 +289,7 @@ module BooleanAnd = struct let widen ~prev ~next ~num_iters:_ = join prev next - let pp fmt astate = F.fprintf fmt "%b" astate + let pp fmt astate = F.pp_print_bool fmt astate end module BooleanOr = struct @@ -301,7 +305,7 @@ module BooleanOr = struct let widen ~prev ~next ~num_iters:_ = join prev next - let pp fmt astate = F.fprintf fmt "%b" astate + let pp fmt astate = F.pp_print_bool fmt astate end module type MaxCount = sig diff --git a/infer/src/backend/InferPrint.ml b/infer/src/backend/InferPrint.ml index 60fad3ed7..a9b58fbcc 100644 --- a/infer/src/backend/InferPrint.ml +++ b/infer/src/backend/InferPrint.ml @@ -33,7 +33,7 @@ let load_specfiles () = let error_desc_to_plain_string error_desc = - let pp fmt = F.fprintf fmt "%a" Localise.pp_error_desc error_desc in + let pp fmt = Localise.pp_error_desc fmt error_desc in let s = F.asprintf "%t" pp in let s = String.strip s in let s = @@ -100,7 +100,7 @@ let summary_values summary = let attributes = Specs.get_attributes summary in let err_log = Specs.get_err_log summary in let proc_name = Specs.get_proc_name summary in - let signature = Specs.get_signature summary in + let vsignature = Specs.get_signature summary in let specs = Specs.get_specs_from_payload summary in let lines_visited = let visited = ref Specs.Visitedset.empty in @@ -112,9 +112,9 @@ let summary_values summary = !visited ; Int.Set.elements !visited_lines in - let proof_trace = - let pp_line fmt l = F.fprintf fmt "%d" l in - let pp fmt = F.fprintf fmt "%a" (Pp.seq pp_line) lines_visited in + let vproof_trace = + let pp_line fmt l = F.pp_print_int fmt l in + let pp fmt = Pp.seq pp_line fmt lines_visited in F.asprintf "%t" pp in let pp_failure failure = F.asprintf "%a" SymOp.pp_failure_kind failure in @@ -131,8 +131,8 @@ let summary_values summary = ; vflags= attributes.ProcAttributes.proc_flags ; vfile= SourceFile.to_string attributes.ProcAttributes.loc.Location.file ; vline= attributes.ProcAttributes.loc.Location.line - ; vsignature= signature - ; vproof_trace= proof_trace } + ; vsignature + ; vproof_trace } module ProcsCsv = struct @@ -300,7 +300,7 @@ let pp_custom_of_report fmt report fields = let open Jsonbug_t in let comma_separator index = if index > 0 then ", " else "" in let pp_trace fmt trace comma = - let pp_trace_elem fmt {description} = F.fprintf fmt "%s" description in + let pp_trace_elem fmt {description} = F.pp_print_string fmt description in let trace_without_empty_descs = List.filter ~f:(fun {description} -> description <> "") trace in @@ -344,7 +344,7 @@ let pp_custom_of_report fmt report fields = | `Issue_field_procedure_id_without_crc -> Format.fprintf fmt "%s%s" (comma_separator index) (DB.strip_crc issue.procedure_id) | `Issue_field_qualifier_contains_potential_exception_note -> - Format.fprintf fmt "%B" + Format.pp_print_bool fmt (String.is_substring issue.qualifier ~substring:potential_exception_message) in List.iteri ~f:pp_field fields ; Format.fprintf fmt "@." diff --git a/infer/src/backend/cluster.ml b/infer/src/backend/cluster.ml index 56758d603..eeb7ac28d 100644 --- a/infer/src/backend/cluster.ml +++ b/infer/src/backend/cluster.ml @@ -37,11 +37,11 @@ let cl_name n = "cl" ^ string_of_int n let cl_file n = "x" ^ cl_name n ^ ".cluster" -let pp_cluster_name fmt n = Format.fprintf fmt "%s" (cl_name n) +let pp_cluster_name fmt n = Format.pp_print_string fmt (cl_name n) let pp_cluster fmt (nr, cluster) = let fname = Config.results_dir ^/ Config.multicore_dir_name ^/ cl_file nr in - let pp_cl fmt n = Format.fprintf fmt "%s" (cl_name n) in + let pp_cl fmt n = Format.pp_print_string fmt (cl_name n) in store_to_file (DB.filename_from_string fname) (nr, cluster) ; F.fprintf fmt "%a: @\n" pp_cl nr ; F.fprintf fmt "\t%@$(INFERANALYZE) --cluster '%s'@\n" fname ; diff --git a/infer/src/backend/clusterMakefile.ml b/infer/src/backend/clusterMakefile.ml index a56049450..20e222e9a 100644 --- a/infer/src/backend/clusterMakefile.ml +++ b/infer/src/backend/clusterMakefile.ml @@ -27,7 +27,7 @@ let pp_prolog fmt clusters = F.fprintf fmt "INFERANALYZE = '%s' --no-report --results-dir '%s' %s@\n@\n" (Config.bin_dir ^/ InferCommand.(to_exe_name Analyze)) (escape Config.results_dir) compilation_dbs_cmd ; - F.fprintf fmt "CLUSTERS=" ; + F.pp_print_string fmt "CLUSTERS=" ; List.iteri ~f:(fun i _ -> F.fprintf fmt "%a " Cluster.pp_cluster_name (i + 1)) clusters ; F.fprintf fmt "@\n@\ndefault: test@\n@\nall: test@\n@\n" ; F.fprintf fmt "test: $(CLUSTERS)@\n" ; diff --git a/infer/src/backend/crashcontext.ml b/infer/src/backend/crashcontext.ml index f3e5aa809..b810dfd73 100644 --- a/infer/src/backend/crashcontext.ml +++ b/infer/src/backend/crashcontext.ml @@ -141,4 +141,4 @@ let crashcontext_epilogue ~in_buck_mode = collect_all_summaries root_summaries_dir Config.stacktrace Config.stacktraces_dir -let pp_stacktree fmt st = Format.fprintf fmt "%s" (Stacktree_j.string_of_stacktree st) +let pp_stacktree fmt st = Format.pp_print_string fmt (Stacktree_j.string_of_stacktree st) diff --git a/infer/src/backend/dotty.ml b/infer/src/backend/dotty.ml index 40e24a041..a39a9133b 100644 --- a/infer/src/backend/dotty.ml +++ b/infer/src/backend/dotty.ml @@ -133,11 +133,11 @@ let strip_special_chars b = let rec strexp_to_string pe coo f se = match se with | Sil.Eexp (Exp.Lvar pvar, _) -> - F.fprintf f "%a" (Pvar.pp pe) pvar + (Pvar.pp pe) f pvar | Sil.Eexp (Exp.Var id, _) -> - if !print_full_prop then F.fprintf f "%a" Ident.pp id else () + if !print_full_prop then Ident.pp f id else () | Sil.Eexp (e, _) -> - if !print_full_prop then F.fprintf f "%a" (Sil.pp_exp_printenv pe) e else F.fprintf f "_" + if !print_full_prop then (Sil.pp_exp_printenv pe) f e else F.pp_print_char f '_' | Sil.Estruct (ls, _) -> F.fprintf f " STRUCT | { %a } " (struct_to_dotty_str pe coo) ls | Sil.Earray (e, idx, _) -> @@ -159,7 +159,7 @@ and struct_to_dotty_str pe coo f ls : unit = and get_contents_sexp pe coo f se = match se with | Sil.Eexp (e', _) -> - F.fprintf f "%a" (Sil.pp_exp_printenv pe) e' + (Sil.pp_exp_printenv pe) f e' | Sil.Estruct (se', _) -> F.fprintf f "| { %a }" (struct_to_dotty_str pe coo) se' | Sil.Earray (e', [], _) -> @@ -179,7 +179,7 @@ and get_contents pe coo f = function | [] -> () | [idx_se] -> - F.fprintf f "%a" (get_contents_single pe coo) idx_se + (get_contents_single pe coo) f idx_se | idx_se :: l -> F.fprintf f "%a | %a" (get_contents_single pe coo) idx_se (get_contents pe coo) l @@ -1111,7 +1111,7 @@ let pp_cfgnodelabel pdesc fmt (n: Procdesc.Node.t) = | Procdesc.Node.Exit_node pname -> Format.fprintf fmt "Exit %s" (Escape.escape_dotty (Typ.Procname.to_string pname)) | Procdesc.Node.Join_node -> - Format.fprintf fmt "+" + Format.pp_print_char fmt '+' | Procdesc.Node.Prune_node (is_true_branch, if_kind, _) -> Format.fprintf fmt "Prune (%b branch, %s)" is_true_branch (Sil.if_kind_to_string if_kind) | Procdesc.Node.Stmt_node s -> @@ -1134,7 +1134,7 @@ let pp_cfgnodelabel pdesc fmt (n: Procdesc.Node.t) = let pp_cfgnodeshape fmt (n: Procdesc.Node.t) = match Procdesc.Node.get_kind n with | Procdesc.Node.Start_node _ | Procdesc.Node.Exit_node _ -> - F.fprintf fmt "color=yellow style=filled" + F.pp_print_string fmt "color=yellow style=filled" | Procdesc.Node.Prune_node _ -> F.fprintf fmt "shape=\"invhouse\"" | Procdesc.Node.Skip_node _ -> diff --git a/infer/src/backend/inferconfig.ml b/infer/src/backend/inferconfig.ml index e665e0408..fecad34a2 100644 --- a/infer/src/backend/inferconfig.ml +++ b/infer/src/backend/inferconfig.ml @@ -148,19 +148,15 @@ module FileOrProcMatcher = struct let load_matcher = create_file_matcher let _pp_pattern fmt pattern = - let pp_string fmt s = Format.fprintf fmt "%s" s in - let pp_option pp_value fmt = function - | None -> - pp_string fmt "None" - | Some value -> - Format.fprintf fmt "%a" pp_value value - in let pp_key_value pp_value fmt (key, value) = - Format.fprintf fmt " %s: %a,@\n" key (pp_option pp_value) value + Format.fprintf fmt " %s: %a,@\n" key (Pp.option pp_value) value in let pp_method_pattern fmt mp = - Format.fprintf fmt "%a%a" (pp_key_value pp_string) ("class", Some mp.class_name) - (pp_key_value pp_string) ("method", mp.method_name) + Format.fprintf fmt "%a%a" + (pp_key_value Format.pp_print_string) + ("class", Some mp.class_name) + (pp_key_value Format.pp_print_string) + ("method", mp.method_name) and pp_source_contains fmt sc = Format.fprintf fmt " pattern: %s@\n" sc in match pattern with | Method_pattern (language, mp) -> diff --git a/infer/src/backend/specs.ml b/infer/src/backend/specs.ml index 7c62b353d..62dff60d2 100644 --- a/infer/src/backend/specs.ml +++ b/infer/src/backend/specs.ml @@ -255,7 +255,7 @@ type status = Pending | Analyzed [@@deriving compare] let string_of_status = function Pending -> "Pending" | Analyzed -> "Analyzed" -let pp_status fmt status = F.fprintf fmt "%s" (string_of_status status) +let pp_status fmt status = F.pp_print_string fmt (string_of_status status) let equal_status = [%compare.equal : status] @@ -317,7 +317,7 @@ let pp_failure_kind_opt fmt failure_kind_opt = | Some failure_kind -> SymOp.pp_failure_kind fmt failure_kind | None -> - F.fprintf fmt "NONE" + F.pp_print_string fmt "NONE" let pp_errlog fmt err_log = @@ -346,14 +346,14 @@ let pp_spec pe num_opt fmt spec = F.fprintf fmt "--------------------------- %s ---------------------------@\n" num_str ; F.fprintf fmt "PRE:@\n%a@\n" (Prop.pp_prop Pp.text) pre ; F.fprintf fmt "%a@\n" (Propgraph.pp_proplist pe_post "POST" (pre, true)) post_list ; - F.fprintf fmt "----------------------------------------------------------------" + F.pp_print_string fmt "----------------------------------------------------------------" | HTML -> F.fprintf fmt "--------------------------- %s ---------------------------@\n" num_str ; F.fprintf fmt "PRE:@\n%a%a%a@\n" Io_infer.Html.pp_start_color Pp.Blue (Prop.pp_prop (Pp.html Blue)) pre Io_infer.Html.pp_end_color () ; - F.fprintf fmt "%a" (Propgraph.pp_proplist pe_post "POST" (pre, true)) post_list ; - F.fprintf fmt "----------------------------------------------------------------" + (Propgraph.pp_proplist pe_post "POST" (pre, true)) fmt post_list ; + F.pp_print_string fmt "----------------------------------------------------------------" (** Dump a spec *) @@ -367,7 +367,7 @@ let pp_specs pe fmt specs = List.iter ~f:(fun spec -> incr cnt ; - F.fprintf fmt "%a" (pp_spec pe (Some (!cnt, total))) spec ) + (pp_spec pe (Some (!cnt, total))) fmt spec ) specs | HTML -> List.iter @@ -390,12 +390,8 @@ let get_signature summary = let decl = F.asprintf "%t" pp in s := if String.equal !s "" then decl else !s ^ ", " ^ decl ) (get_formals summary) ; - let pp f = - F.fprintf f "%a %a" (Typ.pp_full Pp.text) (get_ret_type summary) Typ.Procname.pp - (get_proc_name summary) - in - let decl = F.asprintf "%t" pp in - decl ^ "(" ^ !s ^ ")" + F.asprintf "%a %a(%s)" (Typ.pp_full Pp.text) (get_ret_type summary) Typ.Procname.pp + (get_proc_name summary) !s let get_specs_from_preposts preposts = Option.value_map ~f:NormSpec.tospecs ~default:[] preposts diff --git a/infer/src/base/FileDiff.ml b/infer/src/base/FileDiff.ml index 5659a524d..d714f9de1 100644 --- a/infer/src/base/FileDiff.ml +++ b/infer/src/base/FileDiff.ml @@ -33,11 +33,11 @@ module UnixDiff = struct let pp fmt d = match d with | Unchanged -> - Format.fprintf fmt "U" + Format.pp_print_char fmt 'U' | New -> - Format.fprintf fmt "N" + Format.pp_print_char fmt 'N' | Old -> - Format.fprintf fmt "O" + Format.pp_print_char fmt 'O' module VISIBLE_FOR_TESTING_DO_NOT_USE_DIRECTLY = struct @@ -69,8 +69,9 @@ let parse_directives directives = in if List.is_empty directives then (* handle the case where both files are empty *) [] - else if (* handle the case where the new-file is empty *) - List.for_all ~f:(UnixDiff.equal UnixDiff.Old) directives + else if + (* handle the case where the new-file is empty *) + List.for_all ~f:(UnixDiff.equal UnixDiff.Old) directives then [1] else let pred_is_old, directives' = diff --git a/infer/src/base/IssueType.ml b/infer/src/base/IssueType.ml index 44d966533..6102a836d 100644 --- a/infer/src/base/IssueType.ml +++ b/infer/src/base/IssueType.ml @@ -73,7 +73,7 @@ end include Unsafe (** pretty print a localised string *) -let pp fmt t = Format.fprintf fmt "%s" t.unique_id +let pp fmt t = Format.pp_print_string fmt t.unique_id let abduction_case_not_implemented = from_string "Abduction_case_not_implemented" diff --git a/infer/src/base/Logging.ml b/infer/src/base/Logging.ml index 70dd09dfb..b2ccdf026 100644 --- a/infer/src/base/Logging.ml +++ b/infer/src/base/Logging.ml @@ -287,7 +287,7 @@ let ocaml_pos_to_string (file, lnum, cnum, enum) = (** Pretty print a location of ml source *) -let pp_ocaml_pos fmt ocaml_pos = F.fprintf fmt "%s" (ocaml_pos_to_string ocaml_pos) +let pp_ocaml_pos fmt ocaml_pos = F.pp_print_string fmt (ocaml_pos_to_string ocaml_pos) let pp_ocaml_pos_opt fmt ocaml_pos_opt = if Config.developer_mode then diff --git a/infer/src/base/SourceFile.ml b/infer/src/base/SourceFile.ml index 21771a82e..b39bc5cf9 100644 --- a/infer/src/base/SourceFile.ml +++ b/infer/src/base/SourceFile.ml @@ -77,7 +77,7 @@ let to_string fname = path -let pp fmt fname = Format.fprintf fmt "%s" (to_string fname) +let pp fmt fname = Format.pp_print_string fmt (to_string fname) let to_abs_path fname = match fname with diff --git a/infer/src/base/SymOp.ml b/infer/src/base/SymOp.ml index e6ed66b58..041fce953 100644 --- a/infer/src/base/SymOp.ml +++ b/infer/src/base/SymOp.ml @@ -43,7 +43,7 @@ let try_finally ~f ~finally = let pp_failure_kind fmt = function | FKtimeout -> - F.fprintf fmt "TIMEOUT" + F.pp_print_string fmt "TIMEOUT" | FKsymops_timeout symops -> F.fprintf fmt "SYMOPS TIMEOUT (%d)" symops | FKrecursion_timeout level -> diff --git a/infer/src/biabduction/Paths.ml b/infer/src/biabduction/Paths.ml index 6d2de09ba..86c3e1698 100644 --- a/infer/src/biabduction/Paths.ml +++ b/infer/src/biabduction/Paths.ml @@ -388,7 +388,7 @@ end = struct Invariant.reset_stats path ; str - let pp_stats fmt path = F.fprintf fmt "%s" (stats_string path) + let pp_stats fmt path = F.pp_print_string fmt (stats_string path) let d_stats path = L.d_str (stats_string path) diff --git a/infer/src/biabduction/Prop.ml b/infer/src/biabduction/Prop.ml index ca58e9ecb..806565cf3 100644 --- a/infer/src/biabduction/Prop.ml +++ b/infer/src/biabduction/Prop.ml @@ -151,7 +151,7 @@ let pp_sub pe f = function let pi_sub = List.map ~f:(fun (id, e) -> Sil.Aeq (Var id, e)) (Sil.sub_to_list sub) in Pp.semicolon_seq ~print_env:{pe with break_lines= false} (Sil.pp_atom pe) f pi_sub | `Typ _ -> - F.fprintf f "Printing typ_subst not implemented." + F.pp_print_string f "Printing typ_subst not implemented." (** Dump a substitution. *) @@ -199,8 +199,7 @@ let pp_sigma_simple pe env fmt sigma = let sigma_stack, sigma_nonstack = sigma_get_stack_nonstack false sigma in let pp_stack fmt sg_ = let sg = List.sort ~compare:Sil.compare_hpred sg_ in - if sg <> [] then - Format.fprintf fmt "%a" (Pp.semicolon_seq ~print_env:pe (pp_hpred_stackvar pe)) sg + if sg <> [] then (Pp.semicolon_seq ~print_env:pe (pp_hpred_stackvar pe)) fmt sg in let pp_nl fmt doit = if doit then Format.fprintf fmt " ;@\n" in let pp_nonstack fmt = Pp.semicolon_seq ~print_env:pe (Sil.pp_hpred_env pe (Some env)) fmt in diff --git a/infer/src/biabduction/RetainCyclesType.ml b/infer/src/biabduction/RetainCyclesType.ml index bd25b10a7..ea6519c89 100644 --- a/infer/src/biabduction/RetainCyclesType.ml +++ b/infer/src/biabduction/RetainCyclesType.ml @@ -143,7 +143,7 @@ let pp_dotty fmt cycle = | Object obj -> Format.fprintf fmt "Object: %s" (Typ.to_string obj.rc_from.rc_node_typ) | Block _ -> - Format.fprintf fmt "Block" + Format.pp_print_string fmt "Block" in let pp_dotty_id fmt element = match element with @@ -152,7 +152,7 @@ let pp_dotty fmt cycle = (Typ.to_string obj.rc_from.rc_node_typ) Typ.Fieldname.pp obj.rc_field.rc_field_name | Block (name, _) -> - Format.fprintf fmt "%s" (Typ.Procname.to_unique_id name) + Format.pp_print_string fmt (Typ.Procname.to_unique_id name) in let pp_dotty_field fmt element = match element with diff --git a/infer/src/biabduction/Tabulation.ml b/infer/src/biabduction/Tabulation.ml index 5062be8bf..49347b72e 100644 --- a/infer/src/biabduction/Tabulation.ml +++ b/infer/src/biabduction/Tabulation.ml @@ -340,7 +340,7 @@ let check_dereferences caller_pname tenv callee_pname actual_pre sub spec_pre fo L.d_ln () ; L.d_str "exp " ; Sil.d_exp e ; - L.d_strln (" desc: " ^ F.asprintf "%a" Localise.pp_error_desc error_desc) ; + L.d_strln (F.asprintf " desc: %a" Localise.pp_error_desc error_desc) ; error_desc in let deref_no_null_check_pos = diff --git a/infer/src/bufferoverrun/absLoc.ml b/infer/src/bufferoverrun/absLoc.ml index 8b269b5e3..d89dbe04e 100644 --- a/infer/src/bufferoverrun/absLoc.ml +++ b/infer/src/bufferoverrun/absLoc.ml @@ -16,7 +16,7 @@ module F = Format module Allocsite = struct include String - let pp fmt s = Format.fprintf fmt "%s" s + let pp fmt s = Format.pp_print_string fmt s let make x = x @@ -36,8 +36,8 @@ module Loc = struct Var.pp F.str_formatter v ; let s = F.flush_str_formatter () in if Char.equal s.[0] '&' then - F.fprintf fmt "%s" (String.sub s ~pos:1 ~len:(String.length s - 1)) - else F.fprintf fmt "%s" s + F.pp_print_string fmt (String.sub s ~pos:1 ~len:(String.length s - 1)) + else F.pp_print_string fmt s | Allocsite a -> Allocsite.pp fmt a | Field (l, f) -> diff --git a/infer/src/bufferoverrun/bufferOverrunDomain.ml b/infer/src/bufferoverrun/bufferOverrunDomain.ml index c4e69dd09..fed33b2b4 100644 --- a/infer/src/bufferoverrun/bufferOverrunDomain.ml +++ b/infer/src/bufferoverrun/bufferOverrunDomain.ml @@ -451,11 +451,11 @@ module AliasRet = struct fun fmt x -> match x with | Top -> - F.fprintf fmt "T" + F.pp_print_char fmt 'T' | L loc -> AliasTarget.pp fmt loc | Bot -> - F.fprintf fmt "_|_" + F.pp_print_string fmt "_|_" let find : astate -> AliasTarget.t option = fun x -> match x with L loc -> Some loc | _ -> None @@ -631,10 +631,7 @@ module MemReach = struct let pp_summary : F.formatter -> t -> unit = - fun fmt x -> - F.fprintf fmt "@[Parameters:@," ; - F.fprintf fmt "%a" Heap.pp_summary x.heap ; - F.fprintf fmt "@]" + fun fmt x -> F.fprintf fmt "@[Parameters:@,%a@]" Heap.pp_summary x.heap let find_stack : Loc.t -> t -> Val.t = fun k m -> Stack.find k m.stack @@ -803,7 +800,7 @@ module Mem = struct fun fmt m -> match m with | Bottom -> - F.fprintf fmt "unreachable" + F.pp_print_string fmt "unreachable" | NonBottom m' -> MemReach.pp_summary fmt m' diff --git a/infer/src/bufferoverrun/bufferOverrunTrace.ml b/infer/src/bufferoverrun/bufferOverrunTrace.ml index 8c85d216e..019c23e55 100644 --- a/infer/src/bufferoverrun/bufferOverrunTrace.ml +++ b/infer/src/bufferoverrun/bufferOverrunTrace.ml @@ -53,7 +53,7 @@ module BoTrace = struct let pp : F.formatter -> t -> unit = fun fmt t -> - let pp_sep fmt () = F.fprintf fmt " :: " in + let pp_sep fmt () = F.pp_print_string fmt " :: " in F.pp_print_list ~pp_sep pp_elem fmt t.trace diff --git a/infer/src/bufferoverrun/itv.ml b/infer/src/bufferoverrun/itv.ml index e49838760..84329247a 100644 --- a/infer/src/bufferoverrun/itv.ml +++ b/infer/src/bufferoverrun/itv.ml @@ -213,7 +213,8 @@ module SymLinear = struct let pp : F.formatter -> t -> unit = fun fmt x -> - if M.is_empty x then F.fprintf fmt "empty" else Pp.seq ~sep:" + " pp1 fmt (M.bindings x) + if M.is_empty x then F.pp_print_string fmt "empty" + else Pp.seq ~sep:" + " pp1 fmt (M.bindings x) let zero : t = M.empty @@ -299,7 +300,11 @@ module Bound = struct let eval_int x i1 i2 = match x with Plus -> i1 + i2 | Minus -> i1 - i2 let pp ~need_plus : F.formatter -> t -> unit = - fun fmt -> function Plus -> if need_plus then F.fprintf fmt "+" | Minus -> F.fprintf fmt "-" + fun fmt -> function + | Plus -> + if need_plus then F.pp_print_char fmt '+' + | Minus -> + F.pp_print_char fmt '-' end type min_max = Min | Max [@@deriving compare] @@ -314,7 +319,7 @@ module Bound = struct let eval_int x i1 i2 = match x with Min -> min i1 i2 | Max -> max i1 i2 let pp : F.formatter -> t -> unit = - fun fmt -> function Min -> F.fprintf fmt "min" | Max -> F.fprintf fmt "max" + fun fmt -> function Min -> F.pp_print_string fmt "min" | Max -> F.pp_print_string fmt "max" end (* MinMax constructs a bound that is in the "int [+|-] [min|max](int, symbol)" format. @@ -329,15 +334,15 @@ module Bound = struct let pp : F.formatter -> t -> unit = fun fmt -> function | MInf -> - F.fprintf fmt "-oo" + F.pp_print_string fmt "-oo" | PInf -> - F.fprintf fmt "+oo" + F.pp_print_string fmt "+oo" | Linear (c, x) -> - if SymLinear.is_zero x then F.fprintf fmt "%d" c - else if Int.equal c 0 then F.fprintf fmt "%a" SymLinear.pp x + if SymLinear.is_zero x then F.pp_print_int fmt c + else if Int.equal c 0 then SymLinear.pp fmt x else F.fprintf fmt "%a + %d" SymLinear.pp x c | MinMax (c, sign, m, d, x) -> - if Int.equal c 0 then F.fprintf fmt "%a" (Sign.pp ~need_plus:false) sign + if Int.equal c 0 then (Sign.pp ~need_plus:false) fmt sign else F.fprintf fmt "%d%a" c (Sign.pp ~need_plus:true) sign ; F.fprintf fmt "%a(%d, %a)" MinMax.pp m d Symbol.pp x diff --git a/infer/src/checkers/Ownership.ml b/infer/src/checkers/Ownership.ml index 0f6615c71..fd89f9a4e 100644 --- a/infer/src/checkers/Ownership.ml +++ b/infer/src/checkers/Ownership.ml @@ -78,7 +78,7 @@ module CapabilityDomain = struct | BorrowedFrom vars -> F.fprintf fmt "BorrowedFrom(%a)" VarSet.pp vars | Owned -> - F.fprintf fmt "Owned" + F.pp_print_string fmt "Owned" end let rec is_function_typ = function diff --git a/infer/src/checkers/Passthrough.ml b/infer/src/checkers/Passthrough.ml index d7f403b84..fa6ecf46c 100644 --- a/infer/src/checkers/Passthrough.ml +++ b/infer/src/checkers/Passthrough.ml @@ -8,7 +8,6 @@ *) open! IStd -module F = Format (* for now this is just a call site, but in the future we may add input access path, output kind, etc. depending on what we need *) @@ -18,7 +17,7 @@ let make site = {site} let site t = t.site -let pp fmt s = F.fprintf fmt "%a" CallSite.pp s.site +let pp fmt s = CallSite.pp fmt s.site module Set = PrettyPrintable.MakePPSet (struct type nonrec t = t diff --git a/infer/src/checkers/Trace.ml b/infer/src/checkers/Trace.ml index 426ffbd7b..e5a4d3b26 100644 --- a/infer/src/checkers/Trace.ml +++ b/infer/src/checkers/Trace.ml @@ -206,7 +206,7 @@ module Make (Spec : Spec) = struct F.fprintf fmt " + Sanitizers(%a)" Sanitizers.pp sanitizers in if Known.is_empty known then - if Footprint.is_empty footprint then F.fprintf fmt "{}" + if Footprint.is_empty footprint then F.pp_print_string fmt "{}" else F.fprintf fmt "Footprint(%a)%a" Footprint.pp footprint pp_sanitizers sanitizers else F.fprintf fmt "%a + Footprint(%a)%a" Known.pp known Footprint.pp footprint pp_sanitizers @@ -271,7 +271,7 @@ module Make (Spec : Spec) = struct F.fprintf fmt " via %a" Passthroughs.pp passthroughs in let pp_sinks fmt sinks = - if Sinks.is_empty sinks then F.fprintf fmt "?" else Sinks.pp fmt sinks + if Sinks.is_empty sinks then F.pp_print_char fmt '?' else Sinks.pp fmt sinks in (* empty sources implies empty sinks and passthroughs *) F.fprintf fmt "%a ~> %a%a" Sources.pp sources pp_sinks sinks pp_passthroughs passthroughs diff --git a/infer/src/checkers/accessTree.ml b/infer/src/checkers/accessTree.ml index b742118ab..bd9005b7e 100644 --- a/infer/src/checkers/accessTree.ml +++ b/infer/src/checkers/accessTree.ml @@ -422,13 +422,13 @@ module Make (TraceDomain : AbstractDomain.WithBottom) (Config : Config) = struct | Subtree access_map -> AccessMap.pp ~pp_value:pp_node fmt access_map | Star -> - F.fprintf fmt "*" + F.pp_print_char fmt '*' in if not (TraceDomain.is_empty trace) then if not (is_empty_tree subtree) then F.fprintf fmt "(%a, %a)" TraceDomain.pp trace pp_subtree subtree - else F.fprintf fmt "%a" TraceDomain.pp trace - else F.fprintf fmt "%a" pp_subtree subtree + else TraceDomain.pp fmt trace + else pp_subtree fmt subtree let pp fmt base_tree = BaseMap.pp ~pp_value:pp_node fmt base_tree diff --git a/infer/src/clang/Capture.ml b/infer/src/clang/Capture.ml index a755ee11e..e902b4f21 100644 --- a/infer/src/clang/Capture.ml +++ b/infer/src/clang/Capture.ml @@ -83,7 +83,7 @@ let run_clang_frontend ast_source = let pp_ast_filename fmt ast_source = match ast_source with | `File path -> - Format.fprintf fmt "%s" path + Format.pp_print_string fmt path | `Pipe _ -> Format.fprintf fmt "stdin of %a" SourceFile.pp trans_unit_ctx.CFrontend_config.source_file in diff --git a/infer/src/clang/cTL.ml b/infer/src/clang/cTL.ml index 138a03a26..31b2ec4a1 100644 --- a/infer/src/clang/cTL.ml +++ b/infer/src/clang/cTL.ml @@ -159,7 +159,7 @@ module Debug = struct | PointerToDecl -> Format.pp_print_string fmt "PointerToDecl" in - match trans_opt with Some trans -> pp_aux fmt trans | None -> Format.pp_print_string fmt "_" + match trans_opt with Some trans -> pp_aux fmt trans | None -> Format.pp_print_char fmt '_' (* a flag to print more or less in the dotty graph *) @@ -169,20 +169,20 @@ module Debug = struct let nodes_to_string nl = List.map ~f:ALVar.alexp_to_string nl in match phi with | True -> - Format.fprintf fmt "True" + Format.pp_print_string fmt "True" | False -> - Format.fprintf fmt "False" + Format.pp_print_string fmt "False" | Atomic p -> CPredicates.pp_predicate fmt p | Not phi -> if full_print then Format.fprintf fmt "NOT(%a)" pp_formula phi - else Format.fprintf fmt "NOT(...)" + else Format.pp_print_string fmt "NOT(...)" | And (phi1, phi2) -> if full_print then Format.fprintf fmt "(%a AND %a)" pp_formula phi1 pp_formula phi2 - else Format.fprintf fmt "(... AND ...)" + else Format.pp_print_string fmt "(... AND ...)" | Or (phi1, phi2) -> if full_print then Format.fprintf fmt "(%a OR %a)" pp_formula phi1 pp_formula phi2 - else Format.fprintf fmt "(... OR ...)" + else Format.pp_print_string fmt "(... OR ...)" | Implies (phi1, phi2) -> Format.fprintf fmt "(%a ==> %a)" pp_formula phi1 pp_formula phi2 | InNode (nl, phi) -> diff --git a/infer/src/concurrency/RacerD.ml b/infer/src/concurrency/RacerD.ml index c8cf39686..300bf8b2f 100644 --- a/infer/src/concurrency/RacerD.ml +++ b/infer/src/concurrency/RacerD.ml @@ -863,11 +863,11 @@ let pp_container_access fmt (access_path, access_pname) = let pp_access fmt sink = match RacerDDomain.PathDomain.Sink.kind sink with | Read access_path | Write access_path -> - F.fprintf fmt "%a" (MF.wrap_monospaced AccessPath.pp) access_path + (MF.wrap_monospaced AccessPath.pp) fmt access_path | ContainerRead (access_path, access_pname) | ContainerWrite (access_path, access_pname) -> pp_container_access fmt (access_path, access_pname) | InterfaceCall _ as access -> - F.fprintf fmt "%a" RacerDDomain.Access.pp access + RacerDDomain.Access.pp fmt access let desc_of_sink sink = @@ -1084,7 +1084,7 @@ type reported_access = let make_read_write_race_description ~read_is_sync (conflict: reported_access) pname final_sink_site initial_sink_site final_sink = let pp_conflict fmt {procdesc} = - F.fprintf fmt "%s" + F.pp_print_string fmt (Typ.Procname.to_simplified_string ~withclass:true (Procdesc.get_proc_name procdesc)) in let conflicts_description = diff --git a/infer/src/concurrency/RacerDDomain.ml b/infer/src/concurrency/RacerDDomain.ml index 8a6bd3096..ae6a31035 100644 --- a/infer/src/concurrency/RacerDDomain.ml +++ b/infer/src/concurrency/RacerDDomain.ml @@ -225,7 +225,7 @@ module ThreadsDomain = struct let widen ~prev ~next ~num_iters:_ = join prev next let pp fmt astate = - F.fprintf fmt + F.pp_print_string fmt ( match astate with | NoThread -> "NoThread" @@ -259,9 +259,9 @@ module Choice = struct let pp fmt = function | OnMainThread -> - F.fprintf fmt "OnMainThread" + F.pp_print_string fmt "OnMainThread" | LockHeld -> - F.fprintf fmt "LockHeld" + F.pp_print_string fmt "LockHeld" end module Attribute = struct @@ -269,7 +269,7 @@ module Attribute = struct let pp fmt = function | Functional -> - F.fprintf fmt "Functional" + F.pp_print_string fmt "Functional" | Choice choice -> Choice.pp fmt choice end @@ -317,13 +317,13 @@ module OwnershipAbstractValue = struct let pp fmt = function | Unowned -> - F.fprintf fmt "Unowned" + F.pp_print_string fmt "Unowned" | OwnedIf s -> F.fprintf fmt "OwnedIf%a" (PrettyPrintable.pp_collection ~pp_item:Int.pp) (IntSet.elements s) | Owned -> - F.fprintf fmt "Owned" + F.pp_print_string fmt "Owned" end module OwnershipDomain = struct @@ -400,7 +400,7 @@ module AccessSnapshot = struct (PrettyPrintable.pp_collection ~pp_item:Int.pp) (IntSet.elements indexes) | False -> - F.fprintf fmt "False" + F.pp_print_string fmt "False" end type t = diff --git a/infer/src/eradicate/typeCheck.ml b/infer/src/eradicate/typeCheck.ml index f2f72e96a..882cc74c1 100644 --- a/infer/src/eradicate/typeCheck.ml +++ b/infer/src/eradicate/typeCheck.ml @@ -14,10 +14,9 @@ module DExp = DecompiledExp (** Module for type checking. *) +(** remove temp ids from typestates *) let remove_temps = true -(* remove temp ids from typestates *) - (** Module to treat selected complex expressions as constants. *) module ComplexExpressions = struct (** What complex expressions are considered constant, each case includes the previous ones. @@ -100,7 +99,7 @@ module ComplexExpressions = struct | DExp.Dfcall (fun_dexp, args, _, {CallFlags.cf_virtual= isvirtual}) | DExp.Dretcall (fun_dexp, args, _, {CallFlags.cf_virtual= isvirtual}) when functions_idempotent () -> - let pp_arg fmt de = F.fprintf fmt "%s" (dexp_to_string de) in + let pp_arg fmt de = F.pp_print_string fmt (dexp_to_string de) in let pp_args fmt des = Pp.comma_seq pp_arg fmt des in let pp fmt = let virt = if isvirtual then "V" else "" in @@ -114,7 +113,7 @@ module ComplexExpressions = struct | DExp.Dpvar _ | DExp.Dpvaraddr _ (* front-end variable -- this should not happen) *) -> case_not_handled () | DExp.Dunop (op, de) -> - Unop.str op ^ dexp_to_string de + Unop.to_string op ^ dexp_to_string de | DExp.Dsizeof _ -> case_not_handled () | DExp.Dunknown -> diff --git a/infer/src/eradicate/typeState.ml b/infer/src/eradicate/typeState.ml index 34bfc952f..c371b6dce 100644 --- a/infer/src/eradicate/typeState.ml +++ b/infer/src/eradicate/typeState.ml @@ -53,7 +53,7 @@ let equal t1 t2 = Int.equal (compare t1 t2) 0 let empty ext = {map= M.empty; extension= ext.empty} let pp ext fmt typestate = - let pp_loc fmt loc = F.fprintf fmt "%d" loc.Location.line in + let pp_loc fmt loc = F.pp_print_int fmt loc.Location.line in let pp_locs fmt locs = F.fprintf fmt " [%a]" (Pp.seq pp_loc) locs in let pp_one exp (typ, ta, locs) = F.fprintf fmt " %a -> [%s] %s %a%a@\n" Exp.pp exp diff --git a/infer/src/infer.ml b/infer/src/infer.ml index c52fa5b2b..0dd6f6349 100644 --- a/infer/src/infer.ml +++ b/infer/src/infer.ml @@ -125,7 +125,7 @@ let () = | Analyze -> let pp_cluster_opt fmt = function | None -> - F.fprintf fmt "(no cluster)" + F.pp_print_string fmt "(no cluster)" | Some cluster -> F.fprintf fmt "of cluster %s" (Filename.basename cluster) in diff --git a/infer/src/integration/Clang.ml b/infer/src/integration/Clang.ml index d79eacd37..35fd4c276 100644 --- a/infer/src/integration/Clang.ml +++ b/infer/src/integration/Clang.ml @@ -12,23 +12,11 @@ module L = Logging type compiler = Clang | Make [@@deriving compare] -let rec pp_list pp fmt = function - | [] -> - () - | [x] -> - pp fmt x - | x :: tl -> - F.fprintf fmt "%a@\n%a" pp x (pp_list pp) tl - - -let pp_env fmt env = pp_list (fun fmt s -> F.fprintf fmt "%s" s) fmt env - let pp_extended_env fmt (env: Unix.env) = let pp_pair fmt (var, value) = F.fprintf fmt "%s=%s" var value in - let pp_pair_list = pp_list pp_pair in match env with | `Replace values -> - pp_pair_list fmt values + F.fprintf fmt "@[%a@]" (Pp.seq ~print_env:Pp.text_break pp_pair) values | `Extend values -> let is_extended s = match String.lsplit2 s ~on:'=' with @@ -40,9 +28,13 @@ let pp_extended_env fmt (env: Unix.env) = let env_not_extended = Unix.environment () |> Array.to_list |> List.filter ~f:(Fn.non is_extended) in - F.fprintf fmt "%a@\n%a" pp_env env_not_extended pp_pair_list values + F.fprintf fmt "@[%a@ %a@]" + (Pp.seq ~print_env:Pp.text_break F.pp_print_string) + env_not_extended + (Pp.seq ~print_env:Pp.text_break pp_pair) + values | `Replace_raw values -> - pp_env fmt values + F.fprintf fmt "@[%a@]" (Pp.seq ~print_env:Pp.text_break F.pp_print_string) values let capture compiler ~prog ~args = diff --git a/infer/src/integration/Diff.ml b/infer/src/integration/Diff.ml index 872b1a3f0..e8e4675ed 100644 --- a/infer/src/integration/Diff.ml +++ b/infer/src/integration/Diff.ml @@ -14,7 +14,7 @@ type revision = Current | Previous let string_of_revision = function Current -> "current" | Previous -> "previous" -let pp_revision f r = F.fprintf f "%s" (string_of_revision r) +let pp_revision f r = F.pp_print_string f (string_of_revision r) let checkout revision = let script_opt = diff --git a/infer/src/istd/Pp.ml b/infer/src/istd/Pp.ml index 8137a2bc1..e5cb67344 100644 --- a/infer/src/istd/Pp.ml +++ b/infer/src/istd/Pp.ml @@ -105,7 +105,7 @@ let seq ?(print_env= text) ?sep:(sep_text = " ") ?(sep_html= sep_text) pp = | [] -> () | [x] -> - F.fprintf f "%a" pp x + pp f x | x :: l -> let sep = match print_env.kind with TEXT -> sep_text | HTML -> sep_html in if print_env.break_lines then F.fprintf f "%a%s@ %a" pp x sep aux l diff --git a/infer/src/java/JavaProfilerSamples.ml b/infer/src/java/JavaProfilerSamples.ml index 62c9aeb05..48974e80f 100644 --- a/infer/src/java/JavaProfilerSamples.ml +++ b/infer/src/java/JavaProfilerSamples.ml @@ -43,23 +43,23 @@ module JNI = struct let rec pp fmt jni = match jni with | Boolean -> - Format.fprintf fmt "Z" + Format.pp_print_char fmt 'Z' | Byte -> - Format.fprintf fmt "B" + Format.pp_print_char fmt 'B' | Char -> - Format.fprintf fmt "C" + Format.pp_print_char fmt 'C' | Short -> - Format.fprintf fmt "S" + Format.pp_print_char fmt 'S' | Int -> - Format.fprintf fmt "I" + Format.pp_print_char fmt 'I' | Long -> - Format.fprintf fmt "J" + Format.pp_print_char fmt 'J' | Float -> - Format.fprintf fmt "F" + Format.pp_print_char fmt 'F' | Double -> - Format.fprintf fmt "D" + Format.pp_print_char fmt 'D' | Void -> - Format.fprintf fmt "V" + Format.pp_print_char fmt 'V' | FullyQualifiedClass (pkg, cl) -> let pkg' = String.tr ~target:'.' ~replacement:'/' pkg in Format.fprintf fmt "L%s/%s;" pkg' cl diff --git a/infer/src/quandary/ClangTrace.ml b/infer/src/quandary/ClangTrace.ml index 0d7a51bcb..1b22fdd12 100644 --- a/infer/src/quandary/ClangTrace.ml +++ b/infer/src/quandary/ClangTrace.ml @@ -184,13 +184,13 @@ module SourceKind = struct | Endpoint (formal_name, _) -> F.fprintf fmt "Endpoint(%s)" (Mangled.to_string formal_name) | EnvironmentVariable -> - F.fprintf fmt "EnvironmentVariable" + F.pp_print_string fmt "EnvironmentVariable" | ReadFile -> - F.fprintf fmt "File" + F.pp_print_string fmt "File" | CommandLineFlag (var, _) -> F.fprintf fmt "CommandLineFlag(%a)" Var.pp var | Other -> - F.fprintf fmt "Other" + F.pp_print_string fmt "Other" | UserControlledEndpoint (formal_name, _) -> F.fprintf fmt "UserControlledEndpoint(%s)" (Mangled.to_string formal_name) end @@ -364,7 +364,7 @@ module SinkKind = struct let pp fmt kind = - F.fprintf fmt + F.pp_print_string fmt ( match kind with | BufferAccess -> "BufferAccess" @@ -429,13 +429,13 @@ module CppSanitizer = struct let pp fmt = function | EscapeShell -> - F.fprintf fmt "EscapeShell" + F.pp_print_string fmt "EscapeShell" | EscapeSQL -> - F.fprintf fmt "EscapeSQL" + F.pp_print_string fmt "EscapeSQL" | EscapeURL -> - F.fprintf fmt "EscapeURL" + F.pp_print_string fmt "EscapeURL" | All -> - F.fprintf fmt "All" + F.pp_print_string fmt "All" end include Trace.Make (struct diff --git a/infer/src/quandary/JavaTrace.ml b/infer/src/quandary/JavaTrace.ml index a1b40819d..d356b9846 100644 --- a/infer/src/quandary/JavaTrace.ml +++ b/infer/src/quandary/JavaTrace.ml @@ -239,24 +239,23 @@ module SourceKind = struct let pp fmt kind = - F.fprintf fmt "%s" - ( match kind with - | DrawableResource pvar -> - Pvar.to_string pvar - | Endpoint (formal_name, _) -> - F.asprintf "Endpoint(%s)" (Mangled.to_string formal_name) - | Intent -> - "Intent" - | IntentFromURI -> - "IntentFromURI" - | Other -> - "Other" - | PrivateData -> - "PrivateData" - | UserControlledString -> - "UserControlledString" - | UserControlledURI -> - "UserControlledURI" ) + match kind with + | DrawableResource pvar -> + F.pp_print_string fmt (Pvar.to_string pvar) + | Endpoint (formal_name, _) -> + F.fprintf fmt "Endpoint(%s)" (Mangled.to_string formal_name) + | Intent -> + F.pp_print_string fmt "Intent" + | IntentFromURI -> + F.pp_print_string fmt "IntentFromURI" + | Other -> + F.pp_print_string fmt "Other" + | PrivateData -> + F.pp_print_string fmt "PrivateData" + | UserControlledString -> + F.pp_print_string fmt "UserControlledString" + | UserControlledURI -> + F.pp_print_string fmt "UserControlledURI" end module JavaSource = Source.Make (SourceKind) @@ -495,7 +494,7 @@ module JavaSanitizer = struct None - let pp fmt = function All -> F.fprintf fmt "All" + let pp fmt = function All -> F.pp_print_string fmt "All" end include Trace.Make (struct diff --git a/infer/src/unit/DifferentialFiltersTests.ml b/infer/src/unit/DifferentialFiltersTests.ml index 596a873bf..5cc3aa926 100644 --- a/infer/src/unit/DifferentialFiltersTests.ml +++ b/infer/src/unit/DifferentialFiltersTests.ml @@ -72,7 +72,7 @@ let test_file_renamings_find_previous = let pp_diff fmt (expected, actual) = let pp_str_opt fmt str_opt = let out = match str_opt with Some str -> "Some " ^ str | None -> "None" in - Format.fprintf fmt "%s" out + Format.pp_print_string fmt out in Format.fprintf fmt "Expected '%a' but got '%a'" pp_str_opt expected pp_str_opt actual in diff --git a/infer/src/unit/TaintTests.ml b/infer/src/unit/TaintTests.ml index 12e51f89a..a86687258 100644 --- a/infer/src/unit/TaintTests.ml +++ b/infer/src/unit/TaintTests.ml @@ -70,18 +70,16 @@ let tests = let open AnalyzerTester.StructuredSil in (* less verbose form of pretty-printing to make writing tests easy *) let pp_sparse fmt astate = - let pp_call_site fmt call_site = - F.fprintf fmt "%a" Typ.Procname.pp (CallSite.pname call_site) - in + let pp_call_site fmt call_site = Typ.Procname.pp fmt (CallSite.pname call_site) in let pp_sources fmt sources = - if MockTrace.Sources.is_empty sources then F.fprintf fmt "?" + if MockTrace.Sources.is_empty sources then F.pp_print_char fmt '?' else MockTrace.Sources.Known.iter (fun source -> pp_call_site fmt (MockTrace.Source.call_site source)) sources.MockTrace.Sources.known in let pp_sinks fmt sinks = - if MockTrace.Sinks.is_empty sinks then F.fprintf fmt "?" + if MockTrace.Sinks.is_empty sinks then F.pp_print_char fmt '?' else MockTrace.Sinks.iter (fun sink -> pp_call_site fmt (MockTrace.Sink.call_site sink)) sinks in diff --git a/infer/src/unit/TraceTests.ml b/infer/src/unit/TraceTests.ml index e412bbe96..96053a99c 100644 --- a/infer/src/unit/TraceTests.ml +++ b/infer/src/unit/TraceTests.ml @@ -21,7 +21,12 @@ module MockTraceElem = struct let make ?indexes:_ kind _ = kind - let pp fmt = function Kind1 -> F.fprintf fmt "Kind1" | Kind2 -> F.fprintf fmt "Kind2" + let pp fmt = function + | Kind1 -> + F.pp_print_string fmt "Kind1" + | Kind2 -> + F.pp_print_string fmt "Kind2" + module Kind = struct type nonrec t = t diff --git a/infer/src/unit/abstractInterpreterTests.ml b/infer/src/unit/abstractInterpreterTests.ml index 244a7755c..3263826af 100644 --- a/infer/src/unit/abstractInterpreterTests.ml +++ b/infer/src/unit/abstractInterpreterTests.ml @@ -44,7 +44,7 @@ module PathCountDomain = struct let widen ~prev:_ ~next:_ ~num_iters:_ = Top - let pp fmt = function PathCount c -> F.fprintf fmt "%d" c | Top -> F.fprintf fmt "T" + let pp fmt = function PathCount c -> F.pp_print_int fmt c | Top -> F.pp_print_char fmt 'T' end module PathCountTransferFunctions (CFG : ProcCfg.S) = struct diff --git a/infer/src/unit/accessTreeTests.ml b/infer/src/unit/accessTreeTests.ml index 0c918adef..06bec42f8 100644 --- a/infer/src/unit/accessTreeTests.ml +++ b/infer/src/unit/accessTreeTests.ml @@ -30,7 +30,7 @@ module MockTraceDomain = struct (* similarly, hack printing so top looks different *) - let pp fmt s = if phys_equal s top then F.fprintf fmt "T" else pp fmt s + let pp fmt s = if phys_equal s top then F.pp_print_char fmt 'T' else pp fmt s end module MakeTree (Config : AccessTree.Config) = struct diff --git a/infer/src/unit/analyzerTester.ml b/infer/src/unit/analyzerTester.ml index b2b710e7b..8eb20f0e5 100644 --- a/infer/src/unit/analyzerTester.ml +++ b/infer/src/unit/analyzerTester.ml @@ -45,9 +45,7 @@ module StructuredSil = struct and pp_structured_instr_list fmt instrs = - F.pp_print_list ~pp_sep:F.pp_print_newline - (fun fmt instr -> F.fprintf fmt "%a" pp_structured_instr instr) - fmt instrs + F.pp_print_list ~pp_sep:F.pp_print_newline pp_structured_instr fmt instrs let pp_structured_program = pp_structured_instr_list @@ -267,9 +265,7 @@ struct () (* no mismatches, test passed *) | error_msgs -> let mismatches_str = - F.pp_print_list - (fun fmt error_msg -> F.fprintf fmt "%s" error_msg) - F.str_formatter (List.rev error_msgs) + F.pp_print_list F.pp_print_string F.str_formatter (List.rev error_msgs) |> F.flush_str_formatter in let assert_fail_message = diff --git a/infer/src/unit/schedulerTests.ml b/infer/src/unit/schedulerTests.ml index ccf628565..035deed72 100644 --- a/infer/src/unit/schedulerTests.ml +++ b/infer/src/unit/schedulerTests.ml @@ -34,7 +34,7 @@ module MockNode = struct let compare_id = Int.compare - let pp_id fmt i = F.fprintf fmt "%i" i + let pp_id fmt i = F.pp_print_int fmt i module OrderedId = struct type t = id @@ -111,9 +111,7 @@ let create_test test_graph expected_result _ = List.rev visited_acc in let pp_diff fmt (exp, actual) = - let pp_sched fmt l = - F.pp_print_list ~pp_sep:F.pp_print_space (fun fmt i -> F.fprintf fmt "%d" i) fmt l - in + let pp_sched fmt l = F.pp_print_list ~pp_sep:F.pp_print_space F.pp_print_int fmt l in F.fprintf fmt "Expected schedule %a but got schedule %a" pp_sched exp pp_sched actual in let cfg = MockProcCfg.from_adjacency_list test_graph in diff --git a/infer/tests/codetoanalyze/c/frontend/arithmetic/compound_assignment.c.dot b/infer/tests/codetoanalyze/c/frontend/arithmetic/compound_assignment.c.dot index cfd1f96e1..8712a3864 100644 --- a/infer/tests/codetoanalyze/c/frontend/arithmetic/compound_assignment.c.dot +++ b/infer/tests/codetoanalyze/c/frontend/arithmetic/compound_assignment.c.dot @@ -39,23 +39,23 @@ digraph cfg { "main.fad58de7366495db4650cfefac2fcd61_10" -> "main.fad58de7366495db4650cfefac2fcd61_9" ; -"main.fad58de7366495db4650cfefac2fcd61_11" [label="11: BinaryOperatorStmt: MulAssign \n n$6=*&x:double [line 15, column 3]\n *&x:double=(n$6 * 1.000000) [line 15, column 3]\n " shape="box"] +"main.fad58de7366495db4650cfefac2fcd61_11" [label="11: BinaryOperatorStmt: MulAssign \n n$6=*&x:double [line 15, column 3]\n *&x:double=(n$6 * 1.) [line 15, column 3]\n " shape="box"] "main.fad58de7366495db4650cfefac2fcd61_11" -> "main.fad58de7366495db4650cfefac2fcd61_10" ; -"main.fad58de7366495db4650cfefac2fcd61_12" [label="12: BinaryOperatorStmt: DivAssign \n n$7=*&x:double [line 14, column 3]\n *&x:double=(n$7 / 1.000000) [line 14, column 3]\n " shape="box"] +"main.fad58de7366495db4650cfefac2fcd61_12" [label="12: BinaryOperatorStmt: DivAssign \n n$7=*&x:double [line 14, column 3]\n *&x:double=(n$7 / 1.) [line 14, column 3]\n " shape="box"] "main.fad58de7366495db4650cfefac2fcd61_12" -> "main.fad58de7366495db4650cfefac2fcd61_11" ; -"main.fad58de7366495db4650cfefac2fcd61_13" [label="13: BinaryOperatorStmt: SubAssign \n n$8=*&x:double [line 13, column 3]\n *&x:double=(n$8 - 1.000000) [line 13, column 3]\n " shape="box"] +"main.fad58de7366495db4650cfefac2fcd61_13" [label="13: BinaryOperatorStmt: SubAssign \n n$8=*&x:double [line 13, column 3]\n *&x:double=(n$8 - 1.) [line 13, column 3]\n " shape="box"] "main.fad58de7366495db4650cfefac2fcd61_13" -> "main.fad58de7366495db4650cfefac2fcd61_12" ; -"main.fad58de7366495db4650cfefac2fcd61_14" [label="14: BinaryOperatorStmt: AddAssign \n n$9=*&x:double [line 12, column 3]\n *&x:double=(n$9 + 1.000000) [line 12, column 3]\n " shape="box"] +"main.fad58de7366495db4650cfefac2fcd61_14" [label="14: BinaryOperatorStmt: AddAssign \n n$9=*&x:double [line 12, column 3]\n *&x:double=(n$9 + 1.) [line 12, column 3]\n " shape="box"] "main.fad58de7366495db4650cfefac2fcd61_14" -> "main.fad58de7366495db4650cfefac2fcd61_13" ; -"main.fad58de7366495db4650cfefac2fcd61_15" [label="15: DeclStmt \n *&x:double=1.000000 [line 11, column 3]\n " shape="box"] +"main.fad58de7366495db4650cfefac2fcd61_15" [label="15: DeclStmt \n *&x:double=1. [line 11, column 3]\n " shape="box"] "main.fad58de7366495db4650cfefac2fcd61_15" -> "main.fad58de7366495db4650cfefac2fcd61_14" ; diff --git a/infer/tests/codetoanalyze/c/frontend/initialization/struct_initlistexpr.c.dot b/infer/tests/codetoanalyze/c/frontend/initialization/struct_initlistexpr.c.dot index 287534146..d96e56a32 100644 --- a/infer/tests/codetoanalyze/c/frontend/initialization/struct_initlistexpr.c.dot +++ b/infer/tests/codetoanalyze/c/frontend/initialization/struct_initlistexpr.c.dot @@ -11,7 +11,7 @@ digraph cfg { "field_set_correctly.b8d9a4294a85d24818c312a099420dce_3" -> "field_set_correctly.b8d9a4294a85d24818c312a099420dce_2" ; -"field_set_correctly.b8d9a4294a85d24818c312a099420dce_4" [label="4: DeclStmt \n *&e.ssn:int=12 [line 35, column 23]\n *&e.salary:float=3000.500000 [line 35, column 23]\n *&e.doj.date:int=12 [line 35, column 37]\n *&e.doj.month:int=12 [line 35, column 37]\n *&e.doj.year:int=2010 [line 35, column 37]\n " shape="box"] +"field_set_correctly.b8d9a4294a85d24818c312a099420dce_4" [label="4: DeclStmt \n *&e.ssn:int=12 [line 35, column 23]\n *&e.salary:float=3000.5 [line 35, column 23]\n *&e.doj.date:int=12 [line 35, column 37]\n *&e.doj.month:int=12 [line 35, column 37]\n *&e.doj.year:int=2010 [line 35, column 37]\n " shape="box"] "field_set_correctly.b8d9a4294a85d24818c312a099420dce_4" -> "field_set_correctly.b8d9a4294a85d24818c312a099420dce_3" ; diff --git a/infer/tests/codetoanalyze/c/frontend/nestedoperators/nestedassignment.c.dot b/infer/tests/codetoanalyze/c/frontend/nestedoperators/nestedassignment.c.dot index 6df86dc13..be144e375 100644 --- a/infer/tests/codetoanalyze/c/frontend/nestedoperators/nestedassignment.c.dot +++ b/infer/tests/codetoanalyze/c/frontend/nestedoperators/nestedassignment.c.dot @@ -15,7 +15,7 @@ digraph cfg { "main.fad58de7366495db4650cfefac2fcd61_4" -> "main.fad58de7366495db4650cfefac2fcd61_3" ; -"main.fad58de7366495db4650cfefac2fcd61_5" [label="5: BinaryOperatorStmt: Assign \n n$7=*&x:double [line 16, column 8]\n *&x:double=(n$7 + 1.000000) [line 16, column 8]\n n$8=*&x:double [line 16, column 8]\n *&q:double=n$8 [line 16, column 3]\n " shape="box"] +"main.fad58de7366495db4650cfefac2fcd61_5" [label="5: BinaryOperatorStmt: Assign \n n$7=*&x:double [line 16, column 8]\n *&x:double=(n$7 + 1.) [line 16, column 8]\n n$8=*&x:double [line 16, column 8]\n *&q:double=n$8 [line 16, column 3]\n " shape="box"] "main.fad58de7366495db4650cfefac2fcd61_5" -> "main.fad58de7366495db4650cfefac2fcd61_4" ; @@ -31,7 +31,7 @@ digraph cfg { "main.fad58de7366495db4650cfefac2fcd61_8" -> "main.fad58de7366495db4650cfefac2fcd61_7" ; -"main.fad58de7366495db4650cfefac2fcd61_9" [label="9: DeclStmt \n *&x:double=1.000000 [line 11, column 3]\n " shape="box"] +"main.fad58de7366495db4650cfefac2fcd61_9" [label="9: DeclStmt \n *&x:double=1. [line 11, column 3]\n " shape="box"] "main.fad58de7366495db4650cfefac2fcd61_9" -> "main.fad58de7366495db4650cfefac2fcd61_8" ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/initialization/init_list.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/initialization/init_list.cpp.dot index 64e79ff6a..459ef1625 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/initialization/init_list.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/initialization/init_list.cpp.dot @@ -57,7 +57,7 @@ digraph cfg { "zero_init_primitive#init_list#3465759276925732066.1d03db1e38d38f4b345f33049176e92c_2" [label="2: Exit init_list::zero_init_primitive \n " color=yellow style=filled] -"zero_init_primitive#init_list#3465759276925732066.1d03db1e38d38f4b345f33049176e92c_3" [label="3: DeclStmt \n *&f:float=0.000000 [line 30, column 3]\n " shape="box"] +"zero_init_primitive#init_list#3465759276925732066.1d03db1e38d38f4b345f33049176e92c_3" [label="3: DeclStmt \n *&f:float=0. [line 30, column 3]\n " shape="box"] "zero_init_primitive#init_list#3465759276925732066.1d03db1e38d38f4b345f33049176e92c_3" -> "zero_init_primitive#init_list#3465759276925732066.1d03db1e38d38f4b345f33049176e92c_2" ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/literals/scalar_value_init.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/literals/scalar_value_init.cpp.dot index ee7769b39..b1411781c 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/literals/scalar_value_init.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/literals/scalar_value_init.cpp.dot @@ -18,7 +18,7 @@ digraph cfg { "get#13747618516057362976.2fec1fe1de6ac1c3fae6ec84a1ffd2b5_2" [label="2: Exit get \n " color=yellow style=filled] -"get#13747618516057362976.2fec1fe1de6ac1c3fae6ec84a1ffd2b5_3" [label="3: Return Stmt \n *&return:float=0.000000 [line 14, column 3]\n " shape="box"] +"get#13747618516057362976.2fec1fe1de6ac1c3fae6ec84a1ffd2b5_3" [label="3: Return Stmt \n *&return:float=0. [line 14, column 3]\n " shape="box"] "get#13747618516057362976.2fec1fe1de6ac1c3fae6ec84a1ffd2b5_3" -> "get#13747618516057362976.2fec1fe1de6ac1c3fae6ec84a1ffd2b5_2" ; @@ -62,7 +62,7 @@ digraph cfg { "test#18241244337164948030.afc14f193ad97442f67ac7183be789bc_2" [label="2: Exit test \n " color=yellow style=filled] -"test#18241244337164948030.afc14f193ad97442f67ac7183be789bc_3" [label="3: DeclStmt \n *&f2:float=0.000000 [line 23, column 3]\n " shape="box"] +"test#18241244337164948030.afc14f193ad97442f67ac7183be789bc_3" [label="3: DeclStmt \n *&f2:float=0. [line 23, column 3]\n " shape="box"] "test#18241244337164948030.afc14f193ad97442f67ac7183be789bc_3" -> "test#18241244337164948030.afc14f193ad97442f67ac7183be789bc_2" ; diff --git a/infer/tests/codetoanalyze/cpp/shared/constructors/constructor_new.cpp.dot b/infer/tests/codetoanalyze/cpp/shared/constructors/constructor_new.cpp.dot index 244871a63..e6f1b9ebb 100644 --- a/infer/tests/codetoanalyze/cpp/shared/constructors/constructor_new.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/shared/constructors/constructor_new.cpp.dot @@ -128,11 +128,11 @@ digraph cfg { "float_init_number#constructor_new#3988440966025503299.b1d13528d0a983c1943c8fdd13e58be6_2" [label="2: Exit constructor_new::float_init_number \n " color=yellow style=filled] -"float_init_number#constructor_new#3988440966025503299.b1d13528d0a983c1943c8fdd13e58be6_3" [label="3: Return Stmt \n n$0=*&x1:float* [line 46, column 16]\n n$1=*n$0:float [line 46, column 15]\n *&return:float=(1 / (n$1 - 5.400000)) [line 46, column 3]\n " shape="box"] +"float_init_number#constructor_new#3988440966025503299.b1d13528d0a983c1943c8fdd13e58be6_3" [label="3: Return Stmt \n n$0=*&x1:float* [line 46, column 16]\n n$1=*n$0:float [line 46, column 15]\n *&return:float=(1 / (n$1 - 5.4)) [line 46, column 3]\n " shape="box"] "float_init_number#constructor_new#3988440966025503299.b1d13528d0a983c1943c8fdd13e58be6_3" -> "float_init_number#constructor_new#3988440966025503299.b1d13528d0a983c1943c8fdd13e58be6_2" ; -"float_init_number#constructor_new#3988440966025503299.b1d13528d0a983c1943c8fdd13e58be6_4" [label="4: DeclStmt \n n$2=_fun___new(sizeof(t=float):unsigned long) [line 45, column 15]\n *n$2:float=5.400000 [line 45, column 15]\n *&x1:float*=n$2 [line 45, column 3]\n " shape="box"] +"float_init_number#constructor_new#3988440966025503299.b1d13528d0a983c1943c8fdd13e58be6_4" [label="4: DeclStmt \n n$2=_fun___new(sizeof(t=float):unsigned long) [line 45, column 15]\n *n$2:float=5.4 [line 45, column 15]\n *&x1:float*=n$2 [line 45, column 3]\n " shape="box"] "float_init_number#constructor_new#3988440966025503299.b1d13528d0a983c1943c8fdd13e58be6_4" -> "float_init_number#constructor_new#3988440966025503299.b1d13528d0a983c1943c8fdd13e58be6_3" ; diff --git a/infer/tests/codetoanalyze/cpp/shared/namespace/namespace.cpp.dot b/infer/tests/codetoanalyze/cpp/shared/namespace/namespace.cpp.dot index ecc2c3a9d..44fc351f4 100644 --- a/infer/tests/codetoanalyze/cpp/shared/namespace/namespace.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/shared/namespace/namespace.cpp.dot @@ -54,7 +54,7 @@ digraph cfg { "pi#__infer_globals_initializer_bar.1155d696836634e07d40a8f71831e209_2" [label="2: Exit __infer_globals_initializer_bar::pi \n " color=yellow style=filled] -"pi#__infer_globals_initializer_bar.1155d696836634e07d40a8f71831e209_3" [label="3: DeclStmt \n *&#GB$bar::pi:double=3.141600 [line 29, column 1]\n " shape="box"] +"pi#__infer_globals_initializer_bar.1155d696836634e07d40a8f71831e209_3" [label="3: DeclStmt \n *&#GB$bar::pi:double=3.1416 [line 29, column 1]\n " shape="box"] "pi#__infer_globals_initializer_bar.1155d696836634e07d40a8f71831e209_3" -> "pi#__infer_globals_initializer_bar.1155d696836634e07d40a8f71831e209_2" ; diff --git a/infer/tests/codetoanalyze/cpp/shared/types/casts.cpp.dot b/infer/tests/codetoanalyze/cpp/shared/types/casts.cpp.dot index 34ae48f8f..e7015f77e 100644 --- a/infer/tests/codetoanalyze/cpp/shared/types/casts.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/shared/types/casts.cpp.dot @@ -7,7 +7,7 @@ digraph cfg { "functional_cast#14011367992313068291.82cd85208f04494c7a6533d123f52fe0_2" [label="2: Exit functional_cast \n " color=yellow style=filled] -"functional_cast#14011367992313068291.82cd85208f04494c7a6533d123f52fe0_3" [label="3: DeclStmt \n *&a:int=(2 + 3.400000) [line 15, column 26]\n " shape="box"] +"functional_cast#14011367992313068291.82cd85208f04494c7a6533d123f52fe0_3" [label="3: DeclStmt \n *&a:int=(2 + 3.4) [line 15, column 26]\n " shape="box"] "functional_cast#14011367992313068291.82cd85208f04494c7a6533d123f52fe0_3" -> "functional_cast#14011367992313068291.82cd85208f04494c7a6533d123f52fe0_2" ; diff --git a/infer/tests/codetoanalyze/objc/frontend/boxing/Boxing.m.dot b/infer/tests/codetoanalyze/objc/frontend/boxing/Boxing.m.dot index 8dbc7de2a..adbe4bdbc 100644 --- a/infer/tests/codetoanalyze/objc/frontend/boxing/Boxing.m.dot +++ b/infer/tests/codetoanalyze/objc/frontend/boxing/Boxing.m.dot @@ -22,11 +22,11 @@ digraph cfg { "getDouble#Boxing#instance.d2ccf367cc9eb4c0b5e345694f262070_2" [label="2: Exit Boxing_getDouble \n " color=yellow style=filled] -"getDouble#Boxing#instance.d2ccf367cc9eb4c0b5e345694f262070_3" [label="3: Return Stmt \n n$10=_fun_NSNumber_numberWithDouble:(1.500000:double) [line 33, column 10]\n *&return:NSNumber*=n$10 [line 33, column 3]\n " shape="box"] +"getDouble#Boxing#instance.d2ccf367cc9eb4c0b5e345694f262070_3" [label="3: Return Stmt \n n$10=_fun_NSNumber_numberWithDouble:(1.5:double) [line 33, column 10]\n *&return:NSNumber*=n$10 [line 33, column 3]\n " shape="box"] "getDouble#Boxing#instance.d2ccf367cc9eb4c0b5e345694f262070_3" -> "getDouble#Boxing#instance.d2ccf367cc9eb4c0b5e345694f262070_2" ; -"getDouble#Boxing#instance.d2ccf367cc9eb4c0b5e345694f262070_4" [label="4: DeclStmt \n n$11=_fun_NSNumber_numberWithDouble:(1.500000:double) [line 32, column 17]\n *&n:NSNumber*=n$11 [line 32, column 3]\n " shape="box"] +"getDouble#Boxing#instance.d2ccf367cc9eb4c0b5e345694f262070_4" [label="4: DeclStmt \n n$11=_fun_NSNumber_numberWithDouble:(1.5:double) [line 32, column 17]\n *&n:NSNumber*=n$11 [line 32, column 3]\n " shape="box"] "getDouble#Boxing#instance.d2ccf367cc9eb4c0b5e345694f262070_4" -> "getDouble#Boxing#instance.d2ccf367cc9eb4c0b5e345694f262070_3" ; @@ -37,11 +37,11 @@ digraph cfg { "getFloat#Boxing#instance.3de027274316c0cdfd230c6dbd0333a0_2" [label="2: Exit Boxing_getFloat \n " color=yellow style=filled] -"getFloat#Boxing#instance.3de027274316c0cdfd230c6dbd0333a0_3" [label="3: Return Stmt \n n$8=_fun_NSNumber_numberWithFloat:(1.500000:float) [line 28, column 10]\n *&return:NSNumber*=n$8 [line 28, column 3]\n " shape="box"] +"getFloat#Boxing#instance.3de027274316c0cdfd230c6dbd0333a0_3" [label="3: Return Stmt \n n$8=_fun_NSNumber_numberWithFloat:(1.5:float) [line 28, column 10]\n *&return:NSNumber*=n$8 [line 28, column 3]\n " shape="box"] "getFloat#Boxing#instance.3de027274316c0cdfd230c6dbd0333a0_3" -> "getFloat#Boxing#instance.3de027274316c0cdfd230c6dbd0333a0_2" ; -"getFloat#Boxing#instance.3de027274316c0cdfd230c6dbd0333a0_4" [label="4: DeclStmt \n n$9=_fun_NSNumber_numberWithFloat:(1.500000:float) [line 27, column 17]\n *&n:NSNumber*=n$9 [line 27, column 3]\n " shape="box"] +"getFloat#Boxing#instance.3de027274316c0cdfd230c6dbd0333a0_4" [label="4: DeclStmt \n n$9=_fun_NSNumber_numberWithFloat:(1.5:float) [line 27, column 17]\n *&n:NSNumber*=n$9 [line 27, column 3]\n " shape="box"] "getFloat#Boxing#instance.3de027274316c0cdfd230c6dbd0333a0_4" -> "getFloat#Boxing#instance.3de027274316c0cdfd230c6dbd0333a0_3" ; diff --git a/infer/tests/codetoanalyze/objc/frontend/vardecl/initlist.m.dot b/infer/tests/codetoanalyze/objc/frontend/vardecl/initlist.m.dot index 102b6ce73..2d33a80de 100644 --- a/infer/tests/codetoanalyze/objc/frontend/vardecl/initlist.m.dot +++ b/infer/tests/codetoanalyze/objc/frontend/vardecl/initlist.m.dot @@ -18,7 +18,7 @@ digraph cfg { "struct_init_test.b3909a459f16e15611cc425c52c74b0c_2" [label="2: Exit struct_init_test \n " color=yellow style=filled] -"struct_init_test.b3909a459f16e15611cc425c52c74b0c_3" [label="3: Return Stmt \n n$0=*&__return_param:CGAffineTransform* [line 29, column 3]\n *n$0.a:double=-1 [line 29, column 29]\n *n$0.b:double=0 [line 29, column 29]\n *n$0.c:double=-0 [line 29, column 29]\n *n$0.d:double=-1 [line 29, column 29]\n *n$0.tx:double=0.000000 [line 29, column 62]\n *n$0.ty:double=0.000000 [line 29, column 62]\n n$1=*n$0:CGAffineTransform [line 29, column 10]\n " shape="box"] +"struct_init_test.b3909a459f16e15611cc425c52c74b0c_3" [label="3: Return Stmt \n n$0=*&__return_param:CGAffineTransform* [line 29, column 3]\n *n$0.a:double=-1 [line 29, column 29]\n *n$0.b:double=0 [line 29, column 29]\n *n$0.c:double=-0 [line 29, column 29]\n *n$0.d:double=-1 [line 29, column 29]\n *n$0.tx:double=0. [line 29, column 62]\n *n$0.ty:double=0. [line 29, column 62]\n n$1=*n$0:CGAffineTransform [line 29, column 10]\n " shape="box"] "struct_init_test.b3909a459f16e15611cc425c52c74b0c_3" -> "struct_init_test.b3909a459f16e15611cc425c52c74b0c_2" ; diff --git a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m.dot b/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m.dot index aaacd6efc..264c5e842 100644 --- a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m.dot @@ -106,7 +106,7 @@ digraph cfg { "createCloseCrossGlyphNoLeak:#MemoryLeakExample#class.0954bcd442044fd9788af38303a3790b_4" -> "createCloseCrossGlyphNoLeak:#MemoryLeakExample#class.0954bcd442044fd9788af38303a3790b_3" ; -"createCloseCrossGlyphNoLeak:#MemoryLeakExample#class.0954bcd442044fd9788af38303a3790b_5" [label="5: DeclStmt \n n$32=*&rect:CGRect [line 59, column 51]\n n$33=_fun_CGRectGetHeight(n$32:CGRect) [line 59, column 35]\n *&lineThickness:double=(0.200000 * n$33) [line 59, column 3]\n " shape="box"] +"createCloseCrossGlyphNoLeak:#MemoryLeakExample#class.0954bcd442044fd9788af38303a3790b_5" [label="5: DeclStmt \n n$32=*&rect:CGRect [line 59, column 51]\n n$33=_fun_CGRectGetHeight(n$32:CGRect) [line 59, column 35]\n *&lineThickness:double=(0.200000003 * n$33) [line 59, column 3]\n " shape="box"] "createCloseCrossGlyphNoLeak:#MemoryLeakExample#class.0954bcd442044fd9788af38303a3790b_5" -> "createCloseCrossGlyphNoLeak:#MemoryLeakExample#class.0954bcd442044fd9788af38303a3790b_4" ; @@ -256,7 +256,7 @@ digraph cfg { "testFBColorCreateWithGray#MemoryLeakExample#instance.4f74b525e11effa846f82d4205d48a4a_3" -> "testFBColorCreateWithGray#MemoryLeakExample#instance.4f74b525e11effa846f82d4205d48a4a_2" ; -"testFBColorCreateWithGray#MemoryLeakExample#instance.4f74b525e11effa846f82d4205d48a4a_4" [label="4: DeclStmt \n n$44=_fun_FBColorCreateWithGray(0.000000:double,0.300000:double) [line 83, column 28]\n *&borderColor:CGColor*=n$44 [line 83, column 3]\n " shape="box"] +"testFBColorCreateWithGray#MemoryLeakExample#instance.4f74b525e11effa846f82d4205d48a4a_4" [label="4: DeclStmt \n n$44=_fun_FBColorCreateWithGray(0.:double,0.3:double) [line 83, column 28]\n *&borderColor:CGColor*=n$44 [line 83, column 3]\n " shape="box"] "testFBColorCreateWithGray#MemoryLeakExample#instance.4f74b525e11effa846f82d4205d48a4a_4" -> "testFBColorCreateWithGray#MemoryLeakExample#instance.4f74b525e11effa846f82d4205d48a4a_3" ; diff --git a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/TollBridgeExample.m.dot b/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/TollBridgeExample.m.dot index f590e59e6..0c4fb6e98 100644 --- a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/TollBridgeExample.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/TollBridgeExample.m.dot @@ -22,7 +22,7 @@ digraph cfg { "cfautorelease_test.2ccea2233b65cd3828a2d5e2571ad69b_2" [label="2: Exit cfautorelease_test \n " color=yellow style=filled] -"cfautorelease_test.2ccea2233b65cd3828a2d5e2571ad69b_3" [label="3: Return Stmt \n n$0=_fun___builtin___CFStringMakeConstantString(\"Icon\":char const *) [line 41, column 45]\n n$1=_fun_CTFontCreateWithName(n$0:__CFString const *,17.000000:double,null:CGAffineTransform const *) [line 41, column 24]\n n$2=_fun_CFAutorelease(n$1:void const *) [line 41, column 10]\n *&return:__CTFont const *=n$2 [line 41, column 3]\n " shape="box"] +"cfautorelease_test.2ccea2233b65cd3828a2d5e2571ad69b_3" [label="3: Return Stmt \n n$0=_fun___builtin___CFStringMakeConstantString(\"Icon\":char const *) [line 41, column 45]\n n$1=_fun_CTFontCreateWithName(n$0:__CFString const *,17.:double,null:CGAffineTransform const *) [line 41, column 24]\n n$2=_fun_CFAutorelease(n$1:void const *) [line 41, column 10]\n *&return:__CTFont const *=n$2 [line 41, column 3]\n " shape="box"] "cfautorelease_test.2ccea2233b65cd3828a2d5e2571ad69b_3" -> "cfautorelease_test.2ccea2233b65cd3828a2d5e2571ad69b_2" ;