Frama-C-discuss mailing list archives

This page gathers the archives of the old Frama-C-discuss archives, that was hosted by Inria's gforge before its demise at the end of 2020. To search for mails newer than September 2020, please visit the page of the new mailing list on Renater.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Frama-c-discuss] Modifying the AST to insert statements / declarations



Hello,

> >/       let vi = makeLocalVar (Extlib.the self#current_func) ~scope:cbk vi_name
> />/  vi_type
> />/
> />/  but this doesn't work (the varinfo's created fine and I can use it to create
> />/  new instructions that are using it, but the variable declaration itself is
> />/  not inserted at the beginning of the block as it should). Is that what you
> />/  were suggesting?
> /
> Yes. It could be the case that you're registering the old block
> instead of the copied one, but if you do that at the vblock level, the
> argument passed to the method is already the new block, so this
> shouldn't be a problem.
Hmm, okay.

> >/
> />/  Anyway I was wondering if something could be done by visiting at the
> />/  statement level and creating a new block around the part of code I'm
> />/  modifying; maybe the variable insertion will work "better" in this case?
> /
> This is also a possibility. Of course, this will only work if you use
> the new variable only in the statement being visited, but from what
> you said this seems to be the case.
Yep, I'm only using the variables in a very localized fashion. Simple prototyping suggests this approach works all right, so I'm going for it right now and I'll see if it fixes my problem.

Cheers,
Pierre

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gforge.inria.fr/pipermail/frama-c-discuss/attachments/20120326/b5b5c2f3/attachment.html>