From 4f362ba9771c603b683254ca8708393f36f1a9a0 Mon Sep 17 00:00:00 2001 From: Radu Grigore Date: Wed, 18 Dec 2019 07:10:27 -0800 Subject: [PATCH] [topl] Print debugging output on -g. Summary: Previously, one needed both --topl-trace and -g. Reviewed By: ngorogiannis Differential Revision: D19035493 fbshipit-source-id: 1abb49384 --- infer/src/topl/Topl.ml | 3 +-- infer/src/topl/ToplAutomaton.ml | 7 +++---- infer/src/topl/ToplUtils.ml | 5 +++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/infer/src/topl/Topl.ml b/infer/src/topl/Topl.ml index 7e57b7c36..5a8ff780a 100644 --- a/infer/src/topl/Topl.ml +++ b/infer/src/topl/Topl.ml @@ -51,8 +51,7 @@ let evaluate_static_guard label (e_fun, arg_ts) = let name = Typ.Procname.hashable_name n in let re = Str.regexp label.ToplAst.procedure_name in let result = Str.string_match re name 0 in - if Config.trace_topl then - tt "match name='%s' re='%s' result=%b@\n" name label.ToplAst.procedure_name result ; + tt "match name='%s' re='%s' result=%b@\n" name label.ToplAst.procedure_name result ; result | _ -> false diff --git a/infer/src/topl/ToplAutomaton.ml b/infer/src/topl/ToplAutomaton.ml index 536c60553..0fdad01f6 100644 --- a/infer/src/topl/ToplAutomaton.ml +++ b/infer/src/topl/ToplAutomaton.ml @@ -56,7 +56,7 @@ let make properties = in Array.of_list (List.dedup_and_sort ~compare:Vname.compare (List.concat_map ~f properties)) in - if Config.trace_topl then Array.iteri ~f:(fun i (p, v) -> tt "state[%d]=(%s,%s)@\n" i p v) states ; + Array.iteri ~f:(fun i (p, v) -> tt "state[%d]=(%s,%s)@\n" i p v) states ; let vindex = index_in (module Vname.Table) states in let transitions : transition array = let f p = @@ -77,9 +77,8 @@ let make properties = in Array.of_list (List.concat_map ~f properties) in - if Config.trace_topl then - Array.iteri transitions ~f:(fun i {source; target; label} -> - tt "transition%d %d -> %d on %s@\n" i source target label.ToplAst.procedure_name ) ; + Array.iteri transitions ~f:(fun i {source; target; label} -> + tt "transition%d %d -> %d on %s@\n" i source target label.ToplAst.procedure_name ) ; let outgoing : tindex list array = let vcount = Array.length states in let a = Array.create ~len:vcount [] in diff --git a/infer/src/topl/ToplUtils.ml b/infer/src/topl/ToplUtils.ml index 52b609bef..543ac482b 100644 --- a/infer/src/topl/ToplUtils.ml +++ b/infer/src/topl/ToplUtils.ml @@ -52,5 +52,6 @@ let is_synthesized = function let debug fmt = - Logging.debug Analysis Verbose "ToplTrace: " ; - Logging.debug Analysis Verbose fmt + let mode = if Config.trace_topl then Logging.Quiet else Logging.Verbose in + Logging.debug Analysis mode "ToplTrace: " ; + Logging.debug Analysis mode fmt