The documentation for the "succs" field states that this field is filled by 
computeCFGInfo: (* The successor statements. [...] Filled in only after the CFG 
is computed.    *)
This suggests the "succs" field should not be used for other purposes than to 
manipulate the control flow graph, but perhaps the documentation could make 
that point explicit?

Matthieu




________________________________
De : Divya Krishnan <divya1...@users.sourceforge.net>
À : Divya Krishnan <divya1...@users.sourceforge.net>; 
cil-users@lists.sourceforge.net
Envoyé le : Mardi, 28 Avril 2009, 18h17mn 39s
Objet : Re: [CIL users] Adding stmts after a particular statement

Thank you everyone for the input. 
s.succs is mutable, then how can it be read-only? Also how do we recognize 
other such fields in Cil?

-Divya


On Mon, Apr 27, 2009 at 4:04 PM, Gabriel Kerneis <kern...@pps.jussieu.fr> wrote:

On Mon, Apr 27, 2009 at 02:14:45PM -0400, Elnatan Reisner wrote:
> I don't know why changing s.succs didn't work,

Because this is a read-only field, computed by Cfg. It contains control-flow
graph information, nothing else.


> but I think you should be able to use ChangeTo if you replace 's' with a
> statement with skind Block and put the list of statements you want into that
> Block.

Indeed. I do this all the time in CPC and it works very well.

http://www.pps.jussieu.fr/~kerneis/software/repos/cpc/stable/src/ext/cpc.ml
Look for example at add_goto src dst which adds a goto to dst just after src.

Regards,
--
Gabriel Kerneis


      
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
CIL-users mailing list
CIL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cil-users

Reply via email to