From c6904166224e582aff61891f4e05d630d889cdb4 Mon Sep 17 00:00:00 2001 From: Josh Berdine Date: Tue, 21 May 2019 08:32:27 -0700 Subject: [PATCH] [sledge][NFC] Simplify harness selection code Summary: Only refactor Reviewed By: jvillard Differential Revision: D15424821 fbshipit-source-id: 0e3ea58c3 --- sledge/src/control.ml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/sledge/src/control.ml b/sledge/src/control.ml index a5f13330a..64305b0b6 100644 --- a/sledge/src/control.ml +++ b/sledge/src/control.ml @@ -367,17 +367,14 @@ let harness : Llair.t -> Work.t option = List.find_map ["__llair_main"; "_Z12__llair_mainv"; "main"] ~f:(fun name -> Vector.find_map pgm.functions ~f:(fun func -> - let fname = Var.name func.name.var in - Option.some_if (String.equal name fname) (fname, func) ) ) + Option.some_if (String.equal name (Var.name func.name.var)) func + ) ) |> function - | Some (("__llair_main" | "_Z12__llair_mainv" | "main"), main) -> - let block = main.entry in - if List.is_empty block.params then - Some - (Work.init - (fst (Domain.call (Domain.init pgm.globals) [] [] block.locals)) - block) - else None + | Some {entry= {params= []} as block} -> + Some + (Work.init + (fst (Domain.call (Domain.init pgm.globals) [] [] block.locals)) + block) | _ -> None let exec_pgm : Llair.t -> unit =