let varXformClass action data sid fd nofrm = object
    inherit nopCilVisitor

  method vexpr e = match e.enode with
    Lval(Var vi, NoOffset->
      (match action data sid vi fd nofrm with
        None -> DoChildren
      | Some e' ->
          (* Cast e' to the correct type. *)
          let e'' = mkCast ~e:e' ~newt:vi.vtype in
          ChangeTo e'')
  | Lval(Mem e', off) ->
      (* don't substitute constants in memory lvals *)
      let post e = match e.enode with
        Lval(Mem({enode = Const _}),off') ->
          { e with enode = Lval(Mem e', off')}
      | _ -> e
      in
      ChangeDoChildrenPost(new_exp ~loc:e.eloc (Lval(Mem e', off)), post)
  | _ -> DoChildren

end