summaryrefslogtreecommitdiff
path: root/src/CfimAstUtils.ml
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/CfimAstUtils.ml19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/CfimAstUtils.ml b/src/CfimAstUtils.ml
new file mode 100644
index 00000000..96410dde
--- /dev/null
+++ b/src/CfimAstUtils.ml
@@ -0,0 +1,19 @@
+open CfimAst
+open Utils
+
+(** Check if a [statement] contains loops *)
+let 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
+
+(** Check if a [fun_def] contains loops *)
+let fun_def_has_loops (fd : fun_def) : bool = statement_has_loops fd.body