On Thu, Mar 07, 2013 at 11:16:01PM +0530, son...@iitk.ac.in wrote:
> Thanks for the example.
> 
>  let convert v = Lval (Var v.svar, NoOffset) in
>         mkStmtOneInstr (Call(None, convert foo, [f; 1], loc));
> 
> In the above code i am getting following error:
> 
> 
> Error: This expression has type Cil.varinfo
>        but an expression was expected of type Cil.fundec
> 
> where "foo" is type of varinfo

If "foo" is of type varinfo rather than fundec, you don't need the ".svar" part:
let convert v = Lval (Var v, NoOffset)

> also findOrCreateFunc finds a function definition inside the input file to
> be instrumented ?

Yes (a function or a prototype).

> if yes then what if the function definition for which call is to be inserted
> is saved in a separate file.

If the function or prototype is already present, it just returns the varinfo.
Otherwise (function defined in another file and without prototype in the current
one), it inserts a prototype (based on the type you provide) in the current
file, and returns the fresh corresponding varinfo.

-- 
Gabriel

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
CIL-users mailing list
CIL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cil-users

Reply via email to