Line data Source code
1 : /* Some code common to C++ and ObjC++ front ends.
2 : Copyright (C) 2004-2026 Free Software Foundation, Inc.
3 : Contributed by Ziemowit Laski <zlaski@apple.com>
4 :
5 : This file is part of GCC.
6 :
7 : GCC is free software; you can redistribute it and/or modify it under
8 : the terms of the GNU General Public License as published by the Free
9 : Software Foundation; either version 3, or (at your option) any later
10 : version.
11 :
12 : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 : WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 : FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 : for more details.
16 :
17 : You should have received a copy of the GNU General Public License
18 : along with GCC; see the file COPYING3. If not see
19 : <http://www.gnu.org/licenses/>. */
20 :
21 : #include "config.h"
22 : #include "system.h"
23 : #include "coretypes.h"
24 : #include "cp-tree.h"
25 : #include "cp-objcp-common.h"
26 : #include "c-family/c-common.h"
27 : #include "dwarf2.h"
28 : #include "stringpool.h"
29 :
30 : /* Class to determine whether a given C++ language feature is available.
31 : Used to implement __has_{feature,extension}. */
32 :
33 : struct cp_feature_selector
34 : {
35 : enum
36 : {
37 : DIALECT,
38 : FLAG
39 : } kind;
40 :
41 : enum class result
42 : {
43 : NONE,
44 : EXT,
45 : FEAT
46 : };
47 :
48 : union
49 : {
50 : const int *enable_flag;
51 : struct {
52 : enum cxx_dialect feat;
53 : enum cxx_dialect ext;
54 : } dialect;
55 : };
56 :
57 : constexpr cp_feature_selector (const int *flag)
58 : : kind (FLAG), enable_flag (flag) {}
59 : constexpr cp_feature_selector (enum cxx_dialect feat,
60 : enum cxx_dialect ext)
61 : : kind (DIALECT), dialect{feat, ext} {}
62 : constexpr cp_feature_selector (enum cxx_dialect feat)
63 : : cp_feature_selector (feat, feat) {}
64 :
65 : inline result has_feature () const;
66 : };
67 :
68 : /* Check whether this language feature is available as a feature,
69 : extension, or not at all. */
70 :
71 : cp_feature_selector::result
72 1031472 : cp_feature_selector::has_feature () const
73 : {
74 1031472 : switch (kind)
75 : {
76 967005 : case DIALECT:
77 967005 : if (cxx_dialect >= dialect.feat)
78 : return result::FEAT;
79 60003 : else if (cxx_dialect >= dialect.ext)
80 : return result::EXT;
81 : else
82 51982 : return result::NONE;
83 64467 : case FLAG:
84 64467 : return *enable_flag ? result::FEAT : result::NONE;
85 : }
86 :
87 0 : gcc_unreachable ();
88 : }
89 :
90 : /* Information about a C++ language feature which can be queried
91 : through __has_{feature,extension}. IDENT is the name of the feature,
92 : and SELECTOR encodes how to compute whether the feature is available. */
93 :
94 : struct cp_feature_info
95 : {
96 : const char *ident;
97 : cp_feature_selector selector;
98 : };
99 :
100 : /* Table of features for __has_{feature,extension}. */
101 :
102 : static constexpr cp_feature_info cp_feature_table[] =
103 : {
104 : { "cxx_exceptions", &flag_exceptions },
105 : { "cxx_rtti", &flag_rtti },
106 : { "cxx_access_control_sfinae", { cxx11, cxx98 } },
107 : { "cxx_alias_templates", cxx11 },
108 : { "cxx_alignas", cxx11 },
109 : { "cxx_alignof", cxx11 },
110 : { "cxx_attributes", cxx11 },
111 : { "cxx_constexpr", cxx11 },
112 : { "cxx_decltype", cxx11 },
113 : { "cxx_decltype_incomplete_return_types", cxx11 },
114 : { "cxx_default_function_template_args", cxx11 },
115 : { "cxx_defaulted_functions", cxx11 },
116 : { "cxx_delegating_constructors", cxx11 },
117 : { "cxx_deleted_functions", cxx11 },
118 : { "cxx_explicit_conversions", cxx11 },
119 : { "cxx_generalized_initializers", cxx11 },
120 : { "cxx_implicit_moves", cxx11 },
121 : { "cxx_inheriting_constructors", cxx11 },
122 : { "cxx_inline_namespaces", { cxx11, cxx98 } },
123 : { "cxx_lambdas", cxx11 },
124 : { "cxx_local_type_template_args", cxx11 },
125 : { "cxx_noexcept", cxx11 },
126 : { "cxx_nonstatic_member_init", cxx11 },
127 : { "cxx_nullptr", cxx11 },
128 : { "cxx_override_control", cxx11 },
129 : { "cxx_reference_qualified_functions", cxx11 },
130 : { "cxx_range_for", cxx11 },
131 : { "cxx_raw_string_literals", cxx11 },
132 : { "cxx_rvalue_references", cxx11 },
133 : { "cxx_static_assert", cxx11 },
134 : { "cxx_thread_local", cxx11 },
135 : { "cxx_auto_type", cxx11 },
136 : { "cxx_strong_enums", cxx11 },
137 : { "cxx_trailing_return", cxx11 },
138 : { "cxx_unicode_literals", cxx11 },
139 : { "cxx_unrestricted_unions", cxx11 },
140 : { "cxx_user_literals", cxx11 },
141 : { "cxx_variadic_templates", { cxx11, cxx98 } },
142 : { "cxx_binary_literals", { cxx14, cxx98 } },
143 : { "cxx_contextual_conversions", { cxx14, cxx98 } },
144 : { "cxx_decltype_auto", cxx14 },
145 : { "cxx_aggregate_nsdmi", cxx14 },
146 : { "cxx_init_captures", { cxx14, cxx11 } },
147 : { "cxx_generic_lambdas", cxx14 },
148 : { "cxx_relaxed_constexpr", cxx14 },
149 : { "cxx_return_type_deduction", cxx14 },
150 : { "cxx_variable_templates", cxx14 },
151 : { "modules", &flag_modules },
152 : };
153 :
154 : /* Register C++ language features for __has_{feature,extension}. */
155 :
156 : void
157 21489 : cp_register_features ()
158 : {
159 21489 : using result = cp_feature_selector::result;
160 :
161 1052961 : for (unsigned i = 0; i < ARRAY_SIZE (cp_feature_table); i++)
162 : {
163 1031472 : const cp_feature_info *info = cp_feature_table + i;
164 1031472 : const auto res = info->selector.has_feature ();
165 1031472 : if (res == result::NONE)
166 74883 : continue;
167 :
168 956589 : c_common_register_feature (info->ident, res == result::FEAT);
169 : }
170 21489 : }
171 :
172 : /* Special routine to get the alias set for C++. */
173 :
174 : alias_set_type
175 375232826 : cxx_get_alias_set (tree t)
176 : {
177 375232826 : if (IS_FAKE_BASE_TYPE (t))
178 : /* The base variant of a type must be in the same alias set as the
179 : complete type. */
180 54928 : return get_alias_set (TYPE_CONTEXT (t));
181 :
182 375177898 : return c_common_get_alias_set (t);
183 : }
184 :
185 : /* Called from check_global_declaration. */
186 :
187 : bool
188 2962 : cxx_warn_unused_global_decl (const_tree decl)
189 : {
190 2962 : if (TREE_CODE (decl) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (decl))
191 : return false;
192 93 : if (DECL_IN_SYSTEM_HEADER (decl))
193 : return false;
194 :
195 : return true;
196 : }
197 :
198 : /* Langhook for tree_size: determine size of our 'x' and 'c' nodes. */
199 : size_t
200 2731899880 : cp_tree_size (enum tree_code code)
201 : {
202 2731899880 : gcc_checking_assert (code >= NUM_TREE_CODES);
203 2731899880 : switch (code)
204 : {
205 : case PTRMEM_CST: return sizeof (ptrmem_cst);
206 : case BASELINK: return sizeof (tree_baselink);
207 : case TEMPLATE_PARM_INDEX: return sizeof (template_parm_index);
208 : case DEFERRED_PARSE: return sizeof (tree_deferred_parse);
209 : case DEFERRED_NOEXCEPT: return sizeof (tree_deferred_noexcept);
210 : case OVERLOAD: return sizeof (tree_overload);
211 : case STATIC_ASSERT: return sizeof (tree_static_assert);
212 : #if 0
213 : /* This would match cp_common_init_ts, but breaks GC because
214 : tree_node_structure_for_code returns TS_TYPE_NON_COMMON for all
215 : types. */
216 : case UNBOUND_CLASS_TEMPLATE:
217 : case TYPE_ARGUMENT_PACK: return sizeof (tree_type_common);
218 : #endif
219 : case ARGUMENT_PACK_SELECT: return sizeof (tree_argument_pack_select);
220 : case TRAIT_EXPR: return sizeof (tree_trait_expr);
221 1777745 : case LAMBDA_EXPR: return sizeof (tree_lambda_expr);
222 : case TEMPLATE_INFO: return sizeof (tree_template_info);
223 : case CONSTRAINT_INFO: return sizeof (tree_constraint_info);
224 : case USERDEF_LITERAL: return sizeof (tree_userdef_literal);
225 224846709 : case TEMPLATE_DECL: return sizeof (tree_template_decl);
226 : case ASSERTION_STMT: return sizeof (tree_exp);
227 : case PRECONDITION_STMT: return sizeof (tree_exp);
228 : case POSTCONDITION_STMT: return sizeof (tree_exp);
229 : case TU_LOCAL_ENTITY: return sizeof (tree_tu_local_entity);
230 816422976 : default:
231 816422976 : switch (TREE_CODE_CLASS (code))
232 : {
233 : case tcc_declaration: return sizeof (tree_decl_non_common);
234 758923210 : case tcc_type: return sizeof (tree_type_non_common);
235 0 : default: gcc_unreachable ();
236 : }
237 : }
238 : /* NOTREACHED */
239 : }
240 :
241 : /* Returns true if T is a variably modified type, in the sense of C99.
242 : FN is as passed to variably_modified_p.
243 : This routine needs only check cases that cannot be handled by the
244 : language-independent logic in tree.cc. */
245 :
246 : bool
247 2334869131 : cp_var_mod_type_p (tree type, tree fn)
248 : {
249 : /* If TYPE is a pointer-to-member, it is variably modified if either
250 : the class or the member are variably modified. */
251 2334869131 : if (TYPE_PTRMEM_P (type))
252 1571478 : return (variably_modified_type_p (TYPE_PTRMEM_CLASS_TYPE (type), fn)
253 1571478 : || variably_modified_type_p (TYPE_PTRMEM_POINTED_TO_TYPE (type),
254 : fn));
255 :
256 : /* All other types are not variably modified. */
257 : return false;
258 : }
259 :
260 : /* This compares two types for equivalence ("compatible" in C-based languages).
261 : This routine should only return 1 if it is sure. It should not be used
262 : in contexts where erroneously returning 0 causes problems. */
263 :
264 : int
265 1371902 : cxx_types_compatible_p (tree x, tree y)
266 : {
267 1371902 : return same_type_ignoring_top_level_qualifiers_p (x, y);
268 : }
269 :
270 : static GTY((cache)) type_tree_cache_map *debug_type_map;
271 :
272 : /* Return a type to use in the debug info instead of TYPE, or NULL_TREE to
273 : keep TYPE. */
274 :
275 : tree
276 1360086265 : cp_get_debug_type (const_tree type)
277 : {
278 1360086265 : tree dtype = NULL_TREE;
279 :
280 1360086265 : if (TYPE_PTRMEMFUNC_P (type) && !typedef_variant_p (type))
281 240106 : dtype = build_offset_type (TYPE_PTRMEMFUNC_OBJECT_TYPE (type),
282 240106 : TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (type)));
283 :
284 : /* We cannot simply return the debug type here because the function uses
285 : the type canonicalization hashtable, which is GC-ed, so its behavior
286 : depends on the actual collection points. Since we are building these
287 : types on the fly for the debug info only, they would not be attached
288 : to any GC root and always be swept, so we would make the contents of
289 : the debug info depend on the collection points. */
290 1360086265 : if (dtype)
291 : {
292 240106 : tree ktype = const_cast<tree> (type);
293 471013 : if (tree *slot = hash_map_safe_get (debug_type_map, ktype))
294 210794 : return *slot;
295 29312 : hash_map_safe_put<hm_ggc> (debug_type_map, ktype, dtype);
296 : }
297 :
298 : return dtype;
299 : }
300 :
301 : /* Return -1 if dwarf ATTR shouldn't be added for DECL, or the attribute
302 : value otherwise. */
303 : int
304 630201956 : cp_decl_dwarf_attribute (const_tree decl, int attr)
305 : {
306 630201956 : if (decl == NULL_TREE)
307 : return -1;
308 :
309 630201956 : switch (attr)
310 : {
311 96135741 : case DW_AT_explicit:
312 96135741 : if (TREE_CODE (decl) == FUNCTION_DECL
313 96135741 : && DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl))
314 192271397 : && DECL_NONCONVERTING_P (decl))
315 2953481 : return 1;
316 : break;
317 :
318 96135723 : case DW_AT_deleted:
319 96135723 : if (TREE_CODE (decl) == FUNCTION_DECL
320 96135723 : && DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl))
321 192271361 : && DECL_DELETED_FN (decl))
322 3190946 : return 1;
323 : break;
324 :
325 97417991 : case DW_AT_defaulted:
326 97417991 : if (TREE_CODE (decl) == FUNCTION_DECL
327 97417991 : && DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl))
328 194835897 : && DECL_DEFAULTED_FN (decl))
329 : {
330 7789163 : if (DECL_DEFAULTED_IN_CLASS_P (decl))
331 : return DW_DEFAULTED_in_class;
332 :
333 1815130 : if (DECL_DEFAULTED_OUTSIDE_CLASS_P (decl))
334 589 : return DW_DEFAULTED_out_of_class;
335 : }
336 : break;
337 :
338 64100568 : case DW_AT_const_expr:
339 64100568 : if (VAR_OR_FUNCTION_DECL_P (decl) && DECL_DECLARED_CONSTEXPR_P (decl))
340 58883247 : return 1;
341 : break;
342 :
343 96135723 : case DW_AT_reference:
344 96135723 : if (TREE_CODE (decl) == FUNCTION_DECL
345 96135723 : && DECL_IOBJ_MEMBER_FUNCTION_P (decl)
346 83037371 : && FUNCTION_REF_QUALIFIED (TREE_TYPE (decl))
347 96256984 : && !FUNCTION_RVALUE_QUALIFIED (TREE_TYPE (decl)))
348 40981 : return 1;
349 : break;
350 :
351 96135723 : case DW_AT_rvalue_reference:
352 96135723 : if (TREE_CODE (decl) == FUNCTION_DECL
353 96135723 : && DECL_IOBJ_MEMBER_FUNCTION_P (decl)
354 83037371 : && FUNCTION_REF_QUALIFIED (TREE_TYPE (decl))
355 96256984 : && FUNCTION_RVALUE_QUALIFIED (TREE_TYPE (decl)))
356 80280 : return 1;
357 : break;
358 :
359 83496359 : case DW_AT_inline:
360 83496359 : if (VAR_P (decl) && DECL_INLINE_VAR_P (decl))
361 : {
362 74616644 : if (DECL_VAR_DECLARED_INLINE_P (decl))
363 : return DW_INL_declared_inlined;
364 : else
365 39168254 : return DW_INL_inlined;
366 : }
367 : break;
368 :
369 644128 : case DW_AT_export_symbols:
370 644128 : if (TREE_CODE (decl) == NAMESPACE_DECL
371 644128 : && (DECL_NAMESPACE_INLINE_P (decl)
372 384820 : || (DECL_NAME (decl) == NULL_TREE && dwarf_version >= 5)))
373 260475 : return 1;
374 : break;
375 :
376 : default:
377 : break;
378 : }
379 :
380 : return -1;
381 : }
382 :
383 : /* Return -1 if dwarf ATTR shouldn't be added for TYPE, or the attribute
384 : value otherwise. */
385 : int
386 768256 : cp_type_dwarf_attribute (const_tree type, int attr)
387 : {
388 768256 : if (type == NULL_TREE)
389 : return -1;
390 :
391 768256 : switch (attr)
392 : {
393 290523 : case DW_AT_reference:
394 290523 : if (FUNC_OR_METHOD_TYPE_P (type)
395 290523 : && FUNCTION_REF_QUALIFIED (type)
396 290651 : && !FUNCTION_RVALUE_QUALIFIED (type))
397 90 : return 1;
398 : break;
399 :
400 290523 : case DW_AT_rvalue_reference:
401 290523 : if (FUNC_OR_METHOD_TYPE_P (type)
402 290523 : && FUNCTION_REF_QUALIFIED (type)
403 290651 : && FUNCTION_RVALUE_QUALIFIED (type))
404 38 : return 1;
405 : break;
406 :
407 187210 : case DW_AT_export_symbols:
408 187210 : if (ANON_AGGR_TYPE_P (type))
409 187210 : return 1;
410 : break;
411 :
412 : default:
413 : break;
414 : }
415 :
416 : return -1;
417 : }
418 :
419 : /* Return the unit size of TYPE without reusable tail padding. */
420 :
421 : tree
422 84507 : cp_unit_size_without_reusable_padding (tree type)
423 : {
424 84507 : if (CLASS_TYPE_P (type))
425 84507 : return CLASSTYPE_SIZE_UNIT (type);
426 0 : return TYPE_SIZE_UNIT (type);
427 : }
428 :
429 : /* Returns type corresponding to FIELD's type when FIELD is a C++ base class
430 : i.e., type without virtual base classes or tail padding. Returns
431 : NULL_TREE otherwise. */
432 :
433 : tree
434 2311 : cp_classtype_as_base (const_tree field)
435 : {
436 2311 : if (DECL_FIELD_IS_BASE (field))
437 : {
438 195 : tree type = TREE_TYPE (field);
439 195 : if (TYPE_LANG_SPECIFIC (type))
440 188 : return CLASSTYPE_AS_BASE (type);
441 : }
442 : return NULL_TREE;
443 : }
444 :
445 : /* Stubs to keep c-opts.cc happy. */
446 : void
447 96030 : push_file_scope (void)
448 : {
449 96030 : }
450 :
451 : void
452 95897 : pop_file_scope (void)
453 : {
454 95897 : }
455 :
456 : /* c-pragma.cc needs to query whether a decl has extern "C" linkage. */
457 : bool
458 63569909 : has_c_linkage (const_tree decl)
459 : {
460 63569909 : return DECL_EXTERN_C_P (decl);
461 : }
462 :
463 : /* Return true if stmt can fall through. Used by block_may_fallthru
464 : default case. */
465 :
466 : bool
467 8088533 : cxx_block_may_fallthru (const_tree stmt)
468 : {
469 8088533 : switch (TREE_CODE (stmt))
470 : {
471 3522969 : case EXPR_STMT:
472 3522969 : return block_may_fallthru (EXPR_STMT_EXPR (stmt));
473 :
474 : case THROW_EXPR:
475 : return false;
476 :
477 1023693 : case IF_STMT:
478 1023693 : if (IF_STMT_CONSTEXPR_P (stmt))
479 : {
480 801 : if (integer_nonzerop (IF_COND (stmt)))
481 69 : return block_may_fallthru (THEN_CLAUSE (stmt));
482 732 : if (integer_zerop (IF_COND (stmt)))
483 21 : return block_may_fallthru (ELSE_CLAUSE (stmt));
484 : }
485 1023603 : if (block_may_fallthru (THEN_CLAUSE (stmt)))
486 : return true;
487 173507 : return block_may_fallthru (ELSE_CLAUSE (stmt));
488 :
489 11 : case CLEANUP_STMT:
490 : /* Just handle the try/finally cases. */
491 11 : if (!CLEANUP_EH_ONLY (stmt))
492 : {
493 11 : return (block_may_fallthru (CLEANUP_BODY (stmt))
494 19 : && block_may_fallthru (CLEANUP_EXPR (stmt)));
495 : }
496 : return true;
497 :
498 3531670 : default:
499 3531670 : return c_block_may_fallthru (stmt);
500 : }
501 : }
502 :
503 : /* Return the list of decls in the global namespace. */
504 :
505 : tree
506 0 : cp_get_global_decls ()
507 : {
508 0 : return NAMESPACE_LEVEL (global_namespace)->names;
509 : }
510 :
511 : /* Push DECL into the current (namespace) scope. */
512 :
513 : tree
514 1944848 : cp_pushdecl (tree decl)
515 : {
516 1944848 : DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
517 1944848 : return pushdecl (decl);
518 : }
519 :
520 : /* Get the global value binding of NAME. Called directly from
521 : c-common.cc, not via a hook. */
522 :
523 : tree
524 3409147 : identifier_global_value (tree name)
525 : {
526 3409147 : return get_global_binding (name);
527 : }
528 :
529 : /* Similarly, but return struct/class/union NAME instead. */
530 :
531 : tree
532 39 : identifier_global_tag (tree name)
533 : {
534 39 : tree ret = lookup_qualified_name (global_namespace, name, LOOK_want::TYPE,
535 : /*complain*/false);
536 39 : if (ret == error_mark_node)
537 3 : return NULL_TREE;
538 : return ret;
539 : }
540 :
541 : /* Returns non-zero (result of __has_builtin) if NAME refers to a built-in
542 : function or function-like operator. */
543 :
544 : int
545 6460483 : names_builtin_p (const char *name)
546 : {
547 6460483 : tree id = get_identifier (name);
548 6460483 : if (tree binding = get_global_binding (id))
549 : {
550 1535757 : if (TREE_CODE (binding) == FUNCTION_DECL
551 1535757 : && DECL_IS_UNDECLARED_BUILTIN (binding))
552 : return 1;
553 :
554 : /* Handle the case when an overload for a built-in name exists. */
555 9 : if (TREE_CODE (binding) != OVERLOAD)
556 : return 0;
557 :
558 9 : for (ovl_iterator it (binding); it; ++it)
559 : {
560 9 : tree decl = *it;
561 9 : if (DECL_IS_UNDECLARED_BUILTIN (decl))
562 9 : return 1;
563 : }
564 : }
565 :
566 : /* Check for built-in traits. */
567 4924726 : if (IDENTIFIER_TRAIT_P (id))
568 : return 1;
569 :
570 : /* Also detect common reserved C++ words that aren't strictly built-in
571 : functions. */
572 216215 : switch (C_RID_CODE (id))
573 : {
574 : case RID_ADDRESSOF:
575 : case RID_BUILTIN_CONVERTVECTOR:
576 : case RID_BUILTIN_HAS_ATTRIBUTE:
577 : case RID_BUILTIN_SHUFFLE:
578 : case RID_BUILTIN_SHUFFLEVECTOR:
579 : case RID_BUILTIN_LAUNDER:
580 : case RID_BUILTIN_ASSOC_BARRIER:
581 : case RID_BUILTIN_BIT_CAST:
582 : case RID_OFFSETOF:
583 : case RID_VA_ARG:
584 : case RID_C23_VA_START:
585 : return 1;
586 : case RID_BUILTIN_OPERATOR_NEW:
587 : case RID_BUILTIN_OPERATOR_DELETE:
588 : return 201802L;
589 : default:
590 : break;
591 : }
592 :
593 : return 0;
594 : }
595 :
596 : /* Register c++-specific dumps. */
597 :
598 : void
599 97488 : cp_register_dumps (gcc::dump_manager *dumps)
600 : {
601 194976 : class_dump_id = dumps->dump_register
602 97488 : (".class", "lang-class", "lang-class", DK_lang, OPTGROUP_NONE, false);
603 :
604 194976 : module_dump_id = dumps->dump_register
605 97488 : (".module", "lang-module", "lang-module", DK_lang, OPTGROUP_NONE, false);
606 :
607 194976 : raw_dump_id = dumps->dump_register
608 97488 : (".raw", "lang-raw", "lang-raw", DK_lang, OPTGROUP_NONE, false);
609 194976 : coro_dump_id = dumps->dump_register
610 97488 : (".coro", "lang-coro", "lang-coro", DK_lang, OPTGROUP_NONE, false);
611 194976 : tinst_dump_id = dumps->dump_register
612 97488 : (".tinst", "lang-tinst", "lang-tinst", DK_lang, OPTGROUP_NONE, false);
613 97488 : }
614 :
615 : void
616 97488 : cp_common_init_ts (void)
617 : {
618 : /* With type. */
619 97488 : MARK_TS_TYPED (PTRMEM_CST);
620 97488 : MARK_TS_TYPED (LAMBDA_EXPR);
621 97488 : MARK_TS_TYPED (TYPE_ARGUMENT_PACK);
622 97488 : MARK_TS_TYPED (TRAIT_EXPR);
623 :
624 : /* Random new trees. */
625 97488 : MARK_TS_COMMON (BASELINK);
626 97488 : MARK_TS_COMMON (OVERLOAD);
627 97488 : MARK_TS_COMMON (TEMPLATE_PARM_INDEX);
628 :
629 : /* New decls. */
630 97488 : MARK_TS_DECL_COMMON (TEMPLATE_DECL);
631 :
632 97488 : MARK_TS_DECL_NON_COMMON (USING_DECL);
633 :
634 : /* New Types. */
635 97488 : MARK_TS_TYPE_COMMON (UNBOUND_CLASS_TEMPLATE);
636 97488 : MARK_TS_TYPE_COMMON (TYPE_ARGUMENT_PACK);
637 97488 : MARK_TS_TYPE_COMMON (DEPENDENT_OPERATOR_TYPE);
638 :
639 97488 : MARK_TS_TYPE_NON_COMMON (DECLTYPE_TYPE);
640 97488 : MARK_TS_TYPE_NON_COMMON (TYPENAME_TYPE);
641 97488 : MARK_TS_TYPE_NON_COMMON (TYPEOF_TYPE);
642 97488 : MARK_TS_TYPE_NON_COMMON (TRAIT_TYPE);
643 97488 : MARK_TS_TYPE_NON_COMMON (BOUND_TEMPLATE_TEMPLATE_PARM);
644 97488 : MARK_TS_TYPE_NON_COMMON (TEMPLATE_TEMPLATE_PARM);
645 97488 : MARK_TS_TYPE_NON_COMMON (TEMPLATE_TYPE_PARM);
646 97488 : MARK_TS_TYPE_NON_COMMON (TYPE_PACK_EXPANSION);
647 97488 : MARK_TS_TYPE_NON_COMMON (PACK_INDEX_TYPE);
648 97488 : MARK_TS_TYPE_NON_COMMON (META_TYPE);
649 97488 : MARK_TS_TYPE_NON_COMMON (SPLICE_SCOPE);
650 :
651 : /* Statements. */
652 97488 : MARK_TS_EXP (CLEANUP_STMT);
653 97488 : MARK_TS_EXP (EH_SPEC_BLOCK);
654 97488 : MARK_TS_EXP (HANDLER);
655 97488 : MARK_TS_EXP (IF_STMT);
656 97488 : MARK_TS_EXP (OMP_DEPOBJ);
657 97488 : MARK_TS_EXP (RANGE_FOR_STMT);
658 97488 : MARK_TS_EXP (TEMPLATE_FOR_STMT);
659 97488 : MARK_TS_EXP (TRY_BLOCK);
660 97488 : MARK_TS_EXP (USING_STMT);
661 :
662 : /* Random expressions. */
663 97488 : MARK_TS_EXP (ADDRESSOF_EXPR);
664 97488 : MARK_TS_EXP (AGGR_INIT_EXPR);
665 97488 : MARK_TS_EXP (ALIGNOF_EXPR);
666 97488 : MARK_TS_EXP (ARROW_EXPR);
667 97488 : MARK_TS_EXP (AT_ENCODE_EXPR);
668 97488 : MARK_TS_EXP (BIT_CAST_EXPR);
669 97488 : MARK_TS_EXP (CAST_EXPR);
670 97488 : MARK_TS_EXP (CONST_CAST_EXPR);
671 97488 : MARK_TS_EXP (CTOR_INITIALIZER);
672 97488 : MARK_TS_EXP (DELETE_EXPR);
673 97488 : MARK_TS_EXP (DOTSTAR_EXPR);
674 97488 : MARK_TS_EXP (DYNAMIC_CAST_EXPR);
675 97488 : MARK_TS_EXP (EMPTY_CLASS_EXPR);
676 97488 : MARK_TS_EXP (EXPR_STMT);
677 97488 : MARK_TS_EXP (IMPLICIT_CONV_EXPR);
678 97488 : MARK_TS_EXP (MEMBER_REF);
679 97488 : MARK_TS_EXP (MODOP_EXPR);
680 97488 : MARK_TS_EXP (MUST_NOT_THROW_EXPR);
681 97488 : MARK_TS_EXP (NEW_EXPR);
682 97488 : MARK_TS_EXP (NOEXCEPT_EXPR);
683 97488 : MARK_TS_EXP (OFFSETOF_EXPR);
684 97488 : MARK_TS_EXP (OFFSET_REF);
685 97488 : MARK_TS_EXP (PSEUDO_DTOR_EXPR);
686 97488 : MARK_TS_EXP (REINTERPRET_CAST_EXPR);
687 97488 : MARK_TS_EXP (SCOPE_REF);
688 97488 : MARK_TS_EXP (STATIC_CAST_EXPR);
689 97488 : MARK_TS_EXP (STMT_EXPR);
690 97488 : MARK_TS_EXP (TAG_DEFN);
691 97488 : MARK_TS_EXP (TEMPLATE_ID_EXPR);
692 97488 : MARK_TS_EXP (THROW_EXPR);
693 97488 : MARK_TS_EXP (TYPEID_EXPR);
694 97488 : MARK_TS_EXP (TYPE_EXPR);
695 97488 : MARK_TS_EXP (UNARY_PLUS_EXPR);
696 97488 : MARK_TS_EXP (VEC_DELETE_EXPR);
697 97488 : MARK_TS_EXP (VEC_INIT_EXPR);
698 97488 : MARK_TS_EXP (VEC_NEW_EXPR);
699 97488 : MARK_TS_EXP (SPACESHIP_EXPR);
700 97488 : MARK_TS_EXP (SPLICE_EXPR);
701 97488 : MARK_TS_EXP (REFLECT_EXPR);
702 :
703 : /* Fold expressions. */
704 97488 : MARK_TS_EXP (BINARY_LEFT_FOLD_EXPR);
705 97488 : MARK_TS_EXP (BINARY_RIGHT_FOLD_EXPR);
706 97488 : MARK_TS_EXP (EXPR_PACK_EXPANSION);
707 97488 : MARK_TS_EXP (NONTYPE_ARGUMENT_PACK);
708 97488 : MARK_TS_EXP (UNARY_LEFT_FOLD_EXPR);
709 97488 : MARK_TS_EXP (UNARY_RIGHT_FOLD_EXPR);
710 97488 : MARK_TS_EXP (PACK_INDEX_EXPR);
711 :
712 : /* Constraints. */
713 97488 : MARK_TS_EXP (COMPOUND_REQ);
714 97488 : MARK_TS_EXP (CONJ_CONSTR);
715 97488 : MARK_TS_EXP (DISJ_CONSTR);
716 97488 : MARK_TS_EXP (ATOMIC_CONSTR);
717 97488 : MARK_TS_EXP (NESTED_REQ);
718 97488 : MARK_TS_EXP (REQUIRES_EXPR);
719 97488 : MARK_TS_EXP (SIMPLE_REQ);
720 97488 : MARK_TS_EXP (TYPE_REQ);
721 :
722 97488 : MARK_TS_EXP (CO_AWAIT_EXPR);
723 97488 : MARK_TS_EXP (CO_YIELD_EXPR);
724 97488 : MARK_TS_EXP (CO_RETURN_EXPR);
725 :
726 97488 : MARK_TS_EXP (ASSERTION_STMT);
727 97488 : MARK_TS_EXP (PRECONDITION_STMT);
728 97488 : MARK_TS_EXP (POSTCONDITION_STMT);
729 :
730 97488 : c_common_init_ts ();
731 97488 : }
732 :
733 : /* Handle C++-specficic options here. Punt to c_common otherwise. */
734 :
735 : bool
736 1903608 : cp_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
737 : int kind, location_t loc,
738 : const struct cl_option_handlers *handlers)
739 : {
740 1903608 : if (handle_module_option (unsigned (scode), arg, value))
741 : return true;
742 :
743 1902651 : return c_common_handle_option (scode, arg, value, kind, loc, handlers);
744 : }
745 :
746 : #include "gt-cp-cp-objcp-common.h"
|