From 13a02122ac523a2b96abc0646644771d543f5e32 Mon Sep 17 00:00:00 2001 From: Sam Blackshear Date: Fri, 20 Oct 2017 08:25:15 -0700 Subject: [PATCH] [traces] fix printing of sinks Summary: Sinks weren't being printed when passthroughs are empty (which, for now, is always). Oops! Reviewed By: jvillard Differential Revision: D6110164 fbshipit-source-id: 4488ab0 --- infer/src/checkers/Trace.ml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/infer/src/checkers/Trace.ml b/infer/src/checkers/Trace.ml index 94a9d1974..68b69ea4f 100644 --- a/infer/src/checkers/Trace.ml +++ b/infer/src/checkers/Trace.ml @@ -242,13 +242,15 @@ module Make (Spec : Spec) = struct Passthroughs.t * (path_source * Passthroughs.t) list * (path_sink * Passthroughs.t) list let pp fmt {sources; sinks; passthroughs} = + let pp_passthroughs fmt passthroughs = + if not (Passthroughs.is_empty passthroughs) then + 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 + in (* empty sources implies empty sinks and passthroughs *) - if not (Passthroughs.is_empty passthroughs) then - if not (Sinks.is_empty sinks) then - F.fprintf fmt "%a ~> %a via %a" Sources.pp sources Sinks.pp sinks Passthroughs.pp - passthroughs - else F.fprintf fmt "%a ~> ? via %a" Sources.pp sources Passthroughs.pp passthroughs - else F.fprintf fmt "%a ~> ?" Sources.pp sources + F.fprintf fmt "%a ~> %a%a" Sources.pp sources pp_sinks sinks pp_passthroughs passthroughs let get_path_source_call_site = function | Known source