1 | (* *********************************************************************) |
---|
2 | (* *) |
---|
3 | (* The Compcert verified compiler *) |
---|
4 | (* *) |
---|
5 | (* Xavier Leroy, INRIA Paris-Rocquencourt *) |
---|
6 | (* *) |
---|
7 | (* Copyright Institut National de Recherche en Informatique et en *) |
---|
8 | (* Automatique. All rights reserved. This file is distributed *) |
---|
9 | (* under the terms of the GNU General Public License as published by *) |
---|
10 | (* the Free Software Foundation, either version 2 of the License, or *) |
---|
11 | (* (at your option) any later version. This file is also distributed *) |
---|
12 | (* under the terms of the INRIA Non-Commercial License Agreement. *) |
---|
13 | (* *) |
---|
14 | (* *********************************************************************) |
---|
15 | |
---|
16 | type error = |
---|
17 | Unbound_identifier of string |
---|
18 | | Unbound_tag of string * string |
---|
19 | | Tag_mismatch of string * string * string |
---|
20 | | Unbound_typedef of string |
---|
21 | | No_member of string * string * string |
---|
22 | val error_message : error -> string |
---|
23 | exception Error of error |
---|
24 | |
---|
25 | val fresh_ident : string -> C.ident |
---|
26 | |
---|
27 | type composite_info = { |
---|
28 | ci_kind: C.struct_or_union; |
---|
29 | ci_members: C.field list; (* members, in order *) |
---|
30 | ci_alignof: int option; (* alignment; None if incomplete *) |
---|
31 | ci_sizeof: int option; (* size; None if incomplete *) |
---|
32 | } |
---|
33 | |
---|
34 | type ident_info = II_ident of C.storage * C.typ | II_enum of int64 |
---|
35 | |
---|
36 | type typedef_info = C.typ |
---|
37 | |
---|
38 | type t |
---|
39 | |
---|
40 | val empty : t |
---|
41 | |
---|
42 | val new_scope : t -> t |
---|
43 | val in_current_scope : t -> C.ident -> bool |
---|
44 | |
---|
45 | val lookup_ident : t -> string -> C.ident * ident_info |
---|
46 | val lookup_tag : t -> string -> C.ident * composite_info |
---|
47 | val lookup_struct : t -> string -> C.ident * composite_info |
---|
48 | val lookup_union : t -> string -> C.ident * composite_info |
---|
49 | val lookup_composite : t -> string -> (C.ident * composite_info) option |
---|
50 | val lookup_typedef : t -> string -> C.ident * typedef_info |
---|
51 | |
---|
52 | val ident_is_bound : t -> string -> bool |
---|
53 | |
---|
54 | val find_ident : t -> C.ident -> ident_info |
---|
55 | val find_tag : t -> C.ident -> composite_info |
---|
56 | val find_struct : t -> C.ident -> composite_info |
---|
57 | val find_union : t -> C.ident -> composite_info |
---|
58 | val find_member : C.field list -> string -> C.field |
---|
59 | val find_struct_member : t -> C.ident * string -> C.field |
---|
60 | val find_union_member : t -> C.ident * string -> C.field |
---|
61 | val find_typedef : t -> C.ident -> typedef_info |
---|
62 | |
---|
63 | val enter_ident : t -> string -> C.storage -> C.typ -> C.ident * t |
---|
64 | val enter_composite : t -> string -> composite_info -> C.ident * t |
---|
65 | val enter_enum_item : t -> string -> int64 -> C.ident * t |
---|
66 | val enter_typedef : t -> string -> typedef_info -> C.ident * t |
---|
67 | |
---|
68 | val add_ident : t -> C.ident -> C.storage -> C.typ -> t |
---|
69 | val add_composite : t -> C.ident -> composite_info -> t |
---|
70 | val add_typedef : t -> C.ident -> typedef_info -> t |
---|