1 | /* Interface between GCC C FE and GDB -*- c -*- |
---|
2 | |
---|
3 | Copyright (C) 2014-2015 Free Software Foundation, Inc. |
---|
4 | |
---|
5 | This file is part of GCC. |
---|
6 | |
---|
7 | This program is free software; you can redistribute it and/or modify |
---|
8 | it under the terms of the GNU General Public License as published by |
---|
9 | the Free Software Foundation; either version 3 of the License, or |
---|
10 | (at your option) any later version. |
---|
11 | |
---|
12 | This program is distributed in the hope that it will be useful, |
---|
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | GNU General Public License for more details. |
---|
16 | |
---|
17 | You should have received a copy of the GNU General Public License |
---|
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
---|
19 | |
---|
20 | |
---|
21 | |
---|
22 | /* Create a new "decl" in GCC. A decl is a declaration, basically a |
---|
23 | kind of symbol. |
---|
24 | |
---|
25 | NAME is the name of the new symbol. SYM_KIND is the kind of |
---|
26 | symbol being requested. SYM_TYPE is the new symbol's C type; |
---|
27 | except for labels, where this is not meaningful and should be |
---|
28 | zero. If SUBSTITUTION_NAME is not NULL, then a reference to this |
---|
29 | decl in the source will later be substituted with a dereference |
---|
30 | of a variable of the given name. Otherwise, for symbols having |
---|
31 | an address (e.g., functions), ADDRESS is the address. FILENAME |
---|
32 | and LINE_NUMBER refer to the symbol's source location. If this |
---|
33 | is not known, FILENAME can be NULL and LINE_NUMBER can be 0. |
---|
34 | This function returns the new decl. */ |
---|
35 | |
---|
36 | GCC_METHOD7 (gcc_decl, build_decl, |
---|
37 | const char *, /* Argument NAME. */ |
---|
38 | enum gcc_c_symbol_kind, /* Argument SYM_KIND. */ |
---|
39 | gcc_type, /* Argument SYM_TYPE. */ |
---|
40 | const char *, /* Argument SUBSTITUTION_NAME. */ |
---|
41 | gcc_address, /* Argument ADDRESS. */ |
---|
42 | const char *, /* Argument FILENAME. */ |
---|
43 | unsigned int) /* Argument LINE_NUMBER. */ |
---|
44 | |
---|
45 | /* Insert a GCC decl into the symbol table. DECL is the decl to |
---|
46 | insert. IS_GLOBAL is true if this is an outermost binding, and |
---|
47 | false if it is a possibly-shadowing binding. */ |
---|
48 | |
---|
49 | GCC_METHOD2 (int /* bool */, bind, |
---|
50 | gcc_decl, /* Argument DECL. */ |
---|
51 | int /* bool */) /* Argument IS_GLOBAL. */ |
---|
52 | |
---|
53 | /* Insert a tagged type into the symbol table. NAME is the tag name |
---|
54 | of the type and TAGGED_TYPE is the type itself. TAGGED_TYPE must |
---|
55 | be either a struct, union, or enum type, as these are the only |
---|
56 | types that have tags. FILENAME and LINE_NUMBER refer to the type's |
---|
57 | source location. If this is not known, FILENAME can be NULL and |
---|
58 | LINE_NUMBER can be 0. */ |
---|
59 | |
---|
60 | GCC_METHOD4 (int /* bool */, tagbind, |
---|
61 | const char *, /* Argument NAME. */ |
---|
62 | gcc_type, /* Argument TAGGED_TYPE. */ |
---|
63 | const char *, /* Argument FILENAME. */ |
---|
64 | unsigned int) /* Argument LINE_NUMBER. */ |
---|
65 | |
---|
66 | /* Return the type of a pointer to a given base type. */ |
---|
67 | |
---|
68 | GCC_METHOD1 (gcc_type, build_pointer_type, |
---|
69 | gcc_type) /* Argument BASE_TYPE. */ |
---|
70 | |
---|
71 | /* Create a new 'struct' type. Initially it has no fields. */ |
---|
72 | |
---|
73 | GCC_METHOD0 (gcc_type, build_record_type) |
---|
74 | |
---|
75 | /* Create a new 'union' type. Initially it has no fields. */ |
---|
76 | |
---|
77 | GCC_METHOD0 (gcc_type, build_union_type) |
---|
78 | |
---|
79 | /* Add a field to a struct or union type. FIELD_NAME is the field's |
---|
80 | name. FIELD_TYPE is the type of the field. BITSIZE and BITPOS |
---|
81 | indicate where in the struct the field occurs. */ |
---|
82 | |
---|
83 | GCC_METHOD5 (int /* bool */, build_add_field, |
---|
84 | gcc_type, /* Argument RECORD_OR_UNION_TYPE. */ |
---|
85 | const char *, /* Argument FIELD_NAME. */ |
---|
86 | gcc_type, /* Argument FIELD_TYPE. */ |
---|
87 | unsigned long, /* Argument BITSIZE. */ |
---|
88 | unsigned long) /* Argument BITPOS. */ |
---|
89 | |
---|
90 | /* After all the fields have been added to a struct or union, the |
---|
91 | struct or union type must be "finished". This does some final |
---|
92 | cleanups in GCC. */ |
---|
93 | |
---|
94 | GCC_METHOD2 (int /* bool */, finish_record_or_union, |
---|
95 | gcc_type, /* Argument RECORD_OR_UNION_TYPE. */ |
---|
96 | unsigned long) /* Argument SIZE_IN_BYTES. */ |
---|
97 | |
---|
98 | /* Create a new 'enum' type. The new type initially has no |
---|
99 | associated constants. */ |
---|
100 | |
---|
101 | GCC_METHOD1 (gcc_type, build_enum_type, |
---|
102 | gcc_type) /* Argument UNDERLYING_INT_TYPE. */ |
---|
103 | |
---|
104 | /* Add a new constant to an enum type. NAME is the constant's |
---|
105 | name and VALUE is its value. */ |
---|
106 | |
---|
107 | GCC_METHOD3 (int /* bool */, build_add_enum_constant, |
---|
108 | gcc_type, /* Argument ENUM_TYPE. */ |
---|
109 | const char *, /* Argument NAME. */ |
---|
110 | unsigned long) /* Argument VALUE. */ |
---|
111 | |
---|
112 | /* After all the constants have been added to an enum, the type must |
---|
113 | be "finished". This does some final cleanups in GCC. */ |
---|
114 | |
---|
115 | GCC_METHOD1 (int /* bool */, finish_enum_type, |
---|
116 | gcc_type) /* Argument ENUM_TYPE. */ |
---|
117 | |
---|
118 | /* Create a new function type. RETURN_TYPE is the type returned by |
---|
119 | the function, and ARGUMENT_TYPES is a vector, of length NARGS, of |
---|
120 | the argument types. IS_VARARGS is true if the function is |
---|
121 | varargs. */ |
---|
122 | |
---|
123 | GCC_METHOD3 (gcc_type, build_function_type, |
---|
124 | gcc_type, /* Argument RETURN_TYPE. */ |
---|
125 | const struct gcc_type_array *, /* Argument ARGUMENT_TYPES. */ |
---|
126 | int /* bool */) /* Argument IS_VARARGS. */ |
---|
127 | |
---|
128 | /* Return an integer type with the given properties. */ |
---|
129 | |
---|
130 | GCC_METHOD2 (gcc_type, int_type, |
---|
131 | int /* bool */, /* Argument IS_UNSIGNED. */ |
---|
132 | unsigned long) /* Argument SIZE_IN_BYTES. */ |
---|
133 | |
---|
134 | /* Return a floating point type with the given properties. */ |
---|
135 | |
---|
136 | GCC_METHOD1 (gcc_type, float_type, |
---|
137 | unsigned long) /* Argument SIZE_IN_BYTES. */ |
---|
138 | |
---|
139 | /* Return the 'void' type. */ |
---|
140 | |
---|
141 | GCC_METHOD0 (gcc_type, void_type) |
---|
142 | |
---|
143 | /* Return the 'bool' type. */ |
---|
144 | |
---|
145 | GCC_METHOD0 (gcc_type, bool_type) |
---|
146 | |
---|
147 | /* Create a new array type. If NUM_ELEMENTS is -1, then the array |
---|
148 | is assumed to have an unknown length. */ |
---|
149 | |
---|
150 | GCC_METHOD2 (gcc_type, build_array_type, |
---|
151 | gcc_type, /* Argument ELEMENT_TYPE. */ |
---|
152 | int) /* Argument NUM_ELEMENTS. */ |
---|
153 | |
---|
154 | /* Create a new variably-sized array type. UPPER_BOUND_NAME is the |
---|
155 | name of a local variable that holds the upper bound of the array; |
---|
156 | it is one less than the array size. */ |
---|
157 | |
---|
158 | GCC_METHOD2 (gcc_type, build_vla_array_type, |
---|
159 | gcc_type, /* Argument ELEMENT_TYPE. */ |
---|
160 | const char *) /* Argument UPPER_BOUND_NAME. */ |
---|
161 | |
---|
162 | /* Return a qualified variant of a given base type. QUALIFIERS says |
---|
163 | which qualifiers to use; it is composed of or'd together |
---|
164 | constants from 'enum gcc_qualifiers'. */ |
---|
165 | |
---|
166 | GCC_METHOD2 (gcc_type, build_qualified_type, |
---|
167 | gcc_type, /* Argument UNQUALIFIED_TYPE. */ |
---|
168 | enum gcc_qualifiers) /* Argument QUALIFIERS. */ |
---|
169 | |
---|
170 | /* Build a complex type given its element type. */ |
---|
171 | |
---|
172 | GCC_METHOD1 (gcc_type, build_complex_type, |
---|
173 | gcc_type) /* Argument ELEMENT_TYPE. */ |
---|
174 | |
---|
175 | /* Build a vector type given its element type and number of |
---|
176 | elements. */ |
---|
177 | |
---|
178 | GCC_METHOD2 (gcc_type, build_vector_type, |
---|
179 | gcc_type, /* Argument ELEMENT_TYPE. */ |
---|
180 | int) /* Argument NUM_ELEMENTS. */ |
---|
181 | |
---|
182 | /* Build a constant. NAME is the constant's name and VALUE is its |
---|
183 | value. FILENAME and LINE_NUMBER refer to the type's source |
---|
184 | location. If this is not known, FILENAME can be NULL and |
---|
185 | LINE_NUMBER can be 0. */ |
---|
186 | |
---|
187 | GCC_METHOD5 (int /* bool */, build_constant, |
---|
188 | gcc_type, /* Argument TYPE. */ |
---|
189 | const char *, /* Argument NAME. */ |
---|
190 | unsigned long, /* Argument VALUE. */ |
---|
191 | const char *, /* Argument FILENAME. */ |
---|
192 | unsigned int) /* Argument LINE_NUMBER. */ |
---|
193 | |
---|
194 | /* Emit an error and return an error type object. */ |
---|
195 | |
---|
196 | GCC_METHOD1 (gcc_type, error, |
---|
197 | const char *) /* Argument MESSAGE. */ |
---|