Skip to content

Commit 62b8952

Browse files
committed
Fix ArrayDomain indentation (PR #577)
1 parent 2b0d88d commit 62b8952

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

src/cdomains/arrayDomain.ml

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ struct
7878
let name () = "unrolled arrays"
7979
type idx = Idx.t
8080
type value = Val.t
81-
let factor () =
81+
let factor () =
8282
match get_int "ana.base.arrays.unrolling-factor" with
8383
| 0 -> failwith "ArrayDomain: ana.base.arrays.unrolling-factor needs to be set when using the unroll domain"
8484
| x -> x
@@ -92,8 +92,8 @@ struct
9292
let pretty () x = text "Array: " ++ text (show x)
9393
let pretty_diff () (x,y) = dprintf "%s: %a not leq %a" (name ()) pretty x pretty y
9494
let extract x = match x with
95-
| Some c -> c
96-
| None -> failwith "arrarDomain: that sould not happen"
95+
| Some c -> c
96+
| None -> failwith "arrayDomain: that should not happen"
9797
let get (ask: Q.ask) (xl, xr) (_,i) =
9898
let search_unrolled_values min_i max_i =
9999
let mi = Z.to_int min_i in
@@ -125,10 +125,10 @@ struct
125125
else if i>ma then (hd::tl)
126126
else (Val.join hd v)::(weak_update tl (i+1)) in
127127
let rec full_update l i = match l with
128-
| [] -> []
129-
| hd::tl ->
130-
if i<mi then hd::(full_update tl (i+1))
131-
else v::tl in
128+
| [] -> []
129+
| hd::tl ->
130+
if i<mi then hd::(full_update tl (i+1))
131+
else v::tl in
132132
if mi=ma then full_update xl 0
133133
else weak_update xl 0 in
134134
let f = Z.of_int (factor ()) in
@@ -830,10 +830,10 @@ struct
830830
end
831831

832832
let to_t = function
833-
| (Some p, None, None) -> (Some p, None)
834-
| (None, Some t, None) -> (None, Some (Some t, None))
835-
| (None, None, Some u) -> (None, Some (None, Some u))
836-
| _ -> failwith "FlagConfiguredArrayDomain received a value where not exactly one component is set"
833+
| (Some p, None, None) -> (Some p, None)
834+
| (None, Some t, None) -> (None, Some (Some t, None))
835+
| (None, None, Some u) -> (None, Some (None, Some u))
836+
| _ -> failwith "FlagConfiguredArrayDomain received a value where not exactly one component is set"
837837

838838
module I = struct include LatticeFlagHelper (T) (U) (K) let name () = "" end
839839
include LatticeFlagHelper (P) (I) (K)
@@ -845,20 +845,19 @@ struct
845845

846846
(* Simply call appropriate function for component that is not None *)
847847
let get a x (e,i) = unop' (fun x ->
848-
if e = `Top then
849-
let e' = BatOption.map_default (fun x -> `Lifted (Cil.kintegerCilint (Cilfacade.ptrdiff_ikind ()) x)) (`Top) (Idx.to_int i) in
850-
P.get a x (e', i)
851-
else
852-
P.get a x (e, i)
853-
) (fun x -> T.get a x (e,i)) (fun x -> U.get a x (e,i)) x
848+
if e = `Top then
849+
let e' = BatOption.map_default (fun x -> `Lifted (Cil.kintegerCilint (Cilfacade.ptrdiff_ikind ()) x)) (`Top) (Idx.to_int i) in
850+
P.get a x (e', i)
851+
else
852+
P.get a x (e, i)
853+
) (fun x -> T.get a x (e,i)) (fun x -> U.get a x (e,i)) x
854854
let set (ask:Q.ask) x i a = unop_to_t' (fun x -> P.set ask x i a) (fun x -> T.set ask x i a) (fun x -> U.set ask x i a) x
855855
let length = unop' P.length T.length U.length
856856
let map f = unop_to_t' (P.map f) (T.map f) (U.map f)
857857
let fold_left f s = unop' (P.fold_left f s) (T.fold_left f s) (U.fold_left f s)
858858
let fold_left2 f s = binop' (P.fold_left2 f s) (T.fold_left2 f s) (U.fold_left2 f s)
859859

860-
let move_if_affected ?(replace_with_const=false) (ask:Q.ask) x v f = unop_to_t' (fun x -> P.move_if_affected ~replace_with_const:replace_with_const ask x v f) (fun x -> T.move_if_affected ~replace_with_const:replace_with_const ask x v f)
861-
(fun x -> U.move_if_affected ~replace_with_const:replace_with_const ask x v f) x
860+
let move_if_affected ?(replace_with_const=false) (ask:Q.ask) x v f = unop_to_t' (fun x -> P.move_if_affected ~replace_with_const:replace_with_const ask x v f) (fun x -> T.move_if_affected ~replace_with_const:replace_with_const ask x v f) (fun x -> U.move_if_affected ~replace_with_const:replace_with_const ask x v f) x
862861
let get_vars_in_e = unop' P.get_vars_in_e T.get_vars_in_e U.get_vars_in_e
863862
let smart_join f g = binop_to_t' (P.smart_join f g) (T.smart_join f g) (U.smart_join f g)
864863
let smart_widen f g = binop_to_t' (P.smart_widen f g) (T.smart_widen f g) (U.smart_widen f g)

0 commit comments

Comments
 (0)