Thanks Gabriel,  

Vu, 


On Sat, Jan 25, 2014 at 10:17 AM, Gabriel Kerneis <gabriel@kerneis.info> wrote:
Le 2014-01-22 20:24, ThanhVu (Vu) Nguyen a écrit :
> Hi, I am playing with Cil and have several questions 
>
> 1. How do I add a directive to a cil file (of type Cil.fil), e.g.,
> add
> #include "mylib.h"  to a c file 

file.globals <- (GText "mylib.h") :: file.globals

> 2. I want to get all the variables in scope at a particular location,
> e.g., before a statement S. I can get all variables in a function
> using something like fd.slocals @ fd.sformals but not sure how to
> variables at a specific location.  

You cannot do that, CIL does not preserve variable scoping (every
variable
has either global or function scope).

> 3. What would be a good way to keep track of a statement?  If I go
> into a function and identify a statement S of interest,  and then
> make some modification to that function, so S would change (e.g., its
> location etc is now changed, the statment id computed by CFG could
> also changed). So how do I keep track of S ?   


If you take care to only update the statement, but never copy it, you
can
keep track of it in a list/hashtable/whatever and use physical identity
(==).

Best,
--
Gabriel

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
CIL-users mailing list
CIL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cil-users