summaryrefslogtreecommitdiff
path: root/src/CfimAstUtils.ml
blob: 96410dde2cd1628e78c6f89f963e94a0a79dc4fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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