25
25
(* todo?: al_expr doit enlever les infos de type ? et doit remettre en
28
No! Keeping the type information is important to ensuring that variables
29
of different type and declared in different places do not seem to match
30
each other. On the other hand, we don't want to keep around the
31
information about whether the expression is a test expression, because a
32
term that is a test expression should match one that is not. The test
33
information is only useful for matching to the CTL.
29
37
(* drop all info information *)
31
39
let strip_info_visitor _ =
42
ref (ty,Ast_c.NotTest) in
32
44
{ Visitor_c.default_visitor_c_s with
33
45
Visitor_c.kinfo_s =
34
46
(* traversal should be deterministic... *)
39
51
Visitor_c.kexpr_s = (fun (k,_) e ->
40
52
let (e', ty), ii' = k e in
41
(e', Ast_c.noType()(*ref !ty*)), ii' (* keep type - jll *)
53
(e', drop_test ty), ii' (* keep type - jll *)
86
let strip_inh_info_visitor _ = (* for inherited metavariables *)
92
| Some (ty,_) -> Some (ty,Ast_c.NotLocalVar) in
93
ref (ty,Ast_c.NotTest) in
95
{ Visitor_c.default_visitor_c_s with
97
(* traversal should be deterministic... *)
100
function i -> ctr := !ctr + 1; Ast_c.al_info_cpp !ctr i));
102
Visitor_c.kexpr_s = (fun (k,_) e ->
103
let (e', ty), ii' = k e in
104
(e', drop_test_lv ty), ii' (* keep type - jll *)
108
Visitor_c.ktype_s = (fun (k,_) ft ->
110
match Ast_c.unwrap_typeC ft' with
111
| Ast_c.TypeName (s,_typ) ->
112
Ast_c.TypeName (s, Ast_c.noTypedefDef()) +> Ast_c.rewrap_typeC ft'
120
let al_inh_expr x = Visitor_c.vk_expr_s (strip_inh_info_visitor()) x
121
let al_inh_statement x = Visitor_c.vk_statement_s (strip_inh_info_visitor()) x
122
let al_inh_type x = Visitor_c.vk_type_s (strip_inh_info_visitor()) x
123
let al_inh_init x = Visitor_c.vk_ini_s (strip_inh_info_visitor()) x
124
let al_inh_arguments x = Visitor_c.vk_arguments_s (strip_inh_info_visitor()) x
76
128
let semi_strip_info_visitor = (* keep position information *)
131
ref (ty,Ast_c.NotTest) in
77
133
{ Visitor_c.default_visitor_c_s with
78
134
Visitor_c.kinfo_s = (fun (k,_) i -> Ast_c.semi_al_info_cpp i);
80
136
Visitor_c.kexpr_s = (fun (k,_) e ->
81
137
let (e', ty),ii' = k e in
82
(e', Ast_c.noType()(*ref !ty*)), ii' (* keep type - jll *)
138
(e', drop_test ty), ii' (* keep type - jll *)
101
157
(* really strip, do not keep position nor anything specificities, true
102
* abstracted form. *)
158
* abstracted form. This is used outside coccinelle in Yacfe and aComment *)
103
159
let real_strip_info_visitor _ =
104
160
{ Visitor_c.default_visitor_c_s with
105
161
Visitor_c.kinfo_s = (fun (k,_) i ->