How to access the file provided by cilly in my CIL module

I added a new function for CIL (C Intermediate Language). I can execute my new module using

$cilly --dotestmodule --save-temps -D HAPPY_MOOD -o test test.c

Now, in my test module, I want to call Cfg.computeFileCFG for the file test.c. But I do not know how to access the test.c file in my module.

I tried using Cil.file. but he says "Unbound value Cil.file".

my code is:

open Pretty
open Cfg
open Cil

module RD = Reachingdefs

let () = Cfg.computeFileCFG Cil.file

let rec fact n = if n < 2 then 1 else n * fact(n-1)
let doIt n = fact n

let feature : featureDescr =
  { fd_name = "testmodule";
    fd_enabled = ref false;
    fd_description = "simple test 1240";
    fd_extraopt = [];
    fd_doit = (function (f: file) -> ignore (doIt 10));
    fd_post_check = true;
  }

please tell me how to calculate the Cfg file for test.c.

+3
source share
1 answer

I am not a CIL expert, but here are a few notes:

  • CIL online documentation indicates what Cil.fileis an Ocaml type. Passing a type as an argument to a function, , , ;
  • , fd_doit , , f;
  • Cilly, f Cil.file. , , , computeFileCFG.

, . !

+3

All Articles