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] Some question concerning code transformation using Cil and Frama_c_visitors.


  • Subject: [Frama-c-discuss] Some question concerning code transformation using Cil and Frama_c_visitors.
  • From: virgile.prevosto at cea.fr (Virgile Prevosto)
  • Date: Thu, 01 Dec 2011 09:23:52 +0100
  • In-reply-to: <CAC+4PJiKDH5PtKWD=CaP1pGst4oTDkXG3pfbO7W+_ZB8_ZbGog@mail.gmail.com>
  • References: <CAC+4PJiKDH5PtKWD=CaP1pGst4oTDkXG3pfbO7W+_ZB8_ZbGog@mail.gmail.com>

Hello,

On 30/11/2011 19:05, florent garnier wrote:
> To define new statements, I need to be able to define new expressions.
>
> "
> val new_exp : loc:Cil_types.location -> Cil_types.exp_node -> Cil_types.exp
> "
>
> However, I don't know which value I should assign to
> loc:Cil_types.location parameter.

new_exp is indeed the good function to use. There are some specialized 
cases in Cil as well, mainly for constants. The location is mainly 
relevant for nodes that come directly from the parsed files. It is 
exclusively used in messages to tell the user which part of the code is 
concerned. Basically there are three possible choices:
- you have an explicit location to give
- you can use Cil_const.CurrentLoc.get, which will give you the location 
of the currently visited node (more precisely the most recently visited 
node that contains location information)
- you can use Cil_datatype.Location.unknown (a dummy location)

Hope this helps,
-- 
E tutto per oggi, a la prossima volta
Virgile