Daily bump.
[official-gcc.git] / gcc / cp / cp-objcp-common.cc
blobf06edf04ef07d08c55542e582a107a670a82a5b1
1 /* Some code common to C++ and ObjC++ front ends.
2 Copyright (C) 2004-2024 Free Software Foundation, Inc.
3 Contributed by Ziemowit Laski <zlaski@apple.com>
5 This file is part of GCC.
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.
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.
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/>. */
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 #include "contracts.h"
31 /* Class to determine whether a given C++ language feature is available.
32 Used to implement __has_{feature,extension}. */
34 struct cp_feature_selector
36 enum
38 DIALECT,
39 FLAG
40 } kind;
42 enum class result
44 NONE,
45 EXT,
46 FEAT
49 union
51 const int *enable_flag;
52 struct {
53 enum cxx_dialect feat;
54 enum cxx_dialect ext;
55 } dialect;
58 constexpr cp_feature_selector (const int *flag)
59 : kind (FLAG), enable_flag (flag) {}
60 constexpr cp_feature_selector (enum cxx_dialect feat,
61 enum cxx_dialect ext)
62 : kind (DIALECT), dialect{feat, ext} {}
63 constexpr cp_feature_selector (enum cxx_dialect feat)
64 : cp_feature_selector (feat, feat) {}
66 inline result has_feature () const;
69 /* Check whether this language feature is available as a feature,
70 extension, or not at all. */
72 cp_feature_selector::result
73 cp_feature_selector::has_feature () const
75 switch (kind)
77 case DIALECT:
78 if (cxx_dialect >= dialect.feat)
79 return result::FEAT;
80 else if (cxx_dialect >= dialect.ext)
81 return result::EXT;
82 else
83 return result::NONE;
84 case FLAG:
85 return *enable_flag ? result::FEAT : result::NONE;
88 gcc_unreachable ();
91 /* Information about a C++ language feature which can be queried
92 through __has_{feature,extension}. IDENT is the name of the feature,
93 and SELECTOR encodes how to compute whether the feature is available. */
95 struct cp_feature_info
97 const char *ident;
98 cp_feature_selector selector;
101 /* Table of features for __has_{feature,extension}. */
103 static constexpr cp_feature_info cp_feature_table[] =
105 { "cxx_exceptions", &flag_exceptions },
106 { "cxx_rtti", &flag_rtti },
107 { "cxx_access_control_sfinae", { cxx11, cxx98 } },
108 { "cxx_alias_templates", cxx11 },
109 { "cxx_alignas", cxx11 },
110 { "cxx_alignof", cxx11 },
111 { "cxx_attributes", cxx11 },
112 { "cxx_constexpr", cxx11 },
113 { "cxx_constexpr_string_builtins", cxx11 },
114 { "cxx_decltype", cxx11 },
115 { "cxx_decltype_incomplete_return_types", cxx11 },
116 { "cxx_default_function_template_args", cxx11 },
117 { "cxx_defaulted_functions", cxx11 },
118 { "cxx_delegating_constructors", cxx11 },
119 { "cxx_deleted_functions", cxx11 },
120 { "cxx_explicit_conversions", cxx11 },
121 { "cxx_generalized_initializers", cxx11 },
122 { "cxx_implicit_moves", cxx11 },
123 { "cxx_inheriting_constructors", cxx11 },
124 { "cxx_inline_namespaces", { cxx11, cxx98 } },
125 { "cxx_lambdas", cxx11 },
126 { "cxx_local_type_template_args", cxx11 },
127 { "cxx_noexcept", cxx11 },
128 { "cxx_nonstatic_member_init", cxx11 },
129 { "cxx_nullptr", cxx11 },
130 { "cxx_override_control", cxx11 },
131 { "cxx_reference_qualified_functions", cxx11 },
132 { "cxx_range_for", cxx11 },
133 { "cxx_raw_string_literals", cxx11 },
134 { "cxx_rvalue_references", cxx11 },
135 { "cxx_static_assert", cxx11 },
136 { "cxx_thread_local", cxx11 },
137 { "cxx_auto_type", cxx11 },
138 { "cxx_strong_enums", cxx11 },
139 { "cxx_trailing_return", cxx11 },
140 { "cxx_unicode_literals", cxx11 },
141 { "cxx_unrestricted_unions", cxx11 },
142 { "cxx_user_literals", cxx11 },
143 { "cxx_variadic_templates", { cxx11, cxx98 } },
144 { "cxx_binary_literals", { cxx14, cxx98 } },
145 { "cxx_contextual_conversions", { cxx14, cxx98 } },
146 { "cxx_decltype_auto", cxx14 },
147 { "cxx_aggregate_nsdmi", cxx14 },
148 { "cxx_init_captures", { cxx14, cxx11 } },
149 { "cxx_generic_lambdas", cxx14 },
150 { "cxx_relaxed_constexpr", cxx14 },
151 { "cxx_return_type_deduction", cxx14 },
152 { "cxx_variable_templates", cxx14 },
153 { "modules", &flag_modules },
156 /* Register C++ language features for __has_{feature,extension}. */
158 void
159 cp_register_features ()
161 using result = cp_feature_selector::result;
163 for (unsigned i = 0; i < ARRAY_SIZE (cp_feature_table); i++)
165 const cp_feature_info *info = cp_feature_table + i;
166 const auto res = info->selector.has_feature ();
167 if (res == result::NONE)
168 continue;
170 c_common_register_feature (info->ident, res == result::FEAT);
174 /* Special routine to get the alias set for C++. */
176 alias_set_type
177 cxx_get_alias_set (tree t)
179 if (IS_FAKE_BASE_TYPE (t))
180 /* The base variant of a type must be in the same alias set as the
181 complete type. */
182 return get_alias_set (TYPE_CONTEXT (t));
184 /* Punt on PMFs until we canonicalize functions properly. */
185 if (TYPE_PTRMEMFUNC_P (t)
186 || (INDIRECT_TYPE_P (t)
187 && TYPE_PTRMEMFUNC_P (TREE_TYPE (t))))
188 return 0;
190 return c_common_get_alias_set (t);
193 /* Called from check_global_declaration. */
195 bool
196 cxx_warn_unused_global_decl (const_tree decl)
198 if (TREE_CODE (decl) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (decl))
199 return false;
200 if (DECL_IN_SYSTEM_HEADER (decl))
201 return false;
203 return true;
206 /* Langhook for tree_size: determine size of our 'x' and 'c' nodes. */
207 size_t
208 cp_tree_size (enum tree_code code)
210 gcc_checking_assert (code >= NUM_TREE_CODES);
211 switch (code)
213 case PTRMEM_CST: return sizeof (ptrmem_cst);
214 case BASELINK: return sizeof (tree_baselink);
215 case TEMPLATE_PARM_INDEX: return sizeof (template_parm_index);
216 case DEFERRED_PARSE: return sizeof (tree_deferred_parse);
217 case DEFERRED_NOEXCEPT: return sizeof (tree_deferred_noexcept);
218 case OVERLOAD: return sizeof (tree_overload);
219 case STATIC_ASSERT: return sizeof (tree_static_assert);
220 #if 0
221 /* This would match cp_common_init_ts, but breaks GC because
222 tree_node_structure_for_code returns TS_TYPE_NON_COMMON for all
223 types. */
224 case UNBOUND_CLASS_TEMPLATE:
225 case TYPE_ARGUMENT_PACK: return sizeof (tree_type_common);
226 #endif
227 case ARGUMENT_PACK_SELECT: return sizeof (tree_argument_pack_select);
228 case TRAIT_EXPR: return sizeof (tree_trait_expr);
229 case LAMBDA_EXPR: return sizeof (tree_lambda_expr);
230 case TEMPLATE_INFO: return sizeof (tree_template_info);
231 case CONSTRAINT_INFO: return sizeof (tree_constraint_info);
232 case USERDEF_LITERAL: return sizeof (tree_userdef_literal);
233 case TEMPLATE_DECL: return sizeof (tree_template_decl);
234 case ASSERTION_STMT: return sizeof (tree_exp);
235 case PRECONDITION_STMT: return sizeof (tree_exp);
236 case POSTCONDITION_STMT: return sizeof (tree_exp);
237 default:
238 switch (TREE_CODE_CLASS (code))
240 case tcc_declaration: return sizeof (tree_decl_non_common);
241 case tcc_type: return sizeof (tree_type_non_common);
242 default: gcc_unreachable ();
245 /* NOTREACHED */
248 /* Returns true if T is a variably modified type, in the sense of C99.
249 FN is as passed to variably_modified_p.
250 This routine needs only check cases that cannot be handled by the
251 language-independent logic in tree.cc. */
253 bool
254 cp_var_mod_type_p (tree type, tree fn)
256 /* If TYPE is a pointer-to-member, it is variably modified if either
257 the class or the member are variably modified. */
258 if (TYPE_PTRMEM_P (type))
259 return (variably_modified_type_p (TYPE_PTRMEM_CLASS_TYPE (type), fn)
260 || variably_modified_type_p (TYPE_PTRMEM_POINTED_TO_TYPE (type),
261 fn));
263 /* All other types are not variably modified. */
264 return false;
267 /* This compares two types for equivalence ("compatible" in C-based languages).
268 This routine should only return 1 if it is sure. It should not be used
269 in contexts where erroneously returning 0 causes problems. */
272 cxx_types_compatible_p (tree x, tree y)
274 return same_type_ignoring_top_level_qualifiers_p (x, y);
277 static GTY((cache)) type_tree_cache_map *debug_type_map;
279 /* Return a type to use in the debug info instead of TYPE, or NULL_TREE to
280 keep TYPE. */
282 tree
283 cp_get_debug_type (const_tree type)
285 tree dtype = NULL_TREE;
287 if (TYPE_PTRMEMFUNC_P (type) && !typedef_variant_p (type))
288 dtype = build_offset_type (TYPE_PTRMEMFUNC_OBJECT_TYPE (type),
289 TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (type)));
291 /* We cannot simply return the debug type here because the function uses
292 the type canonicalization hashtable, which is GC-ed, so its behavior
293 depends on the actual collection points. Since we are building these
294 types on the fly for the debug info only, they would not be attached
295 to any GC root and always be swept, so we would make the contents of
296 the debug info depend on the collection points. */
297 if (dtype)
299 tree ktype = CONST_CAST_TREE (type);
300 if (tree *slot = hash_map_safe_get (debug_type_map, ktype))
301 return *slot;
302 hash_map_safe_put<hm_ggc> (debug_type_map, ktype, dtype);
305 return dtype;
308 /* Return -1 if dwarf ATTR shouldn't be added for DECL, or the attribute
309 value otherwise. */
311 cp_decl_dwarf_attribute (const_tree decl, int attr)
313 if (decl == NULL_TREE)
314 return -1;
316 switch (attr)
318 case DW_AT_explicit:
319 if (TREE_CODE (decl) == FUNCTION_DECL
320 && DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl))
321 && DECL_NONCONVERTING_P (decl))
322 return 1;
323 break;
325 case DW_AT_deleted:
326 if (TREE_CODE (decl) == FUNCTION_DECL
327 && DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl))
328 && DECL_DELETED_FN (decl))
329 return 1;
330 break;
332 case DW_AT_defaulted:
333 if (TREE_CODE (decl) == FUNCTION_DECL
334 && DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl))
335 && DECL_DEFAULTED_FN (decl))
337 if (DECL_DEFAULTED_IN_CLASS_P (decl))
338 return DW_DEFAULTED_in_class;
340 if (DECL_DEFAULTED_OUTSIDE_CLASS_P (decl))
341 return DW_DEFAULTED_out_of_class;
343 break;
345 case DW_AT_const_expr:
346 if (VAR_OR_FUNCTION_DECL_P (decl) && DECL_DECLARED_CONSTEXPR_P (decl))
347 return 1;
348 break;
350 case DW_AT_reference:
351 if (TREE_CODE (decl) == FUNCTION_DECL
352 && DECL_IOBJ_MEMBER_FUNCTION_P (decl)
353 && FUNCTION_REF_QUALIFIED (TREE_TYPE (decl))
354 && !FUNCTION_RVALUE_QUALIFIED (TREE_TYPE (decl)))
355 return 1;
356 break;
358 case DW_AT_rvalue_reference:
359 if (TREE_CODE (decl) == FUNCTION_DECL
360 && DECL_IOBJ_MEMBER_FUNCTION_P (decl)
361 && FUNCTION_REF_QUALIFIED (TREE_TYPE (decl))
362 && FUNCTION_RVALUE_QUALIFIED (TREE_TYPE (decl)))
363 return 1;
364 break;
366 case DW_AT_inline:
367 if (VAR_P (decl) && DECL_INLINE_VAR_P (decl))
369 if (DECL_VAR_DECLARED_INLINE_P (decl))
370 return DW_INL_declared_inlined;
371 else
372 return DW_INL_inlined;
374 break;
376 case DW_AT_export_symbols:
377 if (TREE_CODE (decl) == NAMESPACE_DECL
378 && (DECL_NAMESPACE_INLINE_P (decl)
379 || (DECL_NAME (decl) == NULL_TREE && dwarf_version >= 5)))
380 return 1;
381 break;
383 default:
384 break;
387 return -1;
390 /* Return -1 if dwarf ATTR shouldn't be added for TYPE, or the attribute
391 value otherwise. */
393 cp_type_dwarf_attribute (const_tree type, int attr)
395 if (type == NULL_TREE)
396 return -1;
398 switch (attr)
400 case DW_AT_reference:
401 if (FUNC_OR_METHOD_TYPE_P (type)
402 && FUNCTION_REF_QUALIFIED (type)
403 && !FUNCTION_RVALUE_QUALIFIED (type))
404 return 1;
405 break;
407 case DW_AT_rvalue_reference:
408 if (FUNC_OR_METHOD_TYPE_P (type)
409 && FUNCTION_REF_QUALIFIED (type)
410 && FUNCTION_RVALUE_QUALIFIED (type))
411 return 1;
412 break;
414 default:
415 break;
418 return -1;
421 /* Return the unit size of TYPE without reusable tail padding. */
423 tree
424 cp_unit_size_without_reusable_padding (tree type)
426 if (CLASS_TYPE_P (type))
427 return CLASSTYPE_SIZE_UNIT (type);
428 return TYPE_SIZE_UNIT (type);
431 /* Returns type corresponding to FIELD's type when FIELD is a C++ base class
432 i.e., type without virtual base classes or tail padding. Returns
433 NULL_TREE otherwise. */
435 tree
436 cp_classtype_as_base (const_tree field)
438 if (DECL_FIELD_IS_BASE (field))
440 tree type = TREE_TYPE (field);
441 if (TYPE_LANG_SPECIFIC (type))
442 return CLASSTYPE_AS_BASE (type);
444 return NULL_TREE;
447 /* Stubs to keep c-opts.cc happy. */
448 void
449 push_file_scope (void)
453 void
454 pop_file_scope (void)
458 /* c-pragma.cc needs to query whether a decl has extern "C" linkage. */
459 bool
460 has_c_linkage (const_tree decl)
462 return DECL_EXTERN_C_P (decl);
465 /* Return true if stmt can fall through. Used by block_may_fallthru
466 default case. */
468 bool
469 cxx_block_may_fallthru (const_tree stmt)
471 switch (TREE_CODE (stmt))
473 case EXPR_STMT:
474 return block_may_fallthru (EXPR_STMT_EXPR (stmt));
476 case THROW_EXPR:
477 return false;
479 case IF_STMT:
480 if (IF_STMT_CONSTEXPR_P (stmt))
482 if (integer_nonzerop (IF_COND (stmt)))
483 return block_may_fallthru (THEN_CLAUSE (stmt));
484 if (integer_zerop (IF_COND (stmt)))
485 return block_may_fallthru (ELSE_CLAUSE (stmt));
487 if (block_may_fallthru (THEN_CLAUSE (stmt)))
488 return true;
489 return block_may_fallthru (ELSE_CLAUSE (stmt));
491 case CLEANUP_STMT:
492 /* Just handle the try/finally cases. */
493 if (!CLEANUP_EH_ONLY (stmt))
495 return (block_may_fallthru (CLEANUP_BODY (stmt))
496 && block_may_fallthru (CLEANUP_EXPR (stmt)));
498 return true;
500 default:
501 return c_block_may_fallthru (stmt);
505 /* Return the list of decls in the global namespace. */
507 tree
508 cp_get_global_decls ()
510 return NAMESPACE_LEVEL (global_namespace)->names;
513 /* Push DECL into the current (namespace) scope. */
515 tree
516 cp_pushdecl (tree decl)
518 DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
519 return pushdecl (decl);
522 /* Get the global value binding of NAME. Called directly from
523 c-common.cc, not via a hook. */
525 tree
526 identifier_global_value (tree name)
528 return get_global_binding (name);
531 /* Similarly, but return struct/class/union NAME instead. */
533 tree
534 identifier_global_tag (tree name)
536 tree ret = lookup_qualified_name (global_namespace, name, LOOK_want::TYPE,
537 /*complain*/false);
538 if (ret == error_mark_node)
539 return NULL_TREE;
540 return ret;
543 /* Returns true if NAME refers to a built-in function or function-like
544 operator. */
546 bool
547 names_builtin_p (const char *name)
549 tree id = get_identifier (name);
550 if (tree binding = get_global_binding (id))
552 if (TREE_CODE (binding) == FUNCTION_DECL
553 && DECL_IS_UNDECLARED_BUILTIN (binding))
554 return true;
556 /* Handle the case when an overload for a built-in name exists. */
557 if (TREE_CODE (binding) != OVERLOAD)
558 return false;
560 for (ovl_iterator it (binding); it; ++it)
562 tree decl = *it;
563 if (DECL_IS_UNDECLARED_BUILTIN (decl))
564 return true;
568 /* Check for built-in traits. */
569 if (IDENTIFIER_TRAIT_P (id))
570 return true;
572 /* Also detect common reserved C++ words that aren't strictly built-in
573 functions. */
574 switch (C_RID_CODE (id))
576 case RID_ADDRESSOF:
577 case RID_BUILTIN_CONVERTVECTOR:
578 case RID_BUILTIN_HAS_ATTRIBUTE:
579 case RID_BUILTIN_SHUFFLE:
580 case RID_BUILTIN_SHUFFLEVECTOR:
581 case RID_BUILTIN_LAUNDER:
582 case RID_BUILTIN_ASSOC_BARRIER:
583 case RID_BUILTIN_BIT_CAST:
584 case RID_OFFSETOF:
585 return true;
586 default:
587 break;
590 return false;
593 /* Register c++-specific dumps. */
595 void
596 cp_register_dumps (gcc::dump_manager *dumps)
598 class_dump_id = dumps->dump_register
599 (".class", "lang-class", "lang-class", DK_lang, OPTGROUP_NONE, false);
601 module_dump_id = dumps->dump_register
602 (".module", "lang-module", "lang-module", DK_lang, OPTGROUP_NONE, false);
604 raw_dump_id = dumps->dump_register
605 (".raw", "lang-raw", "lang-raw", DK_lang, OPTGROUP_NONE, false);
608 void
609 cp_common_init_ts (void)
611 /* With type. */
612 MARK_TS_TYPED (PTRMEM_CST);
613 MARK_TS_TYPED (LAMBDA_EXPR);
614 MARK_TS_TYPED (TYPE_ARGUMENT_PACK);
616 /* Random new trees. */
617 MARK_TS_COMMON (BASELINK);
618 MARK_TS_COMMON (OVERLOAD);
619 MARK_TS_COMMON (TEMPLATE_PARM_INDEX);
621 /* New decls. */
622 MARK_TS_DECL_COMMON (TEMPLATE_DECL);
623 MARK_TS_DECL_COMMON (WILDCARD_DECL);
625 MARK_TS_DECL_NON_COMMON (USING_DECL);
627 /* New Types. */
628 MARK_TS_TYPE_COMMON (UNBOUND_CLASS_TEMPLATE);
629 MARK_TS_TYPE_COMMON (TYPE_ARGUMENT_PACK);
630 MARK_TS_TYPE_COMMON (DEPENDENT_OPERATOR_TYPE);
632 MARK_TS_TYPE_NON_COMMON (DECLTYPE_TYPE);
633 MARK_TS_TYPE_NON_COMMON (TYPENAME_TYPE);
634 MARK_TS_TYPE_NON_COMMON (TYPEOF_TYPE);
635 MARK_TS_TYPE_NON_COMMON (TRAIT_TYPE);
636 MARK_TS_TYPE_NON_COMMON (BOUND_TEMPLATE_TEMPLATE_PARM);
637 MARK_TS_TYPE_NON_COMMON (TEMPLATE_TEMPLATE_PARM);
638 MARK_TS_TYPE_NON_COMMON (TEMPLATE_TYPE_PARM);
639 MARK_TS_TYPE_NON_COMMON (TYPE_PACK_EXPANSION);
641 /* Statements. */
642 MARK_TS_EXP (CLEANUP_STMT);
643 MARK_TS_EXP (EH_SPEC_BLOCK);
644 MARK_TS_EXP (HANDLER);
645 MARK_TS_EXP (IF_STMT);
646 MARK_TS_EXP (OMP_DEPOBJ);
647 MARK_TS_EXP (RANGE_FOR_STMT);
648 MARK_TS_EXP (TRY_BLOCK);
649 MARK_TS_EXP (USING_STMT);
651 /* Random expressions. */
652 MARK_TS_EXP (ADDRESSOF_EXPR);
653 MARK_TS_EXP (AGGR_INIT_EXPR);
654 MARK_TS_EXP (ALIGNOF_EXPR);
655 MARK_TS_EXP (ARROW_EXPR);
656 MARK_TS_EXP (AT_ENCODE_EXPR);
657 MARK_TS_EXP (BIT_CAST_EXPR);
658 MARK_TS_EXP (CAST_EXPR);
659 MARK_TS_EXP (CONST_CAST_EXPR);
660 MARK_TS_EXP (CTOR_INITIALIZER);
661 MARK_TS_EXP (DELETE_EXPR);
662 MARK_TS_EXP (DOTSTAR_EXPR);
663 MARK_TS_EXP (DYNAMIC_CAST_EXPR);
664 MARK_TS_EXP (EMPTY_CLASS_EXPR);
665 MARK_TS_EXP (EXPR_STMT);
666 MARK_TS_EXP (IMPLICIT_CONV_EXPR);
667 MARK_TS_EXP (MEMBER_REF);
668 MARK_TS_EXP (MODOP_EXPR);
669 MARK_TS_EXP (MUST_NOT_THROW_EXPR);
670 MARK_TS_EXP (NEW_EXPR);
671 MARK_TS_EXP (NOEXCEPT_EXPR);
672 MARK_TS_EXP (OFFSETOF_EXPR);
673 MARK_TS_EXP (OFFSET_REF);
674 MARK_TS_EXP (PSEUDO_DTOR_EXPR);
675 MARK_TS_EXP (REINTERPRET_CAST_EXPR);
676 MARK_TS_EXP (SCOPE_REF);
677 MARK_TS_EXP (STATIC_CAST_EXPR);
678 MARK_TS_EXP (STMT_EXPR);
679 MARK_TS_EXP (TAG_DEFN);
680 MARK_TS_EXP (TEMPLATE_ID_EXPR);
681 MARK_TS_EXP (THROW_EXPR);
682 MARK_TS_EXP (TRAIT_EXPR);
683 MARK_TS_EXP (TYPEID_EXPR);
684 MARK_TS_EXP (TYPE_EXPR);
685 MARK_TS_EXP (UNARY_PLUS_EXPR);
686 MARK_TS_EXP (VEC_DELETE_EXPR);
687 MARK_TS_EXP (VEC_INIT_EXPR);
688 MARK_TS_EXP (VEC_NEW_EXPR);
689 MARK_TS_EXP (SPACESHIP_EXPR);
691 /* Fold expressions. */
692 MARK_TS_EXP (BINARY_LEFT_FOLD_EXPR);
693 MARK_TS_EXP (BINARY_RIGHT_FOLD_EXPR);
694 MARK_TS_EXP (EXPR_PACK_EXPANSION);
695 MARK_TS_EXP (NONTYPE_ARGUMENT_PACK);
696 MARK_TS_EXP (UNARY_LEFT_FOLD_EXPR);
697 MARK_TS_EXP (UNARY_RIGHT_FOLD_EXPR);
699 /* Constraints. */
700 MARK_TS_EXP (CHECK_CONSTR);
701 MARK_TS_EXP (COMPOUND_REQ);
702 MARK_TS_EXP (CONJ_CONSTR);
703 MARK_TS_EXP (DISJ_CONSTR);
704 MARK_TS_EXP (ATOMIC_CONSTR);
705 MARK_TS_EXP (NESTED_REQ);
706 MARK_TS_EXP (REQUIRES_EXPR);
707 MARK_TS_EXP (SIMPLE_REQ);
708 MARK_TS_EXP (TYPE_REQ);
710 MARK_TS_EXP (CO_AWAIT_EXPR);
711 MARK_TS_EXP (CO_YIELD_EXPR);
712 MARK_TS_EXP (CO_RETURN_EXPR);
714 MARK_TS_EXP (ASSERTION_STMT);
715 MARK_TS_EXP (PRECONDITION_STMT);
716 MARK_TS_EXP (POSTCONDITION_STMT);
718 c_common_init_ts ();
721 /* Handle C++-specficic options here. Punt to c_common otherwise. */
723 bool
724 cp_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
725 int kind, location_t loc,
726 const struct cl_option_handlers *handlers)
728 if (handle_module_option (unsigned (scode), arg, value))
729 return true;
731 enum opt_code code = (enum opt_code) scode;
732 bool handled_p = true;
734 switch (code)
736 case OPT_fcontract_build_level_:
737 handle_OPT_fcontract_build_level_ (arg);
738 break;
740 case OPT_fcontract_assumption_mode_:
741 handle_OPT_fcontract_assumption_mode_ (arg);
742 break;
744 case OPT_fcontract_continuation_mode_:
745 handle_OPT_fcontract_continuation_mode_ (arg);
746 break;
748 case OPT_fcontract_role_:
749 handle_OPT_fcontract_role_ (arg);
750 break;
752 case OPT_fcontract_semantic_:
753 handle_OPT_fcontract_semantic_ (arg);
754 break;
756 default:
757 handled_p = false;
758 break;
760 if (handled_p)
761 return handled_p;
763 return c_common_handle_option (scode, arg, value, kind, loc, handlers);
766 #include "gt-cp-cp-objcp-common.h"