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] Substitution in Cil_types.predicate


  • Subject: [Frama-c-discuss] Substitution in Cil_types.predicate
  • From: hollas at informatik.htw-dresden.de (Boris Hollas)
  • Date: Mon, 27 Feb 2012 09:15:06 +0100
  • In-reply-to: <CA+yPOVgMt=gL_ta6EybZdxEdueW+-S0UMOgfXND8EH90VUF_GA@mail.gmail.com>
  • References: <1330091763.2071.50.camel@iti27.informatik.htw-dresden.de> <CA+yPOVgMt=gL_ta6EybZdxEdueW+-S0UMOgfXND8EH90VUF_GA@mail.gmail.com>

On Fri, 2012-02-24 at 15:47 +0100, Virgile Prevosto wrote:
> Hello Boris,
> 
> 2012/2/24 Boris Hollas <hollas at informatik.htw-dresden.de>:
> > I want to perform a substitution in a Cil_types.predicate, for example
> > x->a in (0 <= x <= n). Is there a function in the Frama-C API to do so?
> 
> There's nothing built-in, but a tiny copy visitor should do the trick.

This works in a small example:

method vterm t =
  begin match t.term_node with
    | TLval(TVar lv, offs) when Logic_utils.is_same_var lv lv_old ->
      let t_new = Logic_const.term (TLval(TVar lv_new, offs))
t.term_type in 
      Cil.ChangeDoChildrenPost (t, fun _ -> t_new)

However, I use the term_offset of t in t_new. Is this correct in
general?

With ChangeDoChildrenPost, it want to replace t with t_new. In 5.14.3.,
the meaning of ChangeDoChildrenPost is explained as follows:
"ChangeDoChildrenPost(v,f) the old node is replaced by v, the visit goes
on with the children of v, and when it is finished, f is applied to the
result."
- does "old node" mean the original node?
- what does the "result" refer to? If it is the result of the visit,
what is this?

-- 
Best regards,
Boris