Skip to content

Commit 0d8443e

Browse files
committed
use ocamlformat 0.28.1
1 parent 119e226 commit 0d8443e

File tree

140 files changed

+1430
-1456
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+1430
-1456
lines changed

.ocamlformat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
profile = default
2-
version = 0.27.0
2+
version = 0.28.1

lib/arm/arm_target.ml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -639,12 +639,10 @@ module Encodings = struct
639639
let symbols_encoding spec =
640640
symbol_values spec
641641
|> Seq.fold ~init:empty ~f:(fun symbols (addr, value) ->
642-
let addr = Bitvec.M32.int64 addr in
643-
if is_thumb value then Map.set symbols ~key:addr ~data:llvm_t32
644-
else
645-
Map.update symbols addr ~f:(function
646-
| None -> llvm_a32
647-
| Some t -> t))
642+
let addr = Bitvec.M32.int64 addr in
643+
if is_thumb value then Map.set symbols ~key:addr ~data:llvm_t32
644+
else
645+
Map.update symbols addr ~f:(function None -> llvm_a32 | Some t -> t))
648646

649647
let slot =
650648
KB.Class.property CT.Unit.cls ~package "symbols-encodings"

lib/arm/arm_utils.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ let exec (stmts : stmt list) ?(flags : stmt list option) ?(wflag : op option)
7575
let cond = Bil.var cvar in
7676
Bil.(cvar := cval)
7777
:: List.map stmts ~f:(function
78-
| Bil.Move (v, _) as s when Var.is_virtual v -> s
79-
| Bil.Move (v, x) -> Bil.(v := ite ~if_:cond ~then_:x ~else_:(var v))
80-
| _ -> assert false)
78+
| Bil.Move (v, _) as s when Var.is_virtual v -> s
79+
| Bil.Move (v, x) -> Bil.(v := ite ~if_:cond ~then_:x ~else_:(var v))
80+
| _ -> assert false)
8181
| _ -> [ Bil.If (set_cond cond, stmts, []) ]
8282

8383
let exp_of_reg reg = Bil.var (Env.of_reg reg)

lib/bap/bap.mli

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,8 @@ module Std : sig
441441
let print_sections p =
442442
Project.memory p |> Memmap.to_sequence
443443
|> Seq.iter ~f:(fun (mem, x) ->
444-
Option.iter (Value.get Image.section x) ~f:(fun name ->
445-
printf "Section: %s@.%a@." name Memory.pp mem))
444+
Option.iter (Value.get Image.section x) ~f:(fun name ->
445+
printf "Section: %s@.%a@." name Memory.pp mem))
446446
447447
let () = Project.register_pass' print_sections
448448
]}
@@ -10828,9 +10828,8 @@ module Std : sig
1082810828
report_progress ~task:"discover" ~total:(Term.length sub_t prog) ();
1082910829
Term.enum sub_t prog
1083010830
|> Seq.concat_mapi ~f:(fun stage sub ->
10831-
report_progress ~note:(Sub.name sub) ~task:"discover" ~stage
10832-
();
10833-
interesting_points_of_sub sub)
10831+
report_progress ~note:(Sub.name sub) ~task:"discover" ~stage ();
10832+
interesting_points_of_sub sub)
1083410833
1083510834
let check_interesting_points points =
1083610835
report_progress ~task:"checking" ~total:(Seq.length points) ();

lib/bap/bap_project.ml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ module Input = struct
256256
let dedup xs =
257257
List.rev @@ fst
258258
@@ List.fold xs ~init:([], String.Set.empty) ~f:(fun (xs, mems) x ->
259-
if Set.mem mems x then (xs, mems) else (x :: xs, Set.add mems x))
259+
if Set.mem mems x then (xs, mems) else (x :: xs, Set.add mems x))
260260

261261
let provide_bias = Toplevel.var "provide-bias"
262262

@@ -470,7 +470,7 @@ let compute_unit ?package ?state input =
470470
if KB.Domain.is_empty (KB.Slot.domain State.slot) state then
471471
Memmap.to_sequence code |> Seq.to_list_rev
472472
|> KB.List.fold ~init:State.empty ~f:(fun k (mem, _) ->
473-
State.disassemble k mem)
473+
State.disassemble k mem)
474474
>>= State.partition
475475
>>= fun state ->
476476
KB.provide State.slot unit state >>| fun () -> state
@@ -588,9 +588,7 @@ let substitute project mem tag value : t =
588588
let find_tag tag mem =
589589
Memmap.dominators (memory project) mem
590590
|> Seq.find_map ~f:(fun (mem, v) ->
591-
match Value.get tag v with
592-
| Some reg -> Some (mem, reg)
593-
| None -> None)
591+
match Value.get tag v with Some reg -> Some (mem, reg) | None -> None)
594592
in
595593
let find_section = find_tag Image.section in
596594
let find_symbol mem =
@@ -601,10 +599,10 @@ let substitute project mem tag value : t =
601599
let find_block mem =
602600
Symtab.dominators (symbols project) mem
603601
|> List.find_map ~f:(fun (_, _, cfg) ->
604-
Seq.find_map (Cfg.nodes cfg) ~f:(fun block ->
605-
if Addr.(Block.addr block = Memory.min_addr mem) then
606-
Some (Block.memory block, block)
607-
else None))
602+
Seq.find_map (Cfg.nodes cfg) ~f:(fun block ->
603+
if Addr.(Block.addr block = Memory.min_addr mem) then
604+
Some (Block.memory block, block)
605+
else None))
608606
in
609607
let subst_section (mem, name) = function
610608
| #bound as b -> addr b mem

