From c6670a94ab654d819b94683b3c7a0627f1d939df Mon Sep 17 00:00:00 2001 From: Brian Campbell Date: Sat, 21 Nov 2020 21:29:44 +0000 Subject: Make coverage support look a little harder for location information --- src/jib/jib_compile.ml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/jib/jib_compile.ml b/src/jib/jib_compile.ml index 93071f69..8b886d14 100644 --- a/src/jib/jib_compile.ml +++ b/src/jib/jib_compile.ml @@ -226,11 +226,19 @@ let append_into_block instrs instr = | [] -> instr | _ -> iblock (instrs @ [instr]) -let coverage_branch_taken branch_id (AE_aux (_, _, l)) = +let rec find_aexp_loc (AE_aux (e, _, l)) = + match Reporting.simp_loc l with + | Some _ -> l + | None -> + match e with + | AE_cast (e',_) -> find_aexp_loc e' + | _ -> l + +let coverage_branch_taken branch_id aexp = match C.branch_coverage with | None -> [] | Some out -> begin - match coverage_loc_args l with + match coverage_loc_args (find_aexp_loc aexp) with | None -> [] | Some args -> Printf.fprintf out "%s\n" ("B " ^ args); -- cgit v1.2.3