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



2012/3/26 Pierre Karpman <Pierre.Karpman at rennes.supelec.fr>:

> ??? 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.

>
> 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.

Best regards,
-- 
E tutto per oggi, a la prossima volta
Virgile