annotate include/gcc-cp-fe.def @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
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 -*- c -*-
kono
parents:
diff changeset
2
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
3 Copyright (C) 2014-2020 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
kono
parents:
diff changeset
21
kono
parents:
diff changeset
22 /* Push namespace NAME as the current binding level, to which
kono
parents:
diff changeset
23 newly-introduced decls will be bound. An empty string identifies
kono
parents:
diff changeset
24 the global namespace, whereas NULL identifies an anonymous
kono
parents:
diff changeset
25 namespace. A namespace named NAME is created in the current scope,
kono
parents:
diff changeset
26 if needed.
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 If the newly-created namespace is to be an inline namespace, see
kono
parents:
diff changeset
29 make_namespace_inline. */
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 GCC_METHOD1 (int /* bool */, push_namespace,
kono
parents:
diff changeset
32 const char *) /* Argument NAME. */
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 /* Push TYPE as the current binding level, making its members visible
kono
parents:
diff changeset
35 for name lookup. The current scope before the call must be the
kono
parents:
diff changeset
36 scope in which the class was declared. This should be used if the
kono
parents:
diff changeset
37 definition of a class is already finished, but one wishes to define
kono
parents:
diff changeset
38 a nested class, or to enter the scope of one of its member
kono
parents:
diff changeset
39 functions. */
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 GCC_METHOD1 (int /* bool */, push_class,
kono
parents:
diff changeset
42 gcc_type) /* Argument TYPE. */
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 /* Push FUNCTION_DECL as the current (empty) binding level (see
kono
parents:
diff changeset
45 reactivate_decl). The current enclosing scope before the call must
kono
parents:
diff changeset
46 be the scope in which the function was declared. */
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 GCC_METHOD1 (int /* bool */, push_function,
kono
parents:
diff changeset
49 gcc_decl) /* Argument FUNCTION_DECL. */
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51 /* Make DECL visible (again?) within SCOPE. When SCOPE is NULL, it
kono
parents:
diff changeset
52 means the current scope; if it is not NULL, it must name a function
kono
parents:
diff changeset
53 that is currently active, even if not at the top of the binding
kono
parents:
diff changeset
54 chain.
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 This function can be used to make e.g. a global function or
kono
parents:
diff changeset
57 variable visible in a namespace or local scope (overriding another
kono
parents:
diff changeset
58 enclosing definition of the same name), but its most common
kono
parents:
diff changeset
59 expected use of this primitive, that gives it its name, is to make
kono
parents:
diff changeset
60 declarations visible again after reentering a function scope,
kono
parents:
diff changeset
61 because when a function is entered with push_function, that does
kono
parents:
diff changeset
62 NOT make any of the declarations nested in it visible for name
kono
parents:
diff changeset
63 lookup.
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 There is a reason/excuse for that: unlike namespaces and classes,
kono
parents:
diff changeset
66 G++ doesn't ever have to reenter function scopes, so its name
kono
parents:
diff changeset
67 resolution infrastructure is not prepared to do that. But wait,
kono
parents:
diff changeset
68 there is also a good use for this apparent limitation: a function
kono
parents:
diff changeset
69 may contain multiple scopes (blocks), and the name may be bound to
kono
parents:
diff changeset
70 different symbols in each of these scopes. With this interface, as
kono
parents:
diff changeset
71 we reenter a function scope, we may choose which symbols to make
kono
parents:
diff changeset
72 visible for the code snippet, or, if there could be template
kono
parents:
diff changeset
73 functions in local scopes, for unresolved names in nested template
kono
parents:
diff changeset
74 class default arguments, or in nested template function signatures.
kono
parents:
diff changeset
75
kono
parents:
diff changeset
76 As for making a local declaration visible for the code snippet,
kono
parents:
diff changeset
77 there are two possibilities: a) introduce it upfront, while
kono
parents:
diff changeset
78 entering the scope for the user expression (see the enter_scope
kono
parents:
diff changeset
79 callback, called by g++ when encountering the push_user_expression
kono
parents:
diff changeset
80 pragma), which might save some scope switching and reactivate_decl
kono
parents:
diff changeset
81 (though this can't be helped if some declarations have to be
kono
parents:
diff changeset
82 introduced and discarded, because of multiple definitions of the
kono
parents:
diff changeset
83 same name in different scopes within a function: they have to be
kono
parents:
diff changeset
84 defined in discriminator order); or b) introduce it when its name
kono
parents:
diff changeset
85 is looked up, entering the scope, introducing the declaration,
kono
parents:
diff changeset
86 leaving the scope, and then reactivating the declaration in its
kono
parents:
diff changeset
87 local scope.
kono
parents:
diff changeset
88
kono
parents:
diff changeset
89 Here's some more detail on how reactivate_decl works. Say there's
kono
parents:
diff changeset
90 a function foo whose body looks like this:
kono
parents:
diff changeset
91
kono
parents:
diff changeset
92 {
kono
parents:
diff changeset
93 {
kono
parents:
diff changeset
94 // point 1
kono
parents:
diff changeset
95 class c {} o __attribute__ ((__used__)); // c , o
kono
parents:
diff changeset
96 }
kono
parents:
diff changeset
97 struct c {
kono
parents:
diff changeset
98 void f() {
kono
parents:
diff changeset
99 // point 2
kono
parents:
diff changeset
100 }
kono
parents:
diff changeset
101 } o __attribute__ ((__used__)); // c_0, o_0
kono
parents:
diff changeset
102 {
kono
parents:
diff changeset
103 class c {} p __attribute__ ((__used__)); // c_1, p
kono
parents:
diff changeset
104 // point 3
kono
parents:
diff changeset
105 o.f();
kono
parents:
diff changeset
106 }
kono
parents:
diff changeset
107 }
kono
parents:
diff changeset
108
kono
parents:
diff changeset
109 When we are about to define class c at point 1, we enter the
kono
parents:
diff changeset
110 function foo scope, and since no symbols are visible at point 1, we
kono
parents:
diff changeset
111 proceed to declare class c. We may then define the class right
kono
parents:
diff changeset
112 away, or, if we leave the function scope, and we later wish to
kono
parents:
diff changeset
113 define it, or to define object o, we can reenter the scope and just
kono
parents:
diff changeset
114 use the previously-obtained gcc_decl to define the class, without
kono
parents:
diff changeset
115 having to reactivate the declaration.
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 Now, if we are to set up the binding context for point 2, we have
kono
parents:
diff changeset
118 to define c_0::f, and in order to do so, we have to declare and
kono
parents:
diff changeset
119 define c_0. Before we can declare c_0, we MUST at least declare c.
kono
parents:
diff changeset
120
kono
parents:
diff changeset
121 As a general rule, before we can declare or define any local name
kono
parents:
diff changeset
122 with a discriminator, we have to at least declare any other
kono
parents:
diff changeset
123 occurrences of the same name in the same enclosing entity with
kono
parents:
diff changeset
124 lower or absent discriminator.
kono
parents:
diff changeset
125
kono
parents:
diff changeset
126 So, we declare c, then we leave the function scope and reenter it
kono
parents:
diff changeset
127 so as to declare c_0 (also with name "c", which is why we have to
kono
parents:
diff changeset
128 leave and reenter the function scope, otherwise we would get an
kono
parents:
diff changeset
129 error because of the duplicate definition; g++ will assign a
kono
parents:
diff changeset
130 discriminator because it still remembers there was an earlier
kono
parents:
diff changeset
131 declaration of c_0 within the function, it's just no longer in
kono
parents:
diff changeset
132 scope), then we can define c_0, including its member function f.
kono
parents:
diff changeset
133
kono
parents:
diff changeset
134 Likewise, if we wish to define o_0, we have to define o first. If
kono
parents:
diff changeset
135 we wish to declare (and maybe then define) c_1, we have to at least
kono
parents:
diff changeset
136 declare (c and then) c_0 first.
kono
parents:
diff changeset
137
kono
parents:
diff changeset
138 Then, as we set up the binding context to compile a code snippet at
kono
parents:
diff changeset
139 point 3, we may choose to activate c_1, o_0 and p upfront,
kono
parents:
diff changeset
140 declaring and discarding c, c_0 and o, and then reentering the
kono
parents:
diff changeset
141 funciton scope to declare c_1, o_0 and p; or we can wait for oracle
kono
parents:
diff changeset
142 lookups of c, o or p. If c is looked up, and the debugger resolves
kono
parents:
diff changeset
143 c in the scope to c_1, it is expected to enter the function scope
kono
parents:
diff changeset
144 from the top level, declare c, leave it, reenter it, declare c_0,
kono
parents:
diff changeset
145 leave it, reenter it, declare c_1, leave it, and then reactivate
kono
parents:
diff changeset
146 c_1 in the function scope. If c_1 is needed as a complete type,
kono
parents:
diff changeset
147 the definition may be given right after the declaration, or the
kono
parents:
diff changeset
148 scope will have to be reentered in order to define the class.
kono
parents:
diff changeset
149
kono
parents:
diff changeset
150 . If the code snippet is at point 2, we don't need to (re)activate
kono
parents:
diff changeset
151 any declaration: nothing from any local scope is visible. Just
kono
parents:
diff changeset
152 entering the scope of the class containing member function f
kono
parents:
diff changeset
153 reactivates the names of its members, including the class name
kono
parents:
diff changeset
154 itself. */
kono
parents:
diff changeset
155
kono
parents:
diff changeset
156 GCC_METHOD2 (int /* bool */, reactivate_decl,
kono
parents:
diff changeset
157 gcc_decl, /* Argument DECL. */
kono
parents:
diff changeset
158 gcc_decl) /* Argument SCOPE. */
kono
parents:
diff changeset
159
kono
parents:
diff changeset
160 /* Pop the namespace last entered with push_namespace, or class last
kono
parents:
diff changeset
161 entered with push_class, or function last entered with
kono
parents:
diff changeset
162 push_function, restoring the binding level in effect before the
kono
parents:
diff changeset
163 matching push_* call. */
kono
parents:
diff changeset
164
kono
parents:
diff changeset
165 GCC_METHOD0 (int /* bool */, pop_binding_level)
kono
parents:
diff changeset
166
kono
parents:
diff changeset
167 /* Return the NAMESPACE_DECL, TYPE_DECL or FUNCTION_DECL of the
kono
parents:
diff changeset
168 binding level that would be popped by pop_scope. */
kono
parents:
diff changeset
169
kono
parents:
diff changeset
170 GCC_METHOD0 (gcc_decl, get_current_binding_level_decl)
kono
parents:
diff changeset
171
kono
parents:
diff changeset
172 /* Make the current binding level an inline namespace. It must be a
kono
parents:
diff changeset
173 namespace to begin with. It is safe to call this more than once
kono
parents:
diff changeset
174 for the same namespace, but after the first call, subsequent ones
kono
parents:
diff changeset
175 will not return a success status. */
kono
parents:
diff changeset
176
kono
parents:
diff changeset
177 GCC_METHOD0 (int /* bool */, make_namespace_inline)
kono
parents:
diff changeset
178
kono
parents:
diff changeset
179 /* Add USED_NS to the namespaces used by the current binding level.
kono
parents:
diff changeset
180 Use get_current_binding_level_decl to obtain USED_NS's
kono
parents:
diff changeset
181 gcc_decl. */
kono
parents:
diff changeset
182
kono
parents:
diff changeset
183 GCC_METHOD1 (int /* bool */, add_using_namespace,
kono
parents:
diff changeset
184 gcc_decl) /* Argument USED_NS. */
kono
parents:
diff changeset
185
kono
parents:
diff changeset
186 /* Introduce a namespace alias declaration, as in:
kono
parents:
diff changeset
187
kono
parents:
diff changeset
188 namespace foo = [... ::] bar;
kono
parents:
diff changeset
189
kono
parents:
diff changeset
190 After this call, namespace TARGET will be visible as ALIAS within
kono
parents:
diff changeset
191 the current namespace. Get the declaration for TARGET by calling
kono
parents:
diff changeset
192 get_current_binding_level_decl after pushing into it. */
kono
parents:
diff changeset
193
kono
parents:
diff changeset
194 GCC_METHOD2 (int /* bool */, add_namespace_alias,
kono
parents:
diff changeset
195 const char *, /* Argument ALIAS. */
kono
parents:
diff changeset
196 gcc_decl) /* Argument TARGET. */
kono
parents:
diff changeset
197
kono
parents:
diff changeset
198 /* Introduce a using declaration, as in:
kono
parents:
diff changeset
199
kono
parents:
diff changeset
200 using foo::bar;
kono
parents:
diff changeset
201
kono
parents:
diff changeset
202 The TARGET decl names the qualifying scope (foo:: above) and the
kono
parents:
diff changeset
203 identifier (bar), but that does not mean that only TARGET will be
kono
parents:
diff changeset
204 brought into the current scope: all bindings of TARGET's identifier
kono
parents:
diff changeset
205 in the qualifying scope will be brought in.
kono
parents:
diff changeset
206
kono
parents:
diff changeset
207 FLAGS should specify GCC_CP_SYMBOL_USING. If the current scope is
kono
parents:
diff changeset
208 a class scope, visibility flags must be supplied.
kono
parents:
diff changeset
209
kono
parents:
diff changeset
210 Even when TARGET is template dependent, we don't need to specify
kono
parents:
diff changeset
211 whether or not it is a typename: the supplied declaration (that
kono
parents:
diff changeset
212 could be a template-dependent type converted to declaration by
kono
parents:
diff changeset
213 get_type_decl) indicates so. */
kono
parents:
diff changeset
214
kono
parents:
diff changeset
215 GCC_METHOD2 (int /* bool */, add_using_decl,
kono
parents:
diff changeset
216 enum gcc_cp_symbol_kind, /* Argument FLAGS. */
kono
parents:
diff changeset
217 gcc_decl) /* Argument TARGET. */
kono
parents:
diff changeset
218
kono
parents:
diff changeset
219 /* Create a new "decl" in GCC, and bind it in the current binding
kono
parents:
diff changeset
220 level. A decl is a declaration, basically a kind of symbol.
kono
parents:
diff changeset
221
kono
parents:
diff changeset
222 NAME is the name of the new symbol. SYM_KIND is the kind of
kono
parents:
diff changeset
223 symbol being requested. SYM_TYPE is the new symbol's C++ type;
kono
parents:
diff changeset
224 except for labels, where this is not meaningful and should be
kono
parents:
diff changeset
225 zero. If SUBSTITUTION_NAME is not NULL, then a reference to this
kono
parents:
diff changeset
226 decl in the source will later be substituted with a dereference
kono
parents:
diff changeset
227 of a variable of the given name. Otherwise, for symbols having
kono
parents:
diff changeset
228 an address (e.g., functions), ADDRESS is the address. FILENAME
kono
parents:
diff changeset
229 and LINE_NUMBER refer to the symbol's source location. If this
kono
parents:
diff changeset
230 is not known, FILENAME can be NULL and LINE_NUMBER can be 0.
kono
parents:
diff changeset
231 This function returns the new decl.
kono
parents:
diff changeset
232
kono
parents:
diff changeset
233 Use this function to register typedefs, functions and variables to
kono
parents:
diff changeset
234 namespace and local binding levels, and typedefs, member functions
kono
parents:
diff changeset
235 (static or not), and static data members to class binding levels.
kono
parents:
diff changeset
236 Class members must have their access controls specified with
kono
parents:
diff changeset
237 GCC_CP_ACCESS_* flags in SYM_KIND.
kono
parents:
diff changeset
238
kono
parents:
diff changeset
239 Note that, since access controls are disabled, we have no means to
kono
parents:
diff changeset
240 express private, protected and public.
kono
parents:
diff changeset
241
kono
parents:
diff changeset
242 There are various flags that can be set in SYM_KIND to specify
kono
parents:
diff changeset
243 additional semantics. Look for GCC_CP_FLAGs in the definition of
kono
parents:
diff changeset
244 enum gcc_cp_symbol_kind in gcc-cp-interface.h.
kono
parents:
diff changeset
245
kono
parents:
diff changeset
246 In order to define member functions, pass GCC_CP_SYMBOL_FUNCTION in
kono
parents:
diff changeset
247 SYM_KIND, and a function_type for static member functions or a
kono
parents:
diff changeset
248 method type for non-static member functions, including constructors
kono
parents:
diff changeset
249 and destructors. Use build_function_type to create a function
kono
parents:
diff changeset
250 type; for a method type, start by creating a function type without
kono
parents:
diff changeset
251 any compiler-introduced artificial arguments (the implicit this
kono
parents:
diff changeset
252 pointer, and the __in_chrg added to constructors and destructors,
kono
parents:
diff changeset
253 and __vtt_parm added to the former), and then use build_method_type
kono
parents:
diff changeset
254 to create the method type out of the class type and the function
kono
parents:
diff changeset
255 type.
kono
parents:
diff changeset
256
kono
parents:
diff changeset
257 For operator functions, set GCC_CP_FLAG_SPECIAL_FUNCTION in
kono
parents:
diff changeset
258 SYM_KIND, in addition to any other applicable flags, and pass as
kono
parents:
diff changeset
259 NAME a string starting with the two-character mangling for operator
kono
parents:
diff changeset
260 name: "ps" for unary plus, "mL" for multiply and assign, *=; etc.
kono
parents:
diff changeset
261 Use "cv" for type converstion operators (the target type portion
kono
parents:
diff changeset
262 may be omitted, as it is taken from the return type in SYM_TYPE).
kono
parents:
diff changeset
263 For operator"", use "li" followed by the identifier (the mangled
kono
parents:
diff changeset
264 name mandates digits specifying the length of the identifier; if
kono
parents:
diff changeset
265 present, they determine the end of the identifier, otherwise, the
kono
parents:
diff changeset
266 identifier extents to the end of the string, so that "li3_Kme" and
kono
parents:
diff changeset
267 "li_Km" are equivalent).
kono
parents:
diff changeset
268
kono
parents:
diff changeset
269 Constructors and destructors need special care, because for each
kono
parents:
diff changeset
270 constructor and destructor there may be multiple clones defined
kono
parents:
diff changeset
271 internally by the compiler. With build_decl, you can introduce the
kono
parents:
diff changeset
272 base declaration of a constructor or a destructor, setting
kono
parents:
diff changeset
273 GCC_CP_FLAG_SPECIAL_FUNCTION the flag and using names starting with
kono
parents:
diff changeset
274 capital "C" or "D", respectively, followed by a digit (see below),
kono
parents:
diff changeset
275 a blank, or NUL ('\0'). DO NOT supply an ADDRESS or a
kono
parents:
diff changeset
276 SUBSTITUTION_NAME to build_decl, it would be meaningless (and
kono
parents:
diff changeset
277 rejected) for the base declaration; use define_cdtor_clone to
kono
parents:
diff changeset
278 introduce the address of each clone. For constructor templates,
kono
parents:
diff changeset
279 declare the template with build_decl, and then, for each
kono
parents:
diff changeset
280 specialization, introduce it with
kono
parents:
diff changeset
281 build_function_template_specialization, and then define the
kono
parents:
diff changeset
282 addresses of each of its clones with define_cdtor_clone.
kono
parents:
diff changeset
283
kono
parents:
diff changeset
284 NAMEs for GCC_CP_FLAG_SPECIAL_FUNCTION:
kono
parents:
diff changeset
285
kono
parents:
diff changeset
286 NAME meaning
kono
parents:
diff changeset
287 C? constructor base declaration (? may be 1, 2, 4, blank or NUL)
kono
parents:
diff changeset
288 D? destructor base declaration (? may be 0, 1, 2, 4, blank or NUL)
kono
parents:
diff changeset
289 nw operator new
kono
parents:
diff changeset
290 na operator new[]
kono
parents:
diff changeset
291 dl operator delete
kono
parents:
diff changeset
292 da operator delete[]
kono
parents:
diff changeset
293 ps operator + (unary)
kono
parents:
diff changeset
294 ng operator - (unary)
kono
parents:
diff changeset
295 ad operator & (unary)
kono
parents:
diff changeset
296 de operator * (unary)
kono
parents:
diff changeset
297 co operator ~
kono
parents:
diff changeset
298 pl operator +
kono
parents:
diff changeset
299 mi operator -
kono
parents:
diff changeset
300 ml operator *
kono
parents:
diff changeset
301 dv operator /
kono
parents:
diff changeset
302 rm operator %
kono
parents:
diff changeset
303 an operator &
kono
parents:
diff changeset
304 or operator |
kono
parents:
diff changeset
305 eo operator ^
kono
parents:
diff changeset
306 aS operator =
kono
parents:
diff changeset
307 pL operator +=
kono
parents:
diff changeset
308 mI operator -=
kono
parents:
diff changeset
309 mL operator *=
kono
parents:
diff changeset
310 dV operator /=
kono
parents:
diff changeset
311 rM operator %=
kono
parents:
diff changeset
312 aN operator &=
kono
parents:
diff changeset
313 oR operator |=
kono
parents:
diff changeset
314 eO operator ^=
kono
parents:
diff changeset
315 ls operator <<
kono
parents:
diff changeset
316 rs operator >>
kono
parents:
diff changeset
317 lS operator <<=
kono
parents:
diff changeset
318 rS operator >>=
kono
parents:
diff changeset
319 eq operator ==
kono
parents:
diff changeset
320 ne operator !=
kono
parents:
diff changeset
321 lt operator <
kono
parents:
diff changeset
322 gt operator >
kono
parents:
diff changeset
323 le operator <=
kono
parents:
diff changeset
324 ge operator >=
kono
parents:
diff changeset
325 nt operator !
kono
parents:
diff changeset
326 aa operator &&
kono
parents:
diff changeset
327 oo operator ||
kono
parents:
diff changeset
328 pp operator ++
kono
parents:
diff changeset
329 mm operator --
kono
parents:
diff changeset
330 cm operator ,
kono
parents:
diff changeset
331 pm operator ->*
kono
parents:
diff changeset
332 pt operator ->
kono
parents:
diff changeset
333 cl operator ()
kono
parents:
diff changeset
334 ix operator []
kono
parents:
diff changeset
335 qu operator ?
kono
parents:
diff changeset
336 cv operator <T> (conversion operator)
kono
parents:
diff changeset
337 li<id> operator "" <id>
kono
parents:
diff changeset
338
kono
parents:
diff changeset
339 FIXME: How about attributes? */
kono
parents:
diff changeset
340
kono
parents:
diff changeset
341 GCC_METHOD7 (gcc_decl, build_decl,
kono
parents:
diff changeset
342 const char *, /* Argument NAME. */
kono
parents:
diff changeset
343 enum gcc_cp_symbol_kind, /* Argument SYM_KIND. */
kono
parents:
diff changeset
344 gcc_type, /* Argument SYM_TYPE. */
kono
parents:
diff changeset
345 const char *, /* Argument SUBSTITUTION_NAME. */
kono
parents:
diff changeset
346 gcc_address, /* Argument ADDRESS. */
kono
parents:
diff changeset
347 const char *, /* Argument FILENAME. */
kono
parents:
diff changeset
348 unsigned int) /* Argument LINE_NUMBER. */
kono
parents:
diff changeset
349
kono
parents:
diff changeset
350 /* Supply the ADDRESS of one of the multiple clones of constructor or
kono
parents:
diff changeset
351 destructor CDTOR. The clone is specified by NAME, using the
kono
parents:
diff changeset
352 following name mangling conventions:
kono
parents:
diff changeset
353
kono
parents:
diff changeset
354 C1 in-charge constructor
kono
parents:
diff changeset
355 C2 not-in-charge constructor
kono
parents:
diff changeset
356 C4 unified constructor
kono
parents:
diff changeset
357 D0 deleting destructor
kono
parents:
diff changeset
358 D1 in-charge destructor
kono
parents:
diff changeset
359 D2 not-in-charge destructor
kono
parents:
diff changeset
360 D4 unified destructor
kono
parents:
diff changeset
361
kono
parents:
diff changeset
362 The following information is not necessary to use the API.
kono
parents:
diff changeset
363
kono
parents:
diff changeset
364 C1 initializes an instance of the class (rather than of derived
kono
parents:
diff changeset
365 classes), including virtual base classes, whereas C2 initializes a
kono
parents:
diff changeset
366 sub-object (of the given class type) of an instance of some derived
kono
parents:
diff changeset
367 class (or a full object that doesn't have any virtual base
kono
parents:
diff changeset
368 classes).
kono
parents:
diff changeset
369
kono
parents:
diff changeset
370 D0 and D1 destruct an instance of the class, including virtual base
kono
parents:
diff changeset
371 classes, but only the former calls operator delete to release the
kono
parents:
diff changeset
372 object's storage at the end; D2 destructs a sub-object (of the
kono
parents:
diff changeset
373 given class type) of an instance of a derived class (or a full
kono
parents:
diff changeset
374 object that doesn't have any virtual base classes).
kono
parents:
diff changeset
375
kono
parents:
diff changeset
376 The [CD]4 manglings (and symbol definitions) are non-standard, but
kono
parents:
diff changeset
377 GCC uses them in some cases: rather than assuming they are
kono
parents:
diff changeset
378 in-charge or not-in-charge, they test the implicit argument that
kono
parents:
diff changeset
379 the others ignore to tell how to behave. These are used instead of
kono
parents:
diff changeset
380 cloning when we just can't use aliases. */
kono
parents:
diff changeset
381
kono
parents:
diff changeset
382 GCC_METHOD3 (gcc_decl, define_cdtor_clone,
kono
parents:
diff changeset
383 const char *, /* Argument NAME. */
kono
parents:
diff changeset
384 gcc_decl, /* Argument CDTOR. */
kono
parents:
diff changeset
385 gcc_address) /* Argument ADDRESS. */
kono
parents:
diff changeset
386
kono
parents:
diff changeset
387 /* Return the type associated with the given declaration. This is
kono
parents:
diff changeset
388 most useful to obtain the type associated with a forward-declared
kono
parents:
diff changeset
389 class, because it is the gcc_type, rather than the gcc_decl, that
kono
parents:
diff changeset
390 has to be used to build other types, but build_decl returns a
kono
parents:
diff changeset
391 gcc_decl rather than a gcc_type. This call can in theory be used
kono
parents:
diff changeset
392 to obtain the type from any other declaration; it is supposed to
kono
parents:
diff changeset
393 return the same type that was supplied when the declaration was
kono
parents:
diff changeset
394 created. */
kono
parents:
diff changeset
395
kono
parents:
diff changeset
396 GCC_METHOD1 (gcc_type, get_decl_type,
kono
parents:
diff changeset
397 gcc_decl) /* Argument DECL. */
kono
parents:
diff changeset
398
kono
parents:
diff changeset
399 /* Return the declaration for a type. */
kono
parents:
diff changeset
400
kono
parents:
diff changeset
401 GCC_METHOD1 (gcc_decl, get_type_decl,
kono
parents:
diff changeset
402 gcc_type) /* Argument TYPE. */
kono
parents:
diff changeset
403
kono
parents:
diff changeset
404 /* Declare DECL as a friend of the current class scope, if TYPE is
kono
parents:
diff changeset
405 NULL, or of TYPE itself otherwise. DECL may be a function or a
kono
parents:
diff changeset
406 class, be they template generics, template specializations or not
kono
parents:
diff changeset
407 templates. TYPE must be a class type (not a template generic).
kono
parents:
diff changeset
408
kono
parents:
diff changeset
409 The add_friend call cannot introduce a declaration; even if the
kono
parents:
diff changeset
410 friend is first declared as a friend in the source code, the
kono
parents:
diff changeset
411 declaration belongs in the enclosing namespace, so it must be
kono
parents:
diff changeset
412 introduced in that namespace, and the resulting declaration can
kono
parents:
diff changeset
413 then be made a friend.
kono
parents:
diff changeset
414
kono
parents:
diff changeset
415 DECL cannot, however, be a member of a template class generic,
kono
parents:
diff changeset
416 because we have no means to introduce their declarations. This
kono
parents:
diff changeset
417 interface has no notion of definitions for template generics. As a
kono
parents:
diff changeset
418 consequence, users of this interface must introduce each friend
kono
parents:
diff changeset
419 template member specialization separately, i.e., instead of:
kono
parents:
diff changeset
420
kono
parents:
diff changeset
421 template <typename T> friend struct X<T>::M;
kono
parents:
diff changeset
422
kono
parents:
diff changeset
423 they must be declared as if they were:
kono
parents:
diff changeset
424
kono
parents:
diff changeset
425 friend struct X<onetype>::M;
kono
parents:
diff changeset
426 friend struct X<anothertype>::M;
kono
parents:
diff changeset
427 ... for each specialization of X.
kono
parents:
diff changeset
428
kono
parents:
diff changeset
429
kono
parents:
diff changeset
430 Specializations of a template can have each others' members as
kono
parents:
diff changeset
431 friends:
kono
parents:
diff changeset
432
kono
parents:
diff changeset
433 template <typename T> class foo {
kono
parents:
diff changeset
434 int f();
kono
parents:
diff changeset
435 template <typename U> friend int foo<U>::f();
kono
parents:
diff changeset
436 };
kono
parents:
diff changeset
437
kono
parents:
diff changeset
438 It wouldn't always be possible to define all specializations of a
kono
parents:
diff changeset
439 template class before introducing the friend declarations in their
kono
parents:
diff changeset
440 expanded, per-specialization form.
kono
parents:
diff changeset
441
kono
parents:
diff changeset
442 In order to simplify such friend declarations, and to enable
kono
parents:
diff changeset
443 incremental friend declarations as template specializations are
kono
parents:
diff changeset
444 introduced, add_friend can be called after the befriending class is
kono
parents:
diff changeset
445 fully defined, passing it a non-NULL TYPE argument naming the
kono
parents:
diff changeset
446 befriending class type. */
kono
parents:
diff changeset
447
kono
parents:
diff changeset
448 GCC_METHOD2 (int /* bool */, add_friend,
kono
parents:
diff changeset
449 gcc_decl, /* Argument DECL. */
kono
parents:
diff changeset
450 gcc_type) /* Argument TYPE. */
kono
parents:
diff changeset
451
kono
parents:
diff changeset
452 /* Return the type of a pointer to a given base type. */
kono
parents:
diff changeset
453
kono
parents:
diff changeset
454 GCC_METHOD1 (gcc_type, build_pointer_type,
kono
parents:
diff changeset
455 gcc_type) /* Argument BASE_TYPE. */
kono
parents:
diff changeset
456
kono
parents:
diff changeset
457 /* Return the type of a reference to a given base type. */
kono
parents:
diff changeset
458
kono
parents:
diff changeset
459 GCC_METHOD2 (gcc_type, build_reference_type,
kono
parents:
diff changeset
460 gcc_type, /* Argument BASE_TYPE. */
kono
parents:
diff changeset
461 enum gcc_cp_ref_qualifiers) /* Argument RQUALS. */
kono
parents:
diff changeset
462
kono
parents:
diff changeset
463 /* Create a new pointer-to-member type. MEMBER_TYPE is the data
kono
parents:
diff changeset
464 member type, while CLASS_TYPE is the class type containing the data
kono
parents:
diff changeset
465 member. For pointers to member functions, MEMBER_TYPE must be a
kono
parents:
diff changeset
466 method type, and CLASS_TYPE must be specified even though it might
kono
parents:
diff changeset
467 be possible to extract it from the method type. */
kono
parents:
diff changeset
468
kono
parents:
diff changeset
469 GCC_METHOD2 (gcc_type, build_pointer_to_member_type,
kono
parents:
diff changeset
470 gcc_type, /* Argument CLASS_TYPE. */
kono
parents:
diff changeset
471 gcc_type) /* Argument MEMBER_TYPE. */
kono
parents:
diff changeset
472
kono
parents:
diff changeset
473 /* Start a template parameter list scope and enters it, so that
kono
parents:
diff changeset
474 subsequent build_type_template_parameter and
kono
parents:
diff changeset
475 build_value_template_parameter calls create template parameters in
kono
parents:
diff changeset
476 the list. The list is closed by a build_decl call with
kono
parents:
diff changeset
477 GCC_CP_SYMBOL_FUNCTION or GCC_CP_SYMBOL_CLASS, that, when the scope
kono
parents:
diff changeset
478 is a template parameter list, declares a template function or a
kono
parents:
diff changeset
479 template class with the then-closed parameter list. The scope in
kono
parents:
diff changeset
480 which the new declaration is to be introduced by build_decl must be
kono
parents:
diff changeset
481 entered before calling start_template_decl, and build_decl returns
kono
parents:
diff changeset
482 to that scope, from the template parameter list scope, before
kono
parents:
diff changeset
483 introducing the declaration. */
kono
parents:
diff changeset
484
kono
parents:
diff changeset
485 GCC_METHOD0 (int /* bool */, start_template_decl)
kono
parents:
diff changeset
486
kono
parents:
diff changeset
487 /* Build a typename template-parameter (e.g., the T in template
kono
parents:
diff changeset
488 <typename T = X>). Either PACK_P should be nonzero, to indicate an
kono
parents:
diff changeset
489 argument pack (the last argument in a variadic template argument
kono
parents:
diff changeset
490 list, as in template <typename... T>), or DEFAULT_TYPE may be
kono
parents:
diff changeset
491 non-NULL to set the default type argument (e.g. X) for the template
kono
parents:
diff changeset
492 parameter. FILENAME and LINE_NUMBER may specify the source
kono
parents:
diff changeset
493 location in which the template parameter was declared. */
kono
parents:
diff changeset
494
kono
parents:
diff changeset
495 GCC_METHOD5 (gcc_type, build_type_template_parameter,
kono
parents:
diff changeset
496 const char *, /* Argument ID. */
kono
parents:
diff changeset
497 int /* bool */, /* Argument PACK_P. */
kono
parents:
diff changeset
498 gcc_type, /* Argument DEFAULT_TYPE. */
kono
parents:
diff changeset
499 const char *, /* Argument FILENAME. */
kono
parents:
diff changeset
500 unsigned int) /* Argument LINE_NUMBER. */
kono
parents:
diff changeset
501
kono
parents:
diff changeset
502 /* Build a template template-parameter (e.g., the T in template
kono
parents:
diff changeset
503 <template <[...]> class T = X>). DEFAULT_TEMPL may be non-NULL to
kono
parents:
diff changeset
504 set the default type-template argument (e.g. X) for the template
kono
parents:
diff changeset
505 template parameter. FILENAME and LINE_NUMBER may specify the
kono
parents:
diff changeset
506 source location in which the template parameter was declared. */
kono
parents:
diff changeset
507
kono
parents:
diff changeset
508 GCC_METHOD5 (gcc_utempl, build_template_template_parameter,
kono
parents:
diff changeset
509 const char *, /* Argument ID. */
kono
parents:
diff changeset
510 int /* bool */, /* Argument PACK_P. */
kono
parents:
diff changeset
511 gcc_utempl, /* Argument DEFAULT_TEMPL. */
kono
parents:
diff changeset
512 const char *, /* Argument FILENAME. */
kono
parents:
diff changeset
513 unsigned int) /* Argument LINE_NUMBER. */
kono
parents:
diff changeset
514
kono
parents:
diff changeset
515 /* Build a value template-parameter (e.g., the V in template <typename
kono
parents:
diff changeset
516 T, T V> or in template <int V = X>). DEFAULT_VALUE may be non-NULL
kono
parents:
diff changeset
517 to set the default value argument for the template parameter (e.g.,
kono
parents:
diff changeset
518 X). FILENAME and LINE_NUMBER may specify the source location in
kono
parents:
diff changeset
519 which the template parameter was declared. */
kono
parents:
diff changeset
520
kono
parents:
diff changeset
521 GCC_METHOD5 (gcc_decl, build_value_template_parameter,
kono
parents:
diff changeset
522 gcc_type, /* Argument TYPE. */
kono
parents:
diff changeset
523 const char *, /* Argument ID. */
kono
parents:
diff changeset
524 gcc_expr, /* Argument DEFAULT_VALUE. */
kono
parents:
diff changeset
525 const char *, /* Argument FILENAME. */
kono
parents:
diff changeset
526 unsigned int) /* Argument LINE_NUMBER. */
kono
parents:
diff changeset
527
kono
parents:
diff changeset
528 /* Build a template-dependent typename (e.g., typename T::bar or
kono
parents:
diff changeset
529 typename T::template bart<X>). ENCLOSING_TYPE should be the
kono
parents:
diff changeset
530 template-dependent nested name specifier (e.g., T), ID should be
kono
parents:
diff changeset
531 the name of the member of the ENCLOSING_TYPE (e.g., bar or bart),
kono
parents:
diff changeset
532 and TARGS should be non-NULL and specify the template arguments
kono
parents:
diff changeset
533 (e.g. <X>) iff ID is to name a class template.
kono
parents:
diff changeset
534
kono
parents:
diff changeset
535 In this and other calls, a template-dependent nested name specifier
kono
parents:
diff changeset
536 may be a template class parameter (build_type_template_parameter),
kono
parents:
diff changeset
537 a specialization (returned by build_dependent_type_template_id) of
kono
parents:
diff changeset
538 a template template parameter (returned by
kono
parents:
diff changeset
539 build_template_template_parameter) or a member type thereof
kono
parents:
diff changeset
540 (returned by build_dependent_typename itself). */
kono
parents:
diff changeset
541
kono
parents:
diff changeset
542 GCC_METHOD3 (gcc_type, build_dependent_typename,
kono
parents:
diff changeset
543 gcc_type, /* Argument ENCLOSING_TYPE. */
kono
parents:
diff changeset
544 const char *, /* Argument ID. */
kono
parents:
diff changeset
545 const struct gcc_cp_template_args *) /* Argument TARGS. */
kono
parents:
diff changeset
546
kono
parents:
diff changeset
547 /* Build a template-dependent class template (e.g., T::template bart).
kono
parents:
diff changeset
548 ENCLOSING_TYPE should be the template-dependent nested name
kono
parents:
diff changeset
549 specifier (e.g., T), ID should be the name of the class template
kono
parents:
diff changeset
550 member of the ENCLOSING_TYPE (e.g., bart). */
kono
parents:
diff changeset
551
kono
parents:
diff changeset
552 GCC_METHOD2 (gcc_utempl, build_dependent_class_template,
kono
parents:
diff changeset
553 gcc_type, /* Argument ENCLOSING_TYPE. */
kono
parents:
diff changeset
554 const char *) /* Argument ID. */
kono
parents:
diff changeset
555
kono
parents:
diff changeset
556 /* Build a template-dependent type template-id (e.g., T<A>).
kono
parents:
diff changeset
557 TEMPLATE_DECL should be a template template parameter (e.g., the T
kono
parents:
diff changeset
558 in template <template <[...]> class T = X>), and TARGS should
kono
parents:
diff changeset
559 specify the template arguments (e.g. <A>). */
kono
parents:
diff changeset
560
kono
parents:
diff changeset
561 GCC_METHOD2 (gcc_type, build_dependent_type_template_id,
kono
parents:
diff changeset
562 gcc_utempl, /* Argument TEMPLATE_DECL. */
kono
parents:
diff changeset
563 const struct gcc_cp_template_args *) /* Argument TARGS. */
kono
parents:
diff changeset
564
kono
parents:
diff changeset
565 /* Build a template-dependent expression (e.g., S::val or S::template
kono
parents:
diff changeset
566 mtf<X>, or unqualified f or template tf<X>).
kono
parents:
diff changeset
567
kono
parents:
diff changeset
568 ENCLOSING_SCOPE should be a template-dependent nested name
kono
parents:
diff changeset
569 specifier (e.g., T), a resolved namespace or class decl, or NULL
kono
parents:
diff changeset
570 for unqualified names; ID should be the name of the member of the
kono
parents:
diff changeset
571 ENCLOSING_SCOPE (e.g., val or mtf) or unqualified overloaded
kono
parents:
diff changeset
572 function; and TARGS should list template arguments (e.g. <X>) when
kono
parents:
diff changeset
573 mtf or tf are to name a template function, or be NULL otherwise.
kono
parents:
diff changeset
574
kono
parents:
diff changeset
575 Unqualified names and namespace- or class-qualified names can only
kono
parents:
diff changeset
576 resolve to overloaded functions, to be used in contexts that
kono
parents:
diff changeset
577 involve overload resolution that cannot be resolved because of
kono
parents:
diff changeset
578 template-dependent argument or return types, such as call
kono
parents:
diff changeset
579 expressions with template-dependent arguments, conversion
kono
parents:
diff changeset
580 expressions to function types with template-dependent argument
kono
parents:
diff changeset
581 types or the like. Other cases of unqualified or
kono
parents:
diff changeset
582 non-template-dependent-qualified names should NOT use this
kono
parents:
diff changeset
583 function, and use decl_expr to convert the appropriate function or
kono
parents:
diff changeset
584 object declaration to an expression.
kono
parents:
diff changeset
585
kono
parents:
diff changeset
586 If ID is the name of a special member function, FLAGS should be
kono
parents:
diff changeset
587 GCC_CP_SYMBOL_FUNCTION|GCC_CP_FLAG_SPECIAL_FUNCTION, and ID should
kono
parents:
diff changeset
588 be one of the encodings for special member functions documented in
kono
parents:
diff changeset
589 build_decl. Otherwise, FLAGS should be GCC_CP_SYMBOL_MASK, which
kono
parents:
diff changeset
590 suggests the symbol kind is not known (though we know it is not a
kono
parents:
diff changeset
591 type).
kono
parents:
diff changeset
592
kono
parents:
diff changeset
593 If ID denotes a conversion operator, CONV_TYPE should name the
kono
parents:
diff changeset
594 target type of the conversion. Otherwise, CONV_TYPE must be
kono
parents:
diff changeset
595 NULL. */
kono
parents:
diff changeset
596
kono
parents:
diff changeset
597 GCC_METHOD5 (gcc_expr, build_dependent_expr,
kono
parents:
diff changeset
598 gcc_decl, /* Argument ENCLOSING_SCOPE. */
kono
parents:
diff changeset
599 enum gcc_cp_symbol_kind, /* Argument FLAGS. */
kono
parents:
diff changeset
600 const char *, /* Argument NAME. */
kono
parents:
diff changeset
601 gcc_type, /* Argument CONV_TYPE. */
kono
parents:
diff changeset
602 const struct gcc_cp_template_args *) /* Argument TARGS. */
kono
parents:
diff changeset
603
kono
parents:
diff changeset
604 /* Build a gcc_expr for the value VALUE in type TYPE. */
kono
parents:
diff changeset
605
kono
parents:
diff changeset
606 GCC_METHOD2 (gcc_expr, build_literal_expr,
kono
parents:
diff changeset
607 gcc_type, /* Argument TYPE. */
kono
parents:
diff changeset
608 unsigned long) /* Argument VALUE. */
kono
parents:
diff changeset
609
kono
parents:
diff changeset
610 /* Build a gcc_expr that denotes DECL, the declaration of a variable
kono
parents:
diff changeset
611 or function in namespace scope, or of a static member variable or
kono
parents:
diff changeset
612 function. Use QUALIFIED_P to build the operand of unary & so as to
kono
parents:
diff changeset
613 compute a pointer-to-member, rather than a regular pointer. */
kono
parents:
diff changeset
614
kono
parents:
diff changeset
615 GCC_METHOD2 (gcc_expr, build_decl_expr,
kono
parents:
diff changeset
616 gcc_decl, /* Argument DECL. */
kono
parents:
diff changeset
617 int /* bool */) /* Argument QUALIFIED_P. */
kono
parents:
diff changeset
618
kono
parents:
diff changeset
619 /* Build a gcc_expr that denotes the unary operation UNARY_OP applied
kono
parents:
diff changeset
620 to the gcc_expr OPERAND. For non-expr operands, see
kono
parents:
diff changeset
621 unary_type_expr. Besides the UNARY_OP encodings used for operator
kono
parents:
diff changeset
622 names, we support "pp_" for preincrement, and "mm_" for
kono
parents:
diff changeset
623 predecrement, "nx" for noexcept, "tw" for throw, "tr" for rethrow
kono
parents:
diff changeset
624 (pass NULL as the operand), "te" for typeid, "sz" for sizeof, "az"
kono
parents:
diff changeset
625 for alignof, "dl" for delete, "gsdl" for ::delete, "da" for
kono
parents:
diff changeset
626 delete[], "gsda" for ::delete[], "sp" for pack expansion, "sZ" for
kono
parents:
diff changeset
627 sizeof...(function argument pack). */
kono
parents:
diff changeset
628
kono
parents:
diff changeset
629 GCC_METHOD2 (gcc_expr, build_unary_expr,
kono
parents:
diff changeset
630 const char *, /* Argument UNARY_OP. */
kono
parents:
diff changeset
631 gcc_expr) /* Argument OPERAND. */
kono
parents:
diff changeset
632
kono
parents:
diff changeset
633 /* Build a gcc_expr that denotes the binary operation BINARY_OP
kono
parents:
diff changeset
634 applied to gcc_exprs OPERAND1 and OPERAND2. Besides the BINARY_OP
kono
parents:
diff changeset
635 encodings used for operator names, we support "ds" for the operator
kono
parents:
diff changeset
636 token ".*" and "dt" for the operator token ".". When using
kono
parents:
diff changeset
637 operators that take a name as their second operand ("." and "->")
kono
parents:
diff changeset
638 use decl_expr to convert the gcc_decl of the member name to a
kono
parents:
diff changeset
639 gcc_expr, if the member name wasn't created with
kono
parents:
diff changeset
640 e.g. build_dependent_expr. */
kono
parents:
diff changeset
641
kono
parents:
diff changeset
642 GCC_METHOD3 (gcc_expr, build_binary_expr,
kono
parents:
diff changeset
643 const char *, /* Argument BINARY_OP. */
kono
parents:
diff changeset
644 gcc_expr, /* Argument OPERAND1. */
kono
parents:
diff changeset
645 gcc_expr) /* Argument OPERAND2. */
kono
parents:
diff changeset
646
kono
parents:
diff changeset
647 /* Build a gcc_expr that denotes the ternary operation TERNARY_OP
kono
parents:
diff changeset
648 applied to gcc_exprs OPERAND1, OPERAND2 and OPERAND3. The only
kono
parents:
diff changeset
649 supported TERNARY_OP is "qu", for the "?:" operator. */
kono
parents:
diff changeset
650
kono
parents:
diff changeset
651 GCC_METHOD4 (gcc_expr, build_ternary_expr,
kono
parents:
diff changeset
652 const char *, /* Argument TERNARY_OP. */
kono
parents:
diff changeset
653 gcc_expr, /* Argument OPERAND1. */
kono
parents:
diff changeset
654 gcc_expr, /* Argument OPERAND2. */
kono
parents:
diff changeset
655 gcc_expr) /* Argument OPERAND3. */
kono
parents:
diff changeset
656
kono
parents:
diff changeset
657 /* Build a gcc_expr that denotes the unary operation UNARY_OP applied
kono
parents:
diff changeset
658 to the gcc_type OPERAND. Supported unary operations taking types
kono
parents:
diff changeset
659 are "ti" for typeid, "st" for sizeof, "at" for alignof, and "sZ"
kono
parents:
diff changeset
660 for sizeof...(template argument pack). */
kono
parents:
diff changeset
661
kono
parents:
diff changeset
662 GCC_METHOD2 (gcc_expr, build_unary_type_expr,
kono
parents:
diff changeset
663 const char *, /* Argument UNARY_OP. */
kono
parents:
diff changeset
664 gcc_type) /* Argument OPERAND. */
kono
parents:
diff changeset
665
kono
parents:
diff changeset
666 /* Build a gcc_expr that denotes the binary operation BINARY_OP
kono
parents:
diff changeset
667 applied to gcc_type OPERAND1 and gcc_expr OPERAND2. Use this for
kono
parents:
diff changeset
668 all kinds of (single-argument) type casts ("dc", "sc", "cc", "rc"
kono
parents:
diff changeset
669 for dynamic, static, const and reinterpret casts, respectively;
kono
parents:
diff changeset
670 "cv" for functional or C-style casts). */
kono
parents:
diff changeset
671
kono
parents:
diff changeset
672 GCC_METHOD3 (gcc_expr, build_cast_expr,
kono
parents:
diff changeset
673 const char *, /* Argument BINARY_OP. */
kono
parents:
diff changeset
674 gcc_type, /* Argument OPERAND1. */
kono
parents:
diff changeset
675 gcc_expr) /* Argument OPERAND2. */
kono
parents:
diff changeset
676
kono
parents:
diff changeset
677 /* Build a gcc_expr that denotes the conversion of an expression list
kono
parents:
diff changeset
678 VALUES to TYPE, with ("tl") or without ("cv") braces, or a braced
kono
parents:
diff changeset
679 initializer list of unspecified type (e.g., a component of another
kono
parents:
diff changeset
680 braced initializer list; pass "il" for CONV_OP, and NULL for
kono
parents:
diff changeset
681 TYPE). */
kono
parents:
diff changeset
682
kono
parents:
diff changeset
683 GCC_METHOD3 (gcc_expr, build_expression_list_expr,
kono
parents:
diff changeset
684 const char *, /* Argument CONV_OP. */
kono
parents:
diff changeset
685 gcc_type, /* Argument TYPE. */
kono
parents:
diff changeset
686 const struct gcc_cp_function_args *) /* Argument VALUES. */
kono
parents:
diff changeset
687
kono
parents:
diff changeset
688 /* Build a gcc_expr that denotes a new ("nw") or new[] ("na")
kono
parents:
diff changeset
689 expression of TYPE, with or without a GLOBAL_NS qualifier (prefix
kono
parents:
diff changeset
690 the NEW_OP with "gs"), with or without PLACEMENT, with or without
kono
parents:
diff changeset
691 INITIALIZER. If it's not a placement new, PLACEMENT must be NULL
kono
parents:
diff changeset
692 (rather than a zero-length placement arg list). If there's no
kono
parents:
diff changeset
693 specified initializer, INITIALIZER must be NULL; a zero-length arg
kono
parents:
diff changeset
694 list stands for a default initializer. */
kono
parents:
diff changeset
695
kono
parents:
diff changeset
696 GCC_METHOD4 (gcc_expr, build_new_expr,
kono
parents:
diff changeset
697 const char *, /* Argument NEW_OP. */
kono
parents:
diff changeset
698 const struct gcc_cp_function_args *, /* Argument PLACEMENT. */
kono
parents:
diff changeset
699 gcc_type, /* Argument TYPE. */
kono
parents:
diff changeset
700 const struct gcc_cp_function_args *) /* Argument INITIALIZER. */
kono
parents:
diff changeset
701
kono
parents:
diff changeset
702 /* Return a call expression that calls CALLABLE with arguments ARGS.
kono
parents:
diff changeset
703 CALLABLE may be a function, a callable object, a pointer to
kono
parents:
diff changeset
704 function, an unresolved expression, an unresolved overload set, an
kono
parents:
diff changeset
705 object expression combined with a member function overload set or a
kono
parents:
diff changeset
706 pointer-to-member. If QUALIFIED_P, CALLABLE will be interpreted as
kono
parents:
diff changeset
707 a qualified name, preventing virtual function dispatch. */
kono
parents:
diff changeset
708
kono
parents:
diff changeset
709 GCC_METHOD3 (gcc_expr, build_call_expr,
kono
parents:
diff changeset
710 gcc_expr, /* Argument CALLABLE. */
kono
parents:
diff changeset
711 int /* bool */, /* Argument QUALIFIED_P. */
kono
parents:
diff changeset
712 const struct gcc_cp_function_args *) /* Argument ARGS. */
kono
parents:
diff changeset
713
kono
parents:
diff changeset
714 /* Return the type of the gcc_expr OPERAND.
kono
parents:
diff changeset
715 Use this for decltype.
kono
parents:
diff changeset
716 For decltype (auto), pass a NULL OPERAND.
kono
parents:
diff changeset
717
kono
parents:
diff changeset
718 Note: for template-dependent expressions, the result is NULL,
kono
parents:
diff changeset
719 because the type is only computed when template argument
kono
parents:
diff changeset
720 substitution is performed. */
kono
parents:
diff changeset
721
kono
parents:
diff changeset
722 GCC_METHOD1 (gcc_type, get_expr_type,
kono
parents:
diff changeset
723 gcc_expr) /* Argument OPERAND. */
kono
parents:
diff changeset
724
kono
parents:
diff changeset
725 /* Introduce a specialization of a template function.
kono
parents:
diff changeset
726
kono
parents:
diff changeset
727 TEMPLATE_DECL is the template function, and TARGS are the arguments
kono
parents:
diff changeset
728 for the specialization. ADDRESS is the address of the
kono
parents:
diff changeset
729 specialization. FILENAME and LINE_NUMBER specify the source
kono
parents:
diff changeset
730 location associated with the template function specialization. */
kono
parents:
diff changeset
731
kono
parents:
diff changeset
732 GCC_METHOD5 (gcc_decl, build_function_template_specialization,
kono
parents:
diff changeset
733 gcc_decl, /* Argument TEMPLATE_DECL. */
kono
parents:
diff changeset
734 const struct gcc_cp_template_args *, /* Argument TARGS. */
kono
parents:
diff changeset
735 gcc_address, /* Argument ADDRESS. */
kono
parents:
diff changeset
736 const char *, /* Argument FILENAME. */
kono
parents:
diff changeset
737 unsigned int) /* Argument LINE_NUMBER. */
kono
parents:
diff changeset
738
kono
parents:
diff changeset
739 /* Specialize a template class as an incomplete type. A definition
kono
parents:
diff changeset
740 can be supplied later, with start_class_type.
kono
parents:
diff changeset
741
kono
parents:
diff changeset
742 TEMPLATE_DECL is the template class, and TARGS are the arguments
kono
parents:
diff changeset
743 for the specialization. FILENAME and LINE_NUMBER specify the
kono
parents:
diff changeset
744 source location associated with the template class
kono
parents:
diff changeset
745 specialization. */
kono
parents:
diff changeset
746
kono
parents:
diff changeset
747 GCC_METHOD4 (gcc_decl, build_class_template_specialization,
kono
parents:
diff changeset
748 gcc_decl, /* Argument TEMPLATE_DECL. */
kono
parents:
diff changeset
749 const struct gcc_cp_template_args *, /* Argument TARGS. */
kono
parents:
diff changeset
750 const char *, /* Argument FILENAME. */
kono
parents:
diff changeset
751 unsigned int) /* Argument LINE_NUMBER. */
kono
parents:
diff changeset
752
kono
parents:
diff changeset
753 /* Start defining a 'class', 'struct' or 'union' type, entering its
kono
parents:
diff changeset
754 own binding level. Initially it has no fields.
kono
parents:
diff changeset
755
kono
parents:
diff changeset
756 TYPEDECL is the forward-declaration of the type, returned by
kono
parents:
diff changeset
757 build_decl. BASE_CLASSES indicate the base classes of class NAME.
kono
parents:
diff changeset
758 FILENAME and LINE_NUMBER specify the source location associated
kono
parents:
diff changeset
759 with the class definition, should they be different from those of
kono
parents:
diff changeset
760 the forward declaration. */
kono
parents:
diff changeset
761
kono
parents:
diff changeset
762 GCC_METHOD4 (gcc_type, start_class_type,
kono
parents:
diff changeset
763 gcc_decl, /* Argument TYPEDECL. */
kono
parents:
diff changeset
764 const struct gcc_vbase_array *,/* Argument BASE_CLASSES. */
kono
parents:
diff changeset
765 const char *, /* Argument FILENAME. */
kono
parents:
diff changeset
766 unsigned int) /* Argument LINE_NUMBER. */
kono
parents:
diff changeset
767
kono
parents:
diff changeset
768 /* Create a new closure class type, record it as the
kono
parents:
diff changeset
769 DISCRIMINATOR-numbered closure type in the current scope (or
kono
parents:
diff changeset
770 associated with EXTRA_SCOPE, if non-NULL), and enter the closure
kono
parents:
diff changeset
771 type's own binding level. This primitive would sort of combine
kono
parents:
diff changeset
772 build_decl and start_class_type, if they could be used to introduce
kono
parents:
diff changeset
773 a closure type. Initially it has no fields.
kono
parents:
diff changeset
774
kono
parents:
diff changeset
775 FILENAME and LINE_NUMBER specify the source location associated
kono
parents:
diff changeset
776 with the class. EXTRA_SCOPE, if non-NULL, must be a PARM_DECL of
kono
parents:
diff changeset
777 the current function, or a FIELD_DECL of the current class. If it
kono
parents:
diff changeset
778 is NULL, the current scope must be a function. */
kono
parents:
diff changeset
779
kono
parents:
diff changeset
780 GCC_METHOD5 (gcc_type, start_closure_class_type,
kono
parents:
diff changeset
781 int, /* Argument DISCRIMINATOR. */
kono
parents:
diff changeset
782 gcc_decl, /* Argument EXTRA_SCOPE. */
kono
parents:
diff changeset
783 enum gcc_cp_symbol_kind, /* Argument FLAGS. */
kono
parents:
diff changeset
784 const char *, /* Argument FILENAME. */
kono
parents:
diff changeset
785 unsigned int) /* Argument LINE_NUMBER. */
kono
parents:
diff changeset
786
kono
parents:
diff changeset
787 /* Add a non-static data member to the most-recently-started
kono
parents:
diff changeset
788 unfinished struct or union type. FIELD_NAME is the field's name.
kono
parents:
diff changeset
789 FIELD_TYPE is the type of the field. BITSIZE and BITPOS indicate
kono
parents:
diff changeset
790 where in the struct the field occurs. */
kono
parents:
diff changeset
791
kono
parents:
diff changeset
792 GCC_METHOD5 (gcc_decl, build_field,
kono
parents:
diff changeset
793 const char *, /* Argument FIELD_NAME. */
kono
parents:
diff changeset
794 gcc_type, /* Argument FIELD_TYPE. */
kono
parents:
diff changeset
795 enum gcc_cp_symbol_kind, /* Argument FIELD_FLAGS. */
kono
parents:
diff changeset
796 unsigned long, /* Argument BITSIZE. */
kono
parents:
diff changeset
797 unsigned long) /* Argument BITPOS. */
kono
parents:
diff changeset
798
kono
parents:
diff changeset
799 /* After all the fields have been added to a struct, class or union,
kono
parents:
diff changeset
800 the struct or union type must be "finished". This does some final
kono
parents:
diff changeset
801 cleanups in GCC, and pops to the binding level that was in effect
kono
parents:
diff changeset
802 before the matching start_class_type or
kono
parents:
diff changeset
803 start_closure_class_type. */
kono
parents:
diff changeset
804
kono
parents:
diff changeset
805 GCC_METHOD1 (int /* bool */, finish_class_type,
kono
parents:
diff changeset
806 unsigned long) /* Argument SIZE_IN_BYTES. */
kono
parents:
diff changeset
807
kono
parents:
diff changeset
808 /* Create a new 'enum' type, and record it in the current binding
kono
parents:
diff changeset
809 level. The new type initially has no associated constants.
kono
parents:
diff changeset
810
kono
parents:
diff changeset
811 NAME is the enum name. FILENAME and LINE_NUMBER specify its source
kono
parents:
diff changeset
812 location. */
kono
parents:
diff changeset
813
kono
parents:
diff changeset
814 GCC_METHOD5 (gcc_type, start_enum_type,
kono
parents:
diff changeset
815 const char *, /* Argument NAME. */
kono
parents:
diff changeset
816 gcc_type, /* Argument UNDERLYING_INT_TYPE. */
kono
parents:
diff changeset
817 enum gcc_cp_symbol_kind, /* Argument FLAGS. */
kono
parents:
diff changeset
818 const char *, /* Argument FILENAME. */
kono
parents:
diff changeset
819 unsigned int) /* Argument LINE_NUMBER. */
kono
parents:
diff changeset
820
kono
parents:
diff changeset
821 /* Add a new constant to an enum type. NAME is the constant's name
kono
parents:
diff changeset
822 and VALUE is its value. Returns a gcc_decl for the constant. */
kono
parents:
diff changeset
823
kono
parents:
diff changeset
824 GCC_METHOD3 (gcc_decl, build_enum_constant,
kono
parents:
diff changeset
825 gcc_type, /* Argument ENUM_TYPE. */
kono
parents:
diff changeset
826 const char *, /* Argument NAME. */
kono
parents:
diff changeset
827 unsigned long) /* Argument VALUE. */
kono
parents:
diff changeset
828
kono
parents:
diff changeset
829 /* After all the constants have been added to an enum, the type must
kono
parents:
diff changeset
830 be "finished". This does some final cleanups in GCC. */
kono
parents:
diff changeset
831
kono
parents:
diff changeset
832 GCC_METHOD1 (int /* bool */, finish_enum_type,
kono
parents:
diff changeset
833 gcc_type) /* Argument ENUM_TYPE. */
kono
parents:
diff changeset
834
kono
parents:
diff changeset
835 /* Create a new function type. RETURN_TYPE is the type returned by
kono
parents:
diff changeset
836 the function, and ARGUMENT_TYPES is a vector, of length NARGS, of
kono
parents:
diff changeset
837 the argument types. IS_VARARGS is true if the function is
kono
parents:
diff changeset
838 varargs. */
kono
parents:
diff changeset
839
kono
parents:
diff changeset
840 GCC_METHOD3 (gcc_type, build_function_type,
kono
parents:
diff changeset
841 gcc_type, /* Argument RETURN_TYPE. */
kono
parents:
diff changeset
842 const struct gcc_type_array *,/* Argument ARGUMENT_TYPES. */
kono
parents:
diff changeset
843 int /* bool */) /* Argument IS_VARARGS. */
kono
parents:
diff changeset
844
kono
parents:
diff changeset
845 /* Create a variant of a function type with an exception
kono
parents:
diff changeset
846 specification. FUNCTION_TYPE is a function or method type.
kono
parents:
diff changeset
847 EXCEPT_TYPES is an array with the list of exception types. Zero as
kono
parents:
diff changeset
848 the array length implies throw() AKA noexcept(true); NULL as the
kono
parents:
diff changeset
849 pointer to gcc_type_array implies noexcept(false), which is almost
kono
parents:
diff changeset
850 equivalent (but distinguishable by the compiler) to an unspecified
kono
parents:
diff changeset
851 exception list. */
kono
parents:
diff changeset
852
kono
parents:
diff changeset
853 GCC_METHOD2 (gcc_type, build_exception_spec_variant,
kono
parents:
diff changeset
854 gcc_type, /* Argument FUNCTION_TYPE. */
kono
parents:
diff changeset
855 const struct gcc_type_array *)/* Argument EXCEPT_TYPES. */
kono
parents:
diff changeset
856
kono
parents:
diff changeset
857 /* Create a new non-static member function type. FUNC_TYPE is the
kono
parents:
diff changeset
858 method prototype, without the implicit THIS pointer, added as a
kono
parents:
diff changeset
859 pointer to the QUALS-qualified CLASS_TYPE. If CLASS_TYPE is NULL,
kono
parents:
diff changeset
860 this creates a cv-qualified (member) function type not associated
kono
parents:
diff changeset
861 with any specific class, as needed to support "typedef void f(int)
kono
parents:
diff changeset
862 const;", which can later be used to declare member functions and
kono
parents:
diff changeset
863 pointers to member functions. */
kono
parents:
diff changeset
864
kono
parents:
diff changeset
865 GCC_METHOD4 (gcc_type, build_method_type,
kono
parents:
diff changeset
866 gcc_type, /* Argument CLASS_TYPE. */
kono
parents:
diff changeset
867 gcc_type, /* Argument FUNC_TYPE. */
kono
parents:
diff changeset
868 enum gcc_cp_qualifiers, /* Argument QUALS. */
kono
parents:
diff changeset
869 enum gcc_cp_ref_qualifiers) /* Argument RQUALS. */
kono
parents:
diff changeset
870
kono
parents:
diff changeset
871 /* Return a declaration for the (INDEX - 1)th argument of
kono
parents:
diff changeset
872 FUNCTION_DECL, i.e., for the first argument, use zero as the index.
kono
parents:
diff changeset
873 If FUNCTION_DECL is a non-static member function, use -1 to get the
kono
parents:
diff changeset
874 implicit THIS parameter. */
kono
parents:
diff changeset
875
kono
parents:
diff changeset
876 GCC_METHOD2 (gcc_decl, get_function_parameter_decl,
kono
parents:
diff changeset
877 gcc_decl, /* Argument FUNCTION_DECL. */
kono
parents:
diff changeset
878 int) /* Argument INDEX. */
kono
parents:
diff changeset
879
kono
parents:
diff changeset
880 /* Return a lambda expr that constructs an instance of CLOSURE_TYPE.
kono
parents:
diff changeset
881 Only lambda exprs without any captures can be correctly created
kono
parents:
diff changeset
882 through these mechanisms; that's all we need to support lambdas
kono
parents:
diff changeset
883 expressions in default parameters, the only kind that may have to
kono
parents:
diff changeset
884 be introduced through this interface. */
kono
parents:
diff changeset
885
kono
parents:
diff changeset
886 GCC_METHOD1 (gcc_expr, build_lambda_expr,
kono
parents:
diff changeset
887 gcc_type) /* Argument CLOSURE_TYPE. */
kono
parents:
diff changeset
888
kono
parents:
diff changeset
889 /* Return an integer type with the given properties. If BUILTIN_NAME
kono
parents:
diff changeset
890 is non-NULL, it must name a builtin integral type with the given
kono
parents:
diff changeset
891 signedness and size, and that is the type that will be returned. */
kono
parents:
diff changeset
892
kono
parents:
diff changeset
893 GCC_METHOD3 (gcc_type, get_int_type,
kono
parents:
diff changeset
894 int /* bool */, /* Argument IS_UNSIGNED. */
kono
parents:
diff changeset
895 unsigned long, /* Argument SIZE_IN_BYTES. */
kono
parents:
diff changeset
896 const char *) /* Argument BUILTIN_NAME. */
kono
parents:
diff changeset
897
kono
parents:
diff changeset
898 /* Return the 'char' type, a distinct type from both 'signed char' and
kono
parents:
diff changeset
899 'unsigned char' returned by int_type. */
kono
parents:
diff changeset
900
kono
parents:
diff changeset
901 GCC_METHOD0 (gcc_type, get_char_type)
kono
parents:
diff changeset
902
kono
parents:
diff changeset
903 /* Return a floating point type with the given properties. If BUILTIN_NAME
kono
parents:
diff changeset
904 is non-NULL, it must name a builtin integral type with the given
kono
parents:
diff changeset
905 signedness and size, and that is the type that will be returned. */
kono
parents:
diff changeset
906
kono
parents:
diff changeset
907 GCC_METHOD2 (gcc_type, get_float_type,
kono
parents:
diff changeset
908 unsigned long, /* Argument SIZE_IN_BYTES. */
kono
parents:
diff changeset
909 const char *) /* Argument BUILTIN_NAME. */
kono
parents:
diff changeset
910
kono
parents:
diff changeset
911 /* Return the 'void' type. */
kono
parents:
diff changeset
912
kono
parents:
diff changeset
913 GCC_METHOD0 (gcc_type, get_void_type)
kono
parents:
diff changeset
914
kono
parents:
diff changeset
915 /* Return the 'bool' type. */
kono
parents:
diff changeset
916
kono
parents:
diff changeset
917 GCC_METHOD0 (gcc_type, get_bool_type)
kono
parents:
diff changeset
918
kono
parents:
diff changeset
919 /* Return the std::nullptr_t type. */
kono
parents:
diff changeset
920
kono
parents:
diff changeset
921 GCC_METHOD0 (gcc_type, get_nullptr_type)
kono
parents:
diff changeset
922
kono
parents:
diff changeset
923 /* Return the nullptr constant. */
kono
parents:
diff changeset
924
kono
parents:
diff changeset
925 GCC_METHOD0 (gcc_expr, get_nullptr_constant)
kono
parents:
diff changeset
926
kono
parents:
diff changeset
927 /* Create a new array type. If NUM_ELEMENTS is -1, then the array
kono
parents:
diff changeset
928 is assumed to have an unknown length. */
kono
parents:
diff changeset
929
kono
parents:
diff changeset
930 GCC_METHOD2 (gcc_type, build_array_type,
kono
parents:
diff changeset
931 gcc_type, /* Argument ELEMENT_TYPE. */
kono
parents:
diff changeset
932 int) /* Argument NUM_ELEMENTS. */
kono
parents:
diff changeset
933
kono
parents:
diff changeset
934 /* Create a new array type. NUM_ELEMENTS is a template-dependent
kono
parents:
diff changeset
935 expression. */
kono
parents:
diff changeset
936
kono
parents:
diff changeset
937 GCC_METHOD2 (gcc_type, build_dependent_array_type,
kono
parents:
diff changeset
938 gcc_type, /* Argument ELEMENT_TYPE. */
kono
parents:
diff changeset
939 gcc_expr) /* Argument NUM_ELEMENTS. */
kono
parents:
diff changeset
940
kono
parents:
diff changeset
941 /* Create a new variably-sized array type. UPPER_BOUND_NAME is the
kono
parents:
diff changeset
942 name of a local variable that holds the upper bound of the array;
kono
parents:
diff changeset
943 it is one less than the array size. */
kono
parents:
diff changeset
944
kono
parents:
diff changeset
945 GCC_METHOD2 (gcc_type, build_vla_array_type,
kono
parents:
diff changeset
946 gcc_type, /* Argument ELEMENT_TYPE. */
kono
parents:
diff changeset
947 const char *) /* Argument UPPER_BOUND_NAME. */
kono
parents:
diff changeset
948
kono
parents:
diff changeset
949 /* Return a qualified variant of a given base type. QUALIFIERS says
kono
parents:
diff changeset
950 which qualifiers to use; it is composed of or'd together
kono
parents:
diff changeset
951 constants from 'enum gcc_cp_qualifiers'. */
kono
parents:
diff changeset
952
kono
parents:
diff changeset
953 GCC_METHOD2 (gcc_type, build_qualified_type,
kono
parents:
diff changeset
954 gcc_type, /* Argument UNQUALIFIED_TYPE. */
kono
parents:
diff changeset
955 enum gcc_cp_qualifiers) /* Argument QUALIFIERS. */
kono
parents:
diff changeset
956
kono
parents:
diff changeset
957 /* Build a complex type given its element type. */
kono
parents:
diff changeset
958
kono
parents:
diff changeset
959 GCC_METHOD1 (gcc_type, build_complex_type,
kono
parents:
diff changeset
960 gcc_type) /* Argument ELEMENT_TYPE. */
kono
parents:
diff changeset
961
kono
parents:
diff changeset
962 /* Build a vector type given its element type and number of
kono
parents:
diff changeset
963 elements. */
kono
parents:
diff changeset
964
kono
parents:
diff changeset
965 GCC_METHOD2 (gcc_type, build_vector_type,
kono
parents:
diff changeset
966 gcc_type, /* Argument ELEMENT_TYPE. */
kono
parents:
diff changeset
967 int) /* Argument NUM_ELEMENTS. */
kono
parents:
diff changeset
968
kono
parents:
diff changeset
969 /* Build a constant. NAME is the constant's name and VALUE is its
kono
parents:
diff changeset
970 value. FILENAME and LINE_NUMBER refer to the type's source
kono
parents:
diff changeset
971 location. If this is not known, FILENAME can be NULL and
kono
parents:
diff changeset
972 LINE_NUMBER can be 0. */
kono
parents:
diff changeset
973
kono
parents:
diff changeset
974 GCC_METHOD5 (int /* bool */, build_constant,
kono
parents:
diff changeset
975 gcc_type, /* Argument TYPE. */
kono
parents:
diff changeset
976 const char *, /* Argument NAME. */
kono
parents:
diff changeset
977 unsigned long, /* Argument VALUE. */
kono
parents:
diff changeset
978 const char *, /* Argument FILENAME. */
kono
parents:
diff changeset
979 unsigned int) /* Argument LINE_NUMBER. */
kono
parents:
diff changeset
980
kono
parents:
diff changeset
981 /* Emit an error and return an error type object. */
kono
parents:
diff changeset
982
kono
parents:
diff changeset
983 GCC_METHOD1 (gcc_type, error,
kono
parents:
diff changeset
984 const char *) /* Argument MESSAGE. */
kono
parents:
diff changeset
985
kono
parents:
diff changeset
986 /* Declare a static_assert with the given CONDITION and ERRORMSG at
kono
parents:
diff changeset
987 FILENAME:LINE_NUMBER. */
kono
parents:
diff changeset
988
kono
parents:
diff changeset
989 GCC_METHOD4 (int /* bool */, add_static_assert,
kono
parents:
diff changeset
990 gcc_expr, /* Argument CONDITION. */
kono
parents:
diff changeset
991 const char *, /* Argument ERRORMSG. */
kono
parents:
diff changeset
992 const char *, /* Argument FILENAME. */
kono
parents:
diff changeset
993 unsigned int) /* Argument LINE_NUMBER. */
kono
parents:
diff changeset
994
kono
parents:
diff changeset
995 #if 0
kono
parents:
diff changeset
996
kono
parents:
diff changeset
997 /* FIXME: We don't want to expose the internal implementation detail
kono
parents:
diff changeset
998 that default parms are stored in function types, and it's not clear
kono
parents:
diff changeset
999 how this or other approaches would interact with the type sharing
kono
parents:
diff changeset
1000 of e.g. ctor clones, so we're leaving this out, since default args
kono
parents:
diff changeset
1001 are not even present in debug information anyway. Besides, the set
kono
parents:
diff changeset
1002 of default args for a function may grow within its scope, and vary
kono
parents:
diff changeset
1003 independently in other scopes. */
kono
parents:
diff changeset
1004
kono
parents:
diff changeset
1005 /* Create a modified version of a function type that has default
kono
parents:
diff changeset
1006 values for some of its arguments. The returned type should ONLY be
kono
parents:
diff changeset
1007 used to define functions or methods, never to declare parameters,
kono
parents:
diff changeset
1008 variables, types or the like.
kono
parents:
diff changeset
1009
kono
parents:
diff changeset
1010 DEFAULTS must have at most as many N_ELEMENTS as there are
kono
parents:
diff changeset
1011 arguments without default values in FUNCTION_TYPE. Say, if
kono
parents:
diff changeset
1012 FUNCTION_TYPE has an argument list such as (T1, T2, T3, T4 = V0)
kono
parents:
diff changeset
1013 and DEFAULTS has 2 elements (V1, V2), the returned type will have
kono
parents:
diff changeset
1014 the following argument list: (T1, T2 = V1, T3 = V2, T4 = V0).
kono
parents:
diff changeset
1015
kono
parents:
diff changeset
1016 Any NULL expressions in DEFAULTS will be marked as deferred, and
kono
parents:
diff changeset
1017 they should be filled in with set_deferred_function_default_args. */
kono
parents:
diff changeset
1018
kono
parents:
diff changeset
1019 GCC_METHOD2 (gcc_type, add_function_default_args,
kono
parents:
diff changeset
1020 gcc_type, /* Argument FUNCTION_TYPE. */
kono
parents:
diff changeset
1021 const struct gcc_cp_function_args *) /* Argument DEFAULTS. */
kono
parents:
diff changeset
1022
kono
parents:
diff changeset
1023 /* Fill in the first deferred default args in FUNCTION_DECL with the
kono
parents:
diff changeset
1024 expressions given in DEFAULTS. This can be used when the
kono
parents:
diff changeset
1025 declaration of a parameter is needed to create a default
kono
parents:
diff changeset
1026 expression, such as taking the size of an earlier parameter, or
kono
parents:
diff changeset
1027 building a lambda expression in the parameter's context. */
kono
parents:
diff changeset
1028
kono
parents:
diff changeset
1029 GCC_METHOD2 (int /* bool */, set_deferred_function_default_args,
kono
parents:
diff changeset
1030 gcc_decl, /* Argument FUNCTION_DECL. */
kono
parents:
diff changeset
1031 const struct gcc_cp_function_args *) /* Argument DEFAULTS. */
kono
parents:
diff changeset
1032
kono
parents:
diff changeset
1033 #endif
kono
parents:
diff changeset
1034
kono
parents:
diff changeset
1035
kono
parents:
diff changeset
1036 /* When you add entry points, add them at the end, so that the new API
kono
parents:
diff changeset
1037 version remains compatible with the old version.
kono
parents:
diff changeset
1038
kono
parents:
diff changeset
1039 The following conventions have been observed as to naming entry points:
kono
parents:
diff changeset
1040
kono
parents:
diff changeset
1041 - build_* creates (and maybe records) something and returns it;
kono
parents:
diff changeset
1042 - add_* creates and records something, but doesn't return it;
kono
parents:
diff changeset
1043 - get_* obtains something without creating it;
kono
parents:
diff changeset
1044 - start_* marks the beginning of a compound (type, list, ...);
kono
parents:
diff changeset
1045 - finish_* completes the compound when needed.
kono
parents:
diff changeset
1046
kono
parents:
diff changeset
1047 Entry points that return an int (bool) and don't have a return value
kono
parents:
diff changeset
1048 specification return nonzero (true) on success and zero (false) on
kono
parents:
diff changeset
1049 failure. This is in line with libcc1's conventions of returning a
kono
parents:
diff changeset
1050 zero-initialized value in case of e.g. a transport error. */