summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSon Ho2022-01-06 10:10:33 +0100
committerSon Ho2022-01-06 10:10:33 +0100
commit6179fed42a11365c753aee55470bb69dc780e1ba (patch)
tree422ad872c9599f812a64045a4b0a667554292f69 /src
parent5ba37ac224892a4c52cf8ab97c2352c217c27270 (diff)
Implement statement_has_loops and make minor modifications
Diffstat (limited to '')
-rw-r--r--src/CfimAstUtils.ml16
-rw-r--r--src/Substitute.ml1
-rw-r--r--src/TypesUtils.ml2
3 files changed, 17 insertions, 2 deletions
diff --git a/src/CfimAstUtils.ml b/src/CfimAstUtils.ml
new file mode 100644
index 00000000..f811475c
--- /dev/null
+++ b/src/CfimAstUtils.ml
@@ -0,0 +1,16 @@
+open CfimAst
+open Utils
+
+(** Check if a [statement] contains loops *)
+let rec statement_has_loops (st : statement) : bool =
+ let obj =
+ object
+ inherit [_] iter_statement
+
+ method! visit_Loop _ _ = raise Found
+ end
+ in
+ try
+ obj#visit_statement () st;
+ false
+ with Found -> true
diff --git a/src/Substitute.ml b/src/Substitute.ml
index d3c3c430..1b6003bb 100644
--- a/src/Substitute.ml
+++ b/src/Substitute.ml
@@ -52,7 +52,6 @@ let fresh_regions_with_substs (region_vars : T.region_var list)
let ctx, fresh_region_ids =
List.fold_left_map (fun ctx _ -> C.fresh_region_id ctx) ctx region_vars
in
- let fresh_regions = List.map (fun rid -> T.Var rid) fresh_region_ids in
(* Generate the map from region var ids to regions *)
let ls = List.combine region_vars fresh_region_ids in
let rid_map =
diff --git a/src/TypesUtils.ml b/src/TypesUtils.ml
index faf77eac..c1f52120 100644
--- a/src/TypesUtils.ml
+++ b/src/TypesUtils.ml
@@ -72,7 +72,7 @@ let rec ety_no_regions_to_rty (ty : ety) : rty =
regions"
(** Check if a [ty] contains regions *)
-let rec ty_has_regions (ty : ety) : bool =
+let ty_has_regions (ty : ety) : bool =
let obj =
object
inherit [_] iter_ty as super