annotate include/gcc-cp-interface.h @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Interface between GCC C++ FE and GDB
kono
parents:
diff changeset
2
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
3 Copyright (C) 2014-2018 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 This file is part of GCC.
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 This program is free software; you can redistribute it and/or modify
kono
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
kono
parents:
diff changeset
9 the Free Software Foundation; either version 3 of the License, or
kono
parents:
diff changeset
10 (at your option) any later version.
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 This program is distributed in the hope that it will be useful,
kono
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
kono
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
kono
parents:
diff changeset
15 GNU General Public License for more details.
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 #ifndef GCC_CP_INTERFACE_H
kono
parents:
diff changeset
21 #define GCC_CP_INTERFACE_H
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 #include "gcc-interface.h"
kono
parents:
diff changeset
24
kono
parents:
diff changeset
25 /* This header defines the interface to the GCC API. It must be both
kono
parents:
diff changeset
26 valid C and valid C++, because it is included by both programs. */
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 #ifdef __cplusplus
kono
parents:
diff changeset
29 extern "C" {
kono
parents:
diff changeset
30 #endif
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 /* Forward declaration. */
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 struct gcc_cp_context;
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 /*
kono
parents:
diff changeset
37 * Definitions and declarations for the C++ front end.
kono
parents:
diff changeset
38 */
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 /* Defined versions of the C++ front-end API. */
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 enum gcc_cp_api_version
kono
parents:
diff changeset
43 {
kono
parents:
diff changeset
44 GCC_CP_FE_VERSION_0 = 0
kono
parents:
diff changeset
45 };
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 /* Qualifiers. */
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 enum gcc_cp_qualifiers
kono
parents:
diff changeset
50 {
kono
parents:
diff changeset
51 GCC_CP_QUALIFIER_CONST = 1,
kono
parents:
diff changeset
52 GCC_CP_QUALIFIER_VOLATILE = 2,
kono
parents:
diff changeset
53 GCC_CP_QUALIFIER_RESTRICT = 4
kono
parents:
diff changeset
54 };
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 /* Ref qualifiers. */
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 enum gcc_cp_ref_qualifiers {
kono
parents:
diff changeset
59 GCC_CP_REF_QUAL_NONE = 0,
kono
parents:
diff changeset
60 GCC_CP_REF_QUAL_LVALUE = 1,
kono
parents:
diff changeset
61 GCC_CP_REF_QUAL_RVALUE = 2
kono
parents:
diff changeset
62 };
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 /* Opaque typedef for unbound class templates. They are used for
kono
parents:
diff changeset
65 template arguments, and defaults for template template
kono
parents:
diff changeset
66 parameters. */
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 typedef unsigned long long gcc_utempl;
kono
parents:
diff changeset
69
kono
parents:
diff changeset
70 /* Opaque typedef for expressions. They are used for template
kono
parents:
diff changeset
71 arguments, defaults for non-type template parameters, and defaults
kono
parents:
diff changeset
72 for function arguments. */
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 typedef unsigned long long gcc_expr;
kono
parents:
diff changeset
75
kono
parents:
diff changeset
76 typedef enum
kono
parents:
diff changeset
77 { GCC_CP_TPARG_VALUE, GCC_CP_TPARG_CLASS,
kono
parents:
diff changeset
78 GCC_CP_TPARG_TEMPL, GCC_CP_TPARG_PACK }
kono
parents:
diff changeset
79 gcc_cp_template_arg_kind;
kono
parents:
diff changeset
80
kono
parents:
diff changeset
81 typedef union
kono
parents:
diff changeset
82 { gcc_expr value; gcc_type type; gcc_utempl templ; gcc_type pack; }
kono
parents:
diff changeset
83 gcc_cp_template_arg;
kono
parents:
diff changeset
84
kono
parents:
diff changeset
85 /* An array of template arguments. */
kono
parents:
diff changeset
86
kono
parents:
diff changeset
87 struct gcc_cp_template_args
kono
parents:
diff changeset
88 {
kono
parents:
diff changeset
89 /* Number of elements. */
kono
parents:
diff changeset
90
kono
parents:
diff changeset
91 int n_elements;
kono
parents:
diff changeset
92
kono
parents:
diff changeset
93 /* kind[i] indicates what kind of template argument type[i] is. */
kono
parents:
diff changeset
94
kono
parents:
diff changeset
95 char /* gcc_cp_template_arg_kind */ *kinds;
kono
parents:
diff changeset
96
kono
parents:
diff changeset
97 /* The template arguments. */
kono
parents:
diff changeset
98
kono
parents:
diff changeset
99 gcc_cp_template_arg *elements;
kono
parents:
diff changeset
100 };
kono
parents:
diff changeset
101
kono
parents:
diff changeset
102 /* An array of (default) function arguments. */
kono
parents:
diff changeset
103
kono
parents:
diff changeset
104 struct gcc_cp_function_args
kono
parents:
diff changeset
105 {
kono
parents:
diff changeset
106 /* Number of elements. */
kono
parents:
diff changeset
107
kono
parents:
diff changeset
108 int n_elements;
kono
parents:
diff changeset
109
kono
parents:
diff changeset
110 /* The (default) values for each argument. */
kono
parents:
diff changeset
111
kono
parents:
diff changeset
112 gcc_expr *elements;
kono
parents:
diff changeset
113 };
kono
parents:
diff changeset
114
kono
parents:
diff changeset
115 /* This enumerates the kinds of decls that GDB can create. */
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 enum gcc_cp_symbol_kind
kono
parents:
diff changeset
118 {
kono
parents:
diff changeset
119 /* A function. */
kono
parents:
diff changeset
120
kono
parents:
diff changeset
121 GCC_CP_SYMBOL_FUNCTION,
kono
parents:
diff changeset
122
kono
parents:
diff changeset
123 /* A variable. */
kono
parents:
diff changeset
124
kono
parents:
diff changeset
125 GCC_CP_SYMBOL_VARIABLE,
kono
parents:
diff changeset
126
kono
parents:
diff changeset
127 /* A typedef, or an alias declaration (including template ones). */
kono
parents:
diff changeset
128
kono
parents:
diff changeset
129 GCC_CP_SYMBOL_TYPEDEF,
kono
parents:
diff changeset
130
kono
parents:
diff changeset
131 /* A label. */
kono
parents:
diff changeset
132
kono
parents:
diff changeset
133 GCC_CP_SYMBOL_LABEL,
kono
parents:
diff changeset
134
kono
parents:
diff changeset
135 /* A class, forward declared in build_decl (to be later defined in
kono
parents:
diff changeset
136 start_class_definition), or, in a template parameter list scope,
kono
parents:
diff changeset
137 a declaration of a template class, closing the parameter
kono
parents:
diff changeset
138 list. */
kono
parents:
diff changeset
139
kono
parents:
diff changeset
140 GCC_CP_SYMBOL_CLASS,
kono
parents:
diff changeset
141
kono
parents:
diff changeset
142 /* A union, forward declared in build_decl (to be later defined in
kono
parents:
diff changeset
143 start_class_definition). */
kono
parents:
diff changeset
144
kono
parents:
diff changeset
145 GCC_CP_SYMBOL_UNION,
kono
parents:
diff changeset
146
kono
parents:
diff changeset
147 /* An enumeration type being introduced with start_new_enum_type. */
kono
parents:
diff changeset
148
kono
parents:
diff changeset
149 GCC_CP_SYMBOL_ENUM,
kono
parents:
diff changeset
150
kono
parents:
diff changeset
151 /* A nonstatic data member being introduced with new_field. */
kono
parents:
diff changeset
152
kono
parents:
diff changeset
153 GCC_CP_SYMBOL_FIELD,
kono
parents:
diff changeset
154
kono
parents:
diff changeset
155 /* A base class in a gcc_vbase_array. */
kono
parents:
diff changeset
156
kono
parents:
diff changeset
157 GCC_CP_SYMBOL_BASECLASS,
kono
parents:
diff changeset
158
kono
parents:
diff changeset
159 /* A using declaration in new_using_decl. */
kono
parents:
diff changeset
160
kono
parents:
diff changeset
161 GCC_CP_SYMBOL_USING,
kono
parents:
diff changeset
162
kono
parents:
diff changeset
163 /* A (lambda) closure class type. In many regards this is just like
kono
parents:
diff changeset
164 a regular class, but it's not supposed to have base classes, some
kono
parents:
diff changeset
165 of the member functions that are usually implicitly-defined are
kono
parents:
diff changeset
166 deleted, and it should have an operator() member function that
kono
parents:
diff changeset
167 holds the lambda body. We can't instantiate objects of lambda
kono
parents:
diff changeset
168 types from the snippet, but we can interact with them in such
kono
parents:
diff changeset
169 ways as passing them to functions that take their types, and
kono
parents:
diff changeset
170 calling their body. */
kono
parents:
diff changeset
171
kono
parents:
diff changeset
172 GCC_CP_SYMBOL_LAMBDA_CLOSURE,
kono
parents:
diff changeset
173
kono
parents:
diff changeset
174 /* Marker to check that we haven't exceeded GCC_CP_SYMBOL_MASK. */
kono
parents:
diff changeset
175 GCC_CP_SYMBOL_END,
kono
parents:
diff changeset
176
kono
parents:
diff changeset
177 GCC_CP_SYMBOL_MASK = 15,
kono
parents:
diff changeset
178
kono
parents:
diff changeset
179 /* When defining a class member, at least one of the
kono
parents:
diff changeset
180 GCC_CP_ACCESS_MASK bits must be set; when defining a namespace-
kono
parents:
diff changeset
181 or union-scoped symbol, none of them must be set. */
kono
parents:
diff changeset
182
kono
parents:
diff changeset
183 GCC_CP_ACCESS_PRIVATE,
kono
parents:
diff changeset
184 GCC_CP_ACCESS_PUBLIC = GCC_CP_ACCESS_PRIVATE << 1,
kono
parents:
diff changeset
185 GCC_CP_ACCESS_MASK = (GCC_CP_ACCESS_PUBLIC
kono
parents:
diff changeset
186 | GCC_CP_ACCESS_PRIVATE),
kono
parents:
diff changeset
187 GCC_CP_ACCESS_PROTECTED = GCC_CP_ACCESS_MASK,
kono
parents:
diff changeset
188 GCC_CP_ACCESS_NONE = 0,
kono
parents:
diff changeset
189
kono
parents:
diff changeset
190 GCC_CP_FLAG_BASE = GCC_CP_ACCESS_PRIVATE << 2,
kono
parents:
diff changeset
191
kono
parents:
diff changeset
192 /* Flags to be used along with GCC_CP_SYMBOL_FUNCTION: */
kono
parents:
diff changeset
193
kono
parents:
diff changeset
194 /* This flag should be set for constructors, destructors and
kono
parents:
diff changeset
195 operators. */
kono
parents:
diff changeset
196 GCC_CP_FLAG_SPECIAL_FUNCTION = GCC_CP_FLAG_BASE,
kono
parents:
diff changeset
197
kono
parents:
diff changeset
198 /* We intentionally cannot express inline, constexpr, or virtual
kono
parents:
diff changeset
199 override for functions. We can't inline or constexpr-replace
kono
parents:
diff changeset
200 without a source-level body. The override keyword is only
kono
parents:
diff changeset
201 meaningful within the definition of the containing class. */
kono
parents:
diff changeset
202
kono
parents:
diff changeset
203 /* This indicates a "virtual" member function, explicitly or
kono
parents:
diff changeset
204 implicitly (due to a virtual function with the same name and
kono
parents:
diff changeset
205 prototype in a base class) declared as such. */
kono
parents:
diff changeset
206 GCC_CP_FLAG_VIRTUAL_FUNCTION = GCC_CP_FLAG_BASE << 1,
kono
parents:
diff changeset
207
kono
parents:
diff changeset
208 /* The following two flags should only be set when the flag above is
kono
parents:
diff changeset
209 set. */
kono
parents:
diff changeset
210
kono
parents:
diff changeset
211 /* This indicates a pure virtual member function, i.e., one that is
kono
parents:
diff changeset
212 declared with "= 0", even if a body is provided in the
kono
parents:
diff changeset
213 definition. */
kono
parents:
diff changeset
214 GCC_CP_FLAG_PURE_VIRTUAL_FUNCTION = GCC_CP_FLAG_BASE << 2,
kono
parents:
diff changeset
215
kono
parents:
diff changeset
216 /* This indicates a "final" virtual member function. */
kono
parents:
diff changeset
217 GCC_CP_FLAG_FINAL_VIRTUAL_FUNCTION = GCC_CP_FLAG_BASE << 3,
kono
parents:
diff changeset
218
kono
parents:
diff changeset
219 /* This indicates a special member function should have its default
kono
parents:
diff changeset
220 implementation. This either means the function declaration
kono
parents:
diff changeset
221 contains the "= default" tokens, or that the member function was
kono
parents:
diff changeset
222 implicitly generated by the compiler, although the latter use is
kono
parents:
diff changeset
223 discouraged: just let the compiler implicitly introduce it.
kono
parents:
diff changeset
224
kono
parents:
diff changeset
225 A member function defaulted after its first declaration has
kono
parents:
diff changeset
226 slightly different ABI implications from one implicitly generated
kono
parents:
diff changeset
227 or explicitly defaulted at the declaration (and definition)
kono
parents:
diff changeset
228 point. To avoid silent (possibly harmless) violation of the one
kono
parents:
diff changeset
229 definition rule, it is recommended that this flag not be used for
kono
parents:
diff changeset
230 such functions, and that the address of the definition be
kono
parents:
diff changeset
231 supplied instead. */
kono
parents:
diff changeset
232 GCC_CP_FLAG_DEFAULTED_FUNCTION = GCC_CP_FLAG_BASE << 4,
kono
parents:
diff changeset
233
kono
parents:
diff changeset
234 /* This indicates a deleted member function, i.e., one that has been
kono
parents:
diff changeset
235 defined as "= delete" at its declaration point, or one that has
kono
parents:
diff changeset
236 been implicitly defined as deleted (with or without an explicit
kono
parents:
diff changeset
237 "= default" definition).
kono
parents:
diff changeset
238
kono
parents:
diff changeset
239 This should not be used for implicitly-declared member functions
kono
parents:
diff changeset
240 that resolve to deleted definitions, as it may affect the
kono
parents:
diff changeset
241 implicit declaration of other member functions. */
kono
parents:
diff changeset
242 GCC_CP_FLAG_DELETED_FUNCTION = GCC_CP_FLAG_BASE << 5,
kono
parents:
diff changeset
243
kono
parents:
diff changeset
244 /* This indicates a constructor or type-conversion operator declared
kono
parents:
diff changeset
245 as "explicit". */
kono
parents:
diff changeset
246
kono
parents:
diff changeset
247 GCC_CP_FLAG_EXPLICIT_FUNCTION = GCC_CP_FLAG_BASE << 6,
kono
parents:
diff changeset
248
kono
parents:
diff changeset
249 GCC_CP_FLAG_END_FUNCTION,
kono
parents:
diff changeset
250 GCC_CP_FLAG_MASK_FUNCTION = (((GCC_CP_FLAG_END_FUNCTION - 1) << 1)
kono
parents:
diff changeset
251 - GCC_CP_FLAG_BASE),
kono
parents:
diff changeset
252
kono
parents:
diff changeset
253 /* Flags to be used along with GCC_CP_SYMBOL_VARIABLE: */
kono
parents:
diff changeset
254
kono
parents:
diff changeset
255 /* This indicates a variable declared as "constexpr". */
kono
parents:
diff changeset
256
kono
parents:
diff changeset
257 GCC_CP_FLAG_CONSTEXPR_VARIABLE = GCC_CP_FLAG_BASE,
kono
parents:
diff changeset
258
kono
parents:
diff changeset
259 /* This indicates a variable declared as "thread_local". ??? What
kono
parents:
diff changeset
260 should the ADDRESS be? */
kono
parents:
diff changeset
261
kono
parents:
diff changeset
262 GCC_CP_FLAG_THREAD_LOCAL_VARIABLE = GCC_CP_FLAG_BASE << 1,
kono
parents:
diff changeset
263
kono
parents:
diff changeset
264 GCC_CP_FLAG_END_VARIABLE,
kono
parents:
diff changeset
265 GCC_CP_FLAG_MASK_VARIABLE = (((GCC_CP_FLAG_END_VARIABLE - 1) << 1)
kono
parents:
diff changeset
266 - GCC_CP_FLAG_BASE),
kono
parents:
diff changeset
267
kono
parents:
diff changeset
268 /* Flags to be used when defining nonstatic data members of classes
kono
parents:
diff changeset
269 with new_field. */
kono
parents:
diff changeset
270
kono
parents:
diff changeset
271 /* Use this when no flags are present. */
kono
parents:
diff changeset
272 GCC_CP_FLAG_FIELD_NOFLAG = 0,
kono
parents:
diff changeset
273
kono
parents:
diff changeset
274 /* This indicates the field is declared as mutable. */
kono
parents:
diff changeset
275 GCC_CP_FLAG_FIELD_MUTABLE = GCC_CP_FLAG_BASE,
kono
parents:
diff changeset
276
kono
parents:
diff changeset
277 GCC_CP_FLAG_END_FIELD,
kono
parents:
diff changeset
278 GCC_CP_FLAG_MASK_FIELD = (((GCC_CP_FLAG_END_FIELD - 1) << 1)
kono
parents:
diff changeset
279 - GCC_CP_FLAG_BASE),
kono
parents:
diff changeset
280
kono
parents:
diff changeset
281 /* Flags to be used when defining an enum with
kono
parents:
diff changeset
282 start_new_enum_type. */
kono
parents:
diff changeset
283
kono
parents:
diff changeset
284 /* This indicates an enum type without any flags. */
kono
parents:
diff changeset
285 GCC_CP_FLAG_ENUM_NOFLAG = 0,
kono
parents:
diff changeset
286
kono
parents:
diff changeset
287 /* This indicates a scoped enum type. */
kono
parents:
diff changeset
288 GCC_CP_FLAG_ENUM_SCOPED = GCC_CP_FLAG_BASE,
kono
parents:
diff changeset
289
kono
parents:
diff changeset
290 GCC_CP_FLAG_END_ENUM,
kono
parents:
diff changeset
291 GCC_CP_FLAG_MASK_ENUM = (((GCC_CP_FLAG_END_ENUM - 1) << 1)
kono
parents:
diff changeset
292 - GCC_CP_FLAG_BASE),
kono
parents:
diff changeset
293
kono
parents:
diff changeset
294
kono
parents:
diff changeset
295 /* Flags to be used when introducing a class or a class template
kono
parents:
diff changeset
296 with build_decl. */
kono
parents:
diff changeset
297
kono
parents:
diff changeset
298 /* This indicates an enum type without any flags. */
kono
parents:
diff changeset
299 GCC_CP_FLAG_CLASS_NOFLAG = 0,
kono
parents:
diff changeset
300
kono
parents:
diff changeset
301 /* This indicates the class is actually a struct. This has no
kono
parents:
diff changeset
302 effect whatsoever on access control in this interface, since all
kono
parents:
diff changeset
303 class members must have explicit access control bits set, but it
kono
parents:
diff changeset
304 may affect error messages. */
kono
parents:
diff changeset
305 GCC_CP_FLAG_CLASS_IS_STRUCT = GCC_CP_FLAG_BASE,
kono
parents:
diff changeset
306
kono
parents:
diff changeset
307 GCC_CP_FLAG_END_CLASS,
kono
parents:
diff changeset
308 GCC_CP_FLAG_MASK_CLASS = (((GCC_CP_FLAG_END_CLASS - 1) << 1)
kono
parents:
diff changeset
309 - GCC_CP_FLAG_BASE),
kono
parents:
diff changeset
310
kono
parents:
diff changeset
311
kono
parents:
diff changeset
312 /* Flags to be used when introducing a virtual base class in a
kono
parents:
diff changeset
313 gcc_vbase_array. */
kono
parents:
diff changeset
314
kono
parents:
diff changeset
315 /* This indicates an enum type without any flags. */
kono
parents:
diff changeset
316 GCC_CP_FLAG_BASECLASS_NOFLAG = 0,
kono
parents:
diff changeset
317
kono
parents:
diff changeset
318 /* This indicates the class is actually a struct. This has no
kono
parents:
diff changeset
319 effect whatsoever on access control in this interface, since all
kono
parents:
diff changeset
320 class members must have explicit access control bits set, but it
kono
parents:
diff changeset
321 may affect error messages. */
kono
parents:
diff changeset
322 GCC_CP_FLAG_BASECLASS_VIRTUAL = GCC_CP_FLAG_BASE,
kono
parents:
diff changeset
323
kono
parents:
diff changeset
324 GCC_CP_FLAG_END_BASECLASS,
kono
parents:
diff changeset
325 GCC_CP_FLAG_MASK_BASECLASS = (((GCC_CP_FLAG_END_BASECLASS - 1) << 1)
kono
parents:
diff changeset
326 - GCC_CP_FLAG_BASE),
kono
parents:
diff changeset
327
kono
parents:
diff changeset
328
kono
parents:
diff changeset
329 GCC_CP_FLAG_MASK = (GCC_CP_FLAG_MASK_FUNCTION
kono
parents:
diff changeset
330 | GCC_CP_FLAG_MASK_VARIABLE
kono
parents:
diff changeset
331 | GCC_CP_FLAG_MASK_FIELD
kono
parents:
diff changeset
332 | GCC_CP_FLAG_MASK_ENUM
kono
parents:
diff changeset
333 | GCC_CP_FLAG_MASK_CLASS
kono
parents:
diff changeset
334 | GCC_CP_FLAG_MASK_BASECLASS
kono
parents:
diff changeset
335 )
kono
parents:
diff changeset
336 };
kono
parents:
diff changeset
337
kono
parents:
diff changeset
338
kono
parents:
diff changeset
339 /* An array of types used for creating lists of base classes. */
kono
parents:
diff changeset
340
kono
parents:
diff changeset
341 struct gcc_vbase_array
kono
parents:
diff changeset
342 {
kono
parents:
diff changeset
343 /* Number of elements. */
kono
parents:
diff changeset
344
kono
parents:
diff changeset
345 int n_elements;
kono
parents:
diff changeset
346
kono
parents:
diff changeset
347 /* The base classes. */
kono
parents:
diff changeset
348
kono
parents:
diff changeset
349 gcc_type *elements;
kono
parents:
diff changeset
350
kono
parents:
diff changeset
351 /* Flags for each base class. Used to indicate access control and
kono
parents:
diff changeset
352 virtualness. */
kono
parents:
diff changeset
353
kono
parents:
diff changeset
354 enum gcc_cp_symbol_kind *flags;
kono
parents:
diff changeset
355 };
kono
parents:
diff changeset
356
kono
parents:
diff changeset
357
kono
parents:
diff changeset
358 /* This enumerates the types of symbols that GCC might request from
kono
parents:
diff changeset
359 GDB. */
kono
parents:
diff changeset
360
kono
parents:
diff changeset
361 enum gcc_cp_oracle_request
kono
parents:
diff changeset
362 {
kono
parents:
diff changeset
363 /* An identifier in namespace scope -- type, variable, function,
kono
parents:
diff changeset
364 namespace, template. All namespace-scoped symbols with the
kono
parents:
diff changeset
365 requested name, in any namespace (including the global
kono
parents:
diff changeset
366 namespace), should be defined in response to this request. */
kono
parents:
diff changeset
367
kono
parents:
diff changeset
368 GCC_CP_ORACLE_IDENTIFIER
kono
parents:
diff changeset
369 };
kono
parents:
diff changeset
370
kono
parents:
diff changeset
371 /* The type of the function called by GCC to ask GDB for a symbol's
kono
parents:
diff changeset
372 definition. DATUM is an arbitrary value supplied when the oracle
kono
parents:
diff changeset
373 function is registered. CONTEXT is the GCC context in which the
kono
parents:
diff changeset
374 request is being made. REQUEST specifies what sort of symbol is
kono
parents:
diff changeset
375 being requested, and IDENTIFIER is the name of the symbol. */
kono
parents:
diff changeset
376
kono
parents:
diff changeset
377 typedef void gcc_cp_oracle_function (void *datum,
kono
parents:
diff changeset
378 struct gcc_cp_context *context,
kono
parents:
diff changeset
379 enum gcc_cp_oracle_request request,
kono
parents:
diff changeset
380 const char *identifier);
kono
parents:
diff changeset
381
kono
parents:
diff changeset
382 /* The type of the function called by GCC to ask GDB for a symbol's
kono
parents:
diff changeset
383 address. This should return 0 if the address is not known. */
kono
parents:
diff changeset
384
kono
parents:
diff changeset
385 typedef gcc_address gcc_cp_symbol_address_function (void *datum,
kono
parents:
diff changeset
386 struct gcc_cp_context *ctxt,
kono
parents:
diff changeset
387 const char *identifier);
kono
parents:
diff changeset
388
kono
parents:
diff changeset
389 /* The type of the function called by GCC to ask GDB to enter or leave
kono
parents:
diff changeset
390 the user expression scope. */
kono
parents:
diff changeset
391
kono
parents:
diff changeset
392 typedef void gcc_cp_enter_leave_user_expr_scope_function (void *datum,
kono
parents:
diff changeset
393 struct gcc_cp_context
kono
parents:
diff changeset
394 *context);
kono
parents:
diff changeset
395
kono
parents:
diff changeset
396 /* The vtable used by the C front end. */
kono
parents:
diff changeset
397
kono
parents:
diff changeset
398 struct gcc_cp_fe_vtable
kono
parents:
diff changeset
399 {
kono
parents:
diff changeset
400 /* The version of the C interface. The value is one of the
kono
parents:
diff changeset
401 gcc_cp_api_version constants. */
kono
parents:
diff changeset
402
kono
parents:
diff changeset
403 unsigned int cp_version;
kono
parents:
diff changeset
404
kono
parents:
diff changeset
405 /* Set the callbacks for this context.
kono
parents:
diff changeset
406
kono
parents:
diff changeset
407 The binding oracle is called whenever the C++ parser needs to
kono
parents:
diff changeset
408 look up a symbol. This gives the caller a chance to lazily
kono
parents:
diff changeset
409 instantiate symbols using other parts of the gcc_cp_fe_interface
kono
parents:
diff changeset
410 API. The symbol is looked up without a scope, and the oracle
kono
parents:
diff changeset
411 must supply a definition for ALL namespace-scoped definitions
kono
parents:
diff changeset
412 bound to the symbol.
kono
parents:
diff changeset
413
kono
parents:
diff changeset
414 The address oracle is called whenever the C++ parser needs to
kono
parents:
diff changeset
415 look up a symbol. This may be called for symbols not provided by
kono
parents:
diff changeset
416 the symbol oracle, such as built-in functions where GCC provides
kono
parents:
diff changeset
417 the declaration; other internal symbols, such as those related
kono
parents:
diff changeset
418 with thunks, rtti, and virtual tables are likely to be queried
kono
parents:
diff changeset
419 through this interface too. The identifier is a mangled symbol
kono
parents:
diff changeset
420 name.
kono
parents:
diff changeset
421
kono
parents:
diff changeset
422 DATUM is an arbitrary piece of data that is passed back verbatim
kono
parents:
diff changeset
423 to the callbacks in requests. */
kono
parents:
diff changeset
424
kono
parents:
diff changeset
425 void (*set_callbacks) (struct gcc_cp_context *self,
kono
parents:
diff changeset
426 gcc_cp_oracle_function *binding_oracle,
kono
parents:
diff changeset
427 gcc_cp_symbol_address_function *address_oracle,
kono
parents:
diff changeset
428 gcc_cp_enter_leave_user_expr_scope_function *enter_scope,
kono
parents:
diff changeset
429 gcc_cp_enter_leave_user_expr_scope_function *leave_scope,
kono
parents:
diff changeset
430 void *datum);
kono
parents:
diff changeset
431
kono
parents:
diff changeset
432 #define GCC_METHOD0(R, N) \
kono
parents:
diff changeset
433 R (*N) (struct gcc_cp_context *);
kono
parents:
diff changeset
434 #define GCC_METHOD1(R, N, A) \
kono
parents:
diff changeset
435 R (*N) (struct gcc_cp_context *, A);
kono
parents:
diff changeset
436 #define GCC_METHOD2(R, N, A, B) \
kono
parents:
diff changeset
437 R (*N) (struct gcc_cp_context *, A, B);
kono
parents:
diff changeset
438 #define GCC_METHOD3(R, N, A, B, C) \
kono
parents:
diff changeset
439 R (*N) (struct gcc_cp_context *, A, B, C);
kono
parents:
diff changeset
440 #define GCC_METHOD4(R, N, A, B, C, D) \
kono
parents:
diff changeset
441 R (*N) (struct gcc_cp_context *, A, B, C, D);
kono
parents:
diff changeset
442 #define GCC_METHOD5(R, N, A, B, C, D, E) \
kono
parents:
diff changeset
443 R (*N) (struct gcc_cp_context *, A, B, C, D, E);
kono
parents:
diff changeset
444 #define GCC_METHOD7(R, N, A, B, C, D, E, F, G) \
kono
parents:
diff changeset
445 R (*N) (struct gcc_cp_context *, A, B, C, D, E, F, G);
kono
parents:
diff changeset
446
kono
parents:
diff changeset
447 #include "gcc-cp-fe.def"
kono
parents:
diff changeset
448
kono
parents:
diff changeset
449 #undef GCC_METHOD0
kono
parents:
diff changeset
450 #undef GCC_METHOD1
kono
parents:
diff changeset
451 #undef GCC_METHOD2
kono
parents:
diff changeset
452 #undef GCC_METHOD3
kono
parents:
diff changeset
453 #undef GCC_METHOD4
kono
parents:
diff changeset
454 #undef GCC_METHOD5
kono
parents:
diff changeset
455 #undef GCC_METHOD7
kono
parents:
diff changeset
456
kono
parents:
diff changeset
457 };
kono
parents:
diff changeset
458
kono
parents:
diff changeset
459 /* The C front end object. */
kono
parents:
diff changeset
460
kono
parents:
diff changeset
461 struct gcc_cp_context
kono
parents:
diff changeset
462 {
kono
parents:
diff changeset
463 /* Base class. */
kono
parents:
diff changeset
464
kono
parents:
diff changeset
465 struct gcc_base_context base;
kono
parents:
diff changeset
466
kono
parents:
diff changeset
467 /* Our vtable. This is a separate field because this is simpler
kono
parents:
diff changeset
468 than implementing a vtable inheritance scheme in C. */
kono
parents:
diff changeset
469
kono
parents:
diff changeset
470 const struct gcc_cp_fe_vtable *cp_ops;
kono
parents:
diff changeset
471 };
kono
parents:
diff changeset
472
kono
parents:
diff changeset
473 /* The name of the .so that the compiler builds. We dlopen this
kono
parents:
diff changeset
474 later. */
kono
parents:
diff changeset
475
kono
parents:
diff changeset
476 #define GCC_CP_FE_LIBCC libcc1.so
kono
parents:
diff changeset
477
kono
parents:
diff changeset
478 /* The compiler exports a single initialization function. This macro
kono
parents:
diff changeset
479 holds its name as a symbol. */
kono
parents:
diff changeset
480
kono
parents:
diff changeset
481 #define GCC_CP_FE_CONTEXT gcc_cp_fe_context
kono
parents:
diff changeset
482
kono
parents:
diff changeset
483 /* The type of the initialization function. The caller passes in the
kono
parents:
diff changeset
484 desired base version and desired C-specific version. If the
kono
parents:
diff changeset
485 request can be satisfied, a compatible gcc_context object will be
kono
parents:
diff changeset
486 returned. Otherwise, the function returns NULL. */
kono
parents:
diff changeset
487
kono
parents:
diff changeset
488 typedef struct gcc_cp_context *gcc_cp_fe_context_function
kono
parents:
diff changeset
489 (enum gcc_base_api_version,
kono
parents:
diff changeset
490 enum gcc_cp_api_version);
kono
parents:
diff changeset
491
kono
parents:
diff changeset
492 #ifdef __cplusplus
kono
parents:
diff changeset
493 }
kono
parents:
diff changeset
494 #endif
kono
parents:
diff changeset
495
kono
parents:
diff changeset
496 #endif /* GCC_CP_INTERFACE_H */