lib/bap/bap_self.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ module Create () = struct
9797
Configuration.parameters ~doc ?as_flag ?aliases:synonyms t name
9898
|> Configuration.determined
9999
|> Future.map ~f:(fun res ->
100-
match default with
101-
| None -> res
102-
| Some default -> ( match res with [] -> default | xs -> xs))
100+
match default with
101+
| None -> res
102+
| Some default -> ( match res with [] -> default | xs -> xs))
103103

104104
let flag ?deprecated ?docv:_ ?(doc = "Undocumented.") ?synonyms name =
105105
let doc = prepend_deprecation deprecated doc in

lib/bap_build/bap_build.ml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ module Plugin_rules = struct
138138
let generate_plugins_for_packages () =
139139
packages ()
140140
|> concat_map ~f:(fun name ->
141-
concat_map [ `native; `byte ] ~f:(fun code ->
142-
generate_plugin_for_package code name))
141+
concat_map [ `native; `byte ] ~f:(fun code ->
142+
generate_plugin_for_package code name))
143143

144144
let make_list_option option = function
145145
| [] -> N
@@ -151,12 +151,10 @@ module Plugin_rules = struct
151151
let requires =
152152
packages ()
153153
|> concat_map ~f:(fun pkg ->
154-
findlibs ~dynamic:false pkg
155-
|> List.map ~f:(fun path ->
156-
let name =
157-
path |> Filename.chop_extension |> Filename.basename
158-
in
159-
name ^ "=" ^ name ^ ".cmxs," ^ name ^ "=" ^ name ^ ".cma"))
154+
findlibs ~dynamic:false pkg
155+
|> List.map ~f:(fun path ->
156+
let name = path |> Filename.chop_extension |> Filename.basename in
157+
name ^ "=" ^ name ^ ".cmxs," ^ name ^ "=" ^ name ^ ".cma"))
160158
|> make_list_option "-requires"
161159
in
162160
let provides =

lib/bap_bundle/bap_bundle.ml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -162,31 +162,31 @@ module Std = struct
162162
b >>> fun zip ->
163163
Zip.entries zip
164164
|> List.filter_map ~f:(fun e ->
165-
let name = Zip.(e.filename) in
166-
Option.some_if (not (String.equal name Nameof.manifest)) name)
165+
let name = Zip.(e.filename) in
166+
Option.some_if (not (String.equal name Nameof.manifest)) name)
167167

168168
let transform files bundle ~f =
169169
let zin = open_in bundle.path in
170170
let store filename data = Hashtbl.set files ~key:filename ~data in
171171
Zip.entries zin
172172
|> List.iter ~f:(fun entry ->
173-
let filename = Zip.(entry.filename) in
174-
let process_file f =
175-
let name, chan = Filename.open_temp_file "bundle" "entry" in
176-
Zip.copy_entry_to_channel zin entry chan;
177-
Out_channel.close chan;
178-
f name;
179-
store filename (`Move name)
180-
in
181-
let process_data f =
182-
let data = Zip.read_entry zin entry in
183-
store filename (`Data (f data))
184-
in
185-
match f filename with
186-
| `Map f -> process_data f
187-
| `Proc f -> process_file f
188-
| `Copy -> process_file ignore
189-
| `Drop -> ());
173+
let filename = Zip.(entry.filename) in
174+
let process_file f =
175+
let name, chan = Filename.open_temp_file "bundle" "entry" in
176+
Zip.copy_entry_to_channel zin entry chan;
177+
Out_channel.close chan;
178+
f name;
179+
store filename (`Move name)
180+
in
181+
let process_data f =
182+
let data = Zip.read_entry zin entry in
183+
store filename (`Data (f data))
184+
in
185+
match f filename with
186+
| `Map f -> process_data f
187+
| `Proc f -> process_file f
188+
| `Copy -> process_file ignore
189+
| `Drop -> ());
190190
Zip.close_in zin;
191191
let zout = Zip.open_out bundle.path in
192192
Hashtbl.iteri files ~f:(fun ~key:name ~data ->

lib/bap_byteweight/bap_byteweight_signatures.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ let default_paths = [ default_path; system_path ]
7474
let try_lookup ?(paths = []) ?compiler target data =
7575
paths @ default_paths
7676
|> List.find_map ~f:(fun path ->
77-
if Sys.file_exists path then read_entry ?compiler target data path
78-
else None)
77+
if Sys.file_exists path then read_entry ?compiler target data path
78+
else None)
7979

8080
let of_exn = function
8181
| Sys_error msg -> Error (`Sys_error msg)
@@ -93,7 +93,7 @@ let update_or_fail ?compiler target data payload path =
9393
let entries =
9494
read_entries path
9595
|> List.filter ~f:(fun (entry, _) ->
96-
not (matching_entry ?compiler target data entry))
96+
not (matching_entry ?compiler target data entry))
9797
in
9898
with_output path @@ fun zip ->
9999
let path = make_entry ?compiler target data in

lib/bap_c/bap_c_abi.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,9 +425,9 @@ module Arg = struct
425425
let slots stack =
426426
Map.to_alist stack.data
427427
|> List.filter_map ~f:(fun (off, (info, bits)) ->
428-
match info with
429-
| None -> None
430-
| Some { datum } -> Some (off, datum, bits))
428+
match info with
429+
| None -> None
430+
| Some { datum } -> Some (off, datum, bits))
431431

432432
let singleton entry stack =
433433
{ stack with data = Map.singleton (module Int) 0 entry }
@@ -793,7 +793,7 @@ module Arg = struct
793793
let base = Stack.base stack in
794794
Stack.slots stack
795795
|> List.map ~f:(fun (off, data, bits) ->
796-
(data, load target bits base off))
796+
(data, load target bits base off))
797797
in
798798
Some
799799
{

0 commit comments

Comments
 (0)