]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/cp/cp-objcp-common.c
Update copyright years.
[thirdparty/gcc.git] / gcc / cp / cp-objcp-common.c
CommitLineData
11bb4b27 1/* Some code common to C++ and ObjC++ front ends.
7adcbafe 2 Copyright (C) 2004-2022 Free Software Foundation, Inc.
11bb4b27
ZL
3 Contributed by Ziemowit Laski <zlaski@apple.com>
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
e77f031d 9Software Foundation; either version 3, or (at your option) any later
11bb4b27
ZL
10version.
11
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
16
17You should have received a copy of the GNU General Public License
e77f031d
NC
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
11bb4b27
ZL
20
21#include "config.h"
22#include "system.h"
23#include "coretypes.h"
11bb4b27 24#include "cp-tree.h"
11bb4b27 25#include "cp-objcp-common.h"
81b42cc6 26#include "dwarf2.h"
ad1539d5 27#include "stringpool.h"
11bb4b27
ZL
28
29/* Special routine to get the alias set for C++. */
30
4862826d 31alias_set_type
11bb4b27
ZL
32cxx_get_alias_set (tree t)
33{
34 if (IS_FAKE_BASE_TYPE (t))
35 /* The base variant of a type must be in the same alias set as the
36 complete type. */
37 return get_alias_set (TYPE_CONTEXT (t));
38
39 /* Punt on PMFs until we canonicalize functions properly. */
a489b1f0 40 if (TYPE_PTRMEMFUNC_P (t)
71a93b08 41 || (INDIRECT_TYPE_P (t)
a489b1f0 42 && TYPE_PTRMEMFUNC_P (TREE_TYPE (t))))
11bb4b27
ZL
43 return 0;
44
45 return c_common_get_alias_set (t);
46}
47
d7438551 48/* Called from check_global_declaration. */
11bb4b27
ZL
49
50bool
ac7d7749 51cxx_warn_unused_global_decl (const_tree decl)
11bb4b27
ZL
52{
53 if (TREE_CODE (decl) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (decl))
54 return false;
55 if (DECL_IN_SYSTEM_HEADER (decl))
56 return false;
57
11bb4b27
ZL
58 return true;
59}
60
11bb4b27
ZL
61/* Langhook for tree_size: determine size of our 'x' and 'c' nodes. */
62size_t
63cp_tree_size (enum tree_code code)
64{
f419fd1f 65 gcc_checking_assert (code >= NUM_TREE_CODES);
11bb4b27
ZL
66 switch (code)
67 {
f419fd1f
NS
68 case PTRMEM_CST: return sizeof (ptrmem_cst);
69 case BASELINK: return sizeof (tree_baselink);
0cbd7506 70 case TEMPLATE_PARM_INDEX: return sizeof (template_parm_index);
7b49e3da 71 case DEFERRED_PARSE: return sizeof (tree_deferred_parse);
f419fd1f
NS
72 case DEFERRED_NOEXCEPT: return sizeof (tree_deferred_noexcept);
73 case OVERLOAD: return sizeof (tree_overload);
74 case STATIC_ASSERT: return sizeof (tree_static_assert);
0b7a1187
JM
75#if 0
76 /* This would match cp_common_init_ts, but breaks GC because
77 tree_node_structure_for_code returns TS_TYPE_NON_COMMON for all
78 types. */
79 case UNBOUND_CLASS_TEMPLATE:
80 case TYPE_ARGUMENT_PACK: return sizeof (tree_type_common);
81#endif
f419fd1f
NS
82 case ARGUMENT_PACK_SELECT: return sizeof (tree_argument_pack_select);
83 case TRAIT_EXPR: return sizeof (tree_trait_expr);
84 case LAMBDA_EXPR: return sizeof (tree_lambda_expr);
85 case TEMPLATE_INFO: return sizeof (tree_template_info);
86 case CONSTRAINT_INFO: return sizeof (tree_constraint_info);
87 case USERDEF_LITERAL: return sizeof (tree_userdef_literal);
88 case TEMPLATE_DECL: return sizeof (tree_template_decl);
11bb4b27 89 default:
f419fd1f
NS
90 switch (TREE_CODE_CLASS (code))
91 {
92 case tcc_declaration: return sizeof (tree_decl_non_common);
93 case tcc_type: return sizeof (tree_type_non_common);
94 default: gcc_unreachable ();
95 }
11bb4b27
ZL
96 }
97 /* NOTREACHED */
98}
99
100/* Returns true if T is a variably modified type, in the sense of C99.
101 FN is as passed to variably_modified_p.
102 This routine needs only check cases that cannot be handled by the
103 language-independent logic in tree.c. */
104
105bool
106cp_var_mod_type_p (tree type, tree fn)
107{
108 /* If TYPE is a pointer-to-member, it is variably modified if either
109 the class or the member are variably modified. */
66b1156a 110 if (TYPE_PTRMEM_P (type))
11bb4b27
ZL
111 return (variably_modified_type_p (TYPE_PTRMEM_CLASS_TYPE (type), fn)
112 || variably_modified_type_p (TYPE_PTRMEM_POINTED_TO_TYPE (type),
113 fn));
114
115 /* All other types are not variably modified. */
116 return false;
117}
118
65958285
ZL
119/* This compares two types for equivalence ("compatible" in C-based languages).
120 This routine should only return 1 if it is sure. It should not be used
121 in contexts where erroneously returning 0 causes problems. */
122
123int
124cxx_types_compatible_p (tree x, tree y)
125{
cf7bc668 126 return same_type_ignoring_top_level_qualifiers_p (x, y);
65958285
ZL
127}
128
df418f1d 129static GTY((cache)) type_tree_cache_map *debug_type_map;
a49bf6f0 130
6905c577
JJ
131/* Return a type to use in the debug info instead of TYPE, or NULL_TREE to
132 keep TYPE. */
133
134tree
135cp_get_debug_type (const_tree type)
136{
21faa101
JM
137 tree dtype = NULL_TREE;
138
6905c577 139 if (TYPE_PTRMEMFUNC_P (type) && !typedef_variant_p (type))
21faa101
JM
140 dtype = build_offset_type (TYPE_PTRMEMFUNC_OBJECT_TYPE (type),
141 TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (type)));
142
143 /* We cannot simply return the debug type here because the function uses
144 the type canonicalization hashtable, which is GC-ed, so its behavior
145 depends on the actual collection points. Since we are building these
146 types on the fly for the debug info only, they would not be attached
147 to any GC root and always be swept, so we would make the contents of
148 the debug info depend on the collection points. */
149 if (dtype)
a49bf6f0 150 {
21faa101 151 tree ktype = CONST_CAST_TREE (type);
c89844e5 152 if (tree *slot = hash_map_safe_get (debug_type_map, ktype))
21faa101 153 return *slot;
c89844e5 154 hash_map_safe_put<hm_ggc> (debug_type_map, ktype, dtype);
a49bf6f0 155 }
6905c577 156
21faa101 157 return dtype;
6905c577
JJ
158}
159
81b42cc6
JJ
160/* Return -1 if dwarf ATTR shouldn't be added for DECL, or the attribute
161 value otherwise. */
162int
163cp_decl_dwarf_attribute (const_tree decl, int attr)
68599f33 164{
81b42cc6
JJ
165 if (decl == NULL_TREE)
166 return -1;
68599f33 167
81b42cc6
JJ
168 switch (attr)
169 {
170 case DW_AT_explicit:
171 if (TREE_CODE (decl) == FUNCTION_DECL
172 && DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl))
173 && DECL_NONCONVERTING_P (decl))
174 return 1;
175 break;
f5059223 176
81b42cc6
JJ
177 case DW_AT_deleted:
178 if (TREE_CODE (decl) == FUNCTION_DECL
f5059223 179 && DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl))
81b42cc6
JJ
180 && DECL_DELETED_FN (decl))
181 return 1;
182 break;
f5059223 183
81b42cc6
JJ
184 case DW_AT_defaulted:
185 if (TREE_CODE (decl) == FUNCTION_DECL
186 && DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl))
187 && DECL_DEFAULTED_FN (decl))
188 {
189 if (DECL_DEFAULTED_IN_CLASS_P (decl))
190 return DW_DEFAULTED_in_class;
e366d7d8 191
81b42cc6
JJ
192 if (DECL_DEFAULTED_OUTSIDE_CLASS_P (decl))
193 return DW_DEFAULTED_out_of_class;
194 }
195 break;
e366d7d8 196
8e6982f7
JJ
197 case DW_AT_const_expr:
198 if (VAR_OR_FUNCTION_DECL_P (decl) && DECL_DECLARED_CONSTEXPR_P (decl))
199 return 1;
200 break;
201
0f2a9e37
JJ
202 case DW_AT_reference:
203 if (TREE_CODE (decl) == FUNCTION_DECL
204 && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)
205 && FUNCTION_REF_QUALIFIED (TREE_TYPE (decl))
206 && !FUNCTION_RVALUE_QUALIFIED (TREE_TYPE (decl)))
207 return 1;
0f2a9e37
JJ
208 break;
209
210 case DW_AT_rvalue_reference:
211 if (TREE_CODE (decl) == FUNCTION_DECL
212 && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)
213 && FUNCTION_REF_QUALIFIED (TREE_TYPE (decl))
214 && FUNCTION_RVALUE_QUALIFIED (TREE_TYPE (decl)))
215 return 1;
0f2a9e37
JJ
216 break;
217
70d28813
JJ
218 case DW_AT_inline:
219 if (VAR_P (decl) && DECL_INLINE_VAR_P (decl))
220 {
221 if (DECL_VAR_DECLARED_INLINE_P (decl))
222 return DW_INL_declared_inlined;
223 else
224 return DW_INL_inlined;
225 }
226 break;
227
e071b767
JJ
228 case DW_AT_export_symbols:
229 if (TREE_CODE (decl) == NAMESPACE_DECL
230 && (DECL_NAMESPACE_INLINE_P (decl)
231 || (DECL_NAME (decl) == NULL_TREE && dwarf_version >= 5)))
232 return 1;
233 break;
234
81b42cc6
JJ
235 default:
236 break;
e366d7d8
AO
237 }
238
81b42cc6 239 return -1;
e366d7d8
AO
240}
241
6905c577
JJ
242/* Return -1 if dwarf ATTR shouldn't be added for TYPE, or the attribute
243 value otherwise. */
244int
245cp_type_dwarf_attribute (const_tree type, int attr)
246{
247 if (type == NULL_TREE)
248 return -1;
249
250 switch (attr)
251 {
252 case DW_AT_reference:
7bdc7e06 253 if (FUNC_OR_METHOD_TYPE_P (type)
6905c577
JJ
254 && FUNCTION_REF_QUALIFIED (type)
255 && !FUNCTION_RVALUE_QUALIFIED (type))
256 return 1;
257 break;
258
259 case DW_AT_rvalue_reference:
7bdc7e06 260 if (FUNC_OR_METHOD_TYPE_P (type)
6905c577
JJ
261 && FUNCTION_REF_QUALIFIED (type)
262 && FUNCTION_RVALUE_QUALIFIED (type))
263 return 1;
264 break;
265
266 default:
267 break;
268 }
269
270 return -1;
271}
272
b7fc43d7
RB
273/* Return the unit size of TYPE without reusable tail padding. */
274
275tree
276cp_unit_size_without_reusable_padding (tree type)
277{
278 if (CLASS_TYPE_P (type))
279 return CLASSTYPE_SIZE_UNIT (type);
280 return TYPE_SIZE_UNIT (type);
281}
282
11bb4b27
ZL
283/* Stubs to keep c-opts.c happy. */
284void
285push_file_scope (void)
286{
287}
288
289void
290pop_file_scope (void)
291{
292}
293
294/* c-pragma.c needs to query whether a decl has extern "C" linkage. */
295bool
58f9752a 296has_c_linkage (const_tree decl)
11bb4b27
ZL
297{
298 return DECL_EXTERN_C_P (decl);
299}
3ed8593d 300
c65cb8d1 301/* Return true if stmt can fall through. Used by block_may_fallthru
88cd0e88
JJ
302 default case. */
303
304bool
305cxx_block_may_fallthru (const_tree stmt)
306{
307 switch (TREE_CODE (stmt))
308 {
309 case EXPR_STMT:
310 return block_may_fallthru (EXPR_STMT_EXPR (stmt));
311
312 case THROW_EXPR:
313 return false;
314
d3eb902f
SP
315 case IF_STMT:
316 if (block_may_fallthru (THEN_CLAUSE (stmt)))
317 return true;
318 return block_may_fallthru (ELSE_CLAUSE (stmt));
319
971df602
AP
320 case CLEANUP_STMT:
321 /* Just handle the try/finally cases. */
322 if (!CLEANUP_EH_ONLY (stmt))
323 {
324 return (block_may_fallthru (CLEANUP_BODY (stmt))
325 && block_may_fallthru (CLEANUP_EXPR (stmt)));
326 }
327 return true;
328
88cd0e88 329 default:
cba079f3 330 return c_block_may_fallthru (stmt);
88cd0e88
JJ
331 }
332}
333
505dd180
NS
334/* Return the list of decls in the global namespace. */
335
336tree
337cp_get_global_decls ()
338{
339 return NAMESPACE_LEVEL (global_namespace)->names;
340}
341
f3665bd1 342/* Push DECL into the current (namespace) scope. */
505dd180
NS
343
344tree
345cp_pushdecl (tree decl)
346{
f3665bd1 347 DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
505dd180
NS
348 return pushdecl (decl);
349}
350
87e3d7cf
NS
351/* Get the global value binding of NAME. Called directly from
352 c-common.c, not via a hook. */
353
354tree
355identifier_global_value (tree name)
356{
357 return get_global_binding (name);
358}
359
bdaf8be1
JJ
360/* Similarly, but return struct/class/union NAME instead. */
361
362tree
363identifier_global_tag (tree name)
364{
4c58a32f 365 tree ret = lookup_qualified_name (global_namespace, name, LOOK_want::TYPE,
4a08009e
JJ
366 /*complain*/false);
367 if (ret == error_mark_node)
368 return NULL_TREE;
369 return ret;
bdaf8be1
JJ
370}
371
ad1539d5
MS
372/* Returns true if NAME refers to a built-in function or function-like
373 operator. */
374
375bool
376names_builtin_p (const char *name)
377{
378 tree id = get_identifier (name);
379 if (tree binding = get_global_binding (id))
380 {
ba649812
NS
381 if (TREE_CODE (binding) == FUNCTION_DECL
382 && DECL_IS_UNDECLARED_BUILTIN (binding))
ad1539d5
MS
383 return true;
384
385 /* Handle the case when an overload for a built-in name exists. */
386 if (TREE_CODE (binding) != OVERLOAD)
387 return false;
388
389 for (ovl_iterator it (binding); it; ++it)
390 {
391 tree decl = *it;
ba649812 392 if (DECL_IS_UNDECLARED_BUILTIN (decl))
ad1539d5
MS
393 return true;
394 }
395 }
396
397 /* Also detect common reserved C++ words that aren't strictly built-in
398 functions. */
399 switch (C_RID_CODE (id))
400 {
401 case RID_ADDRESSOF:
402 case RID_BUILTIN_CONVERTVECTOR:
403 case RID_BUILTIN_HAS_ATTRIBUTE:
404 case RID_BUILTIN_SHUFFLE:
ef8176e0 405 case RID_BUILTIN_SHUFFLEVECTOR:
ad1539d5 406 case RID_BUILTIN_LAUNDER:
efb7c510 407 case RID_BUILTIN_ASSOC_BARRIER:
896048cf 408 case RID_BUILTIN_BIT_CAST:
ad1539d5
MS
409 case RID_OFFSETOF:
410 case RID_HAS_NOTHROW_ASSIGN:
411 case RID_HAS_NOTHROW_CONSTRUCTOR:
412 case RID_HAS_NOTHROW_COPY:
413 case RID_HAS_TRIVIAL_ASSIGN:
414 case RID_HAS_TRIVIAL_CONSTRUCTOR:
415 case RID_HAS_TRIVIAL_COPY:
416 case RID_HAS_TRIVIAL_DESTRUCTOR:
417 case RID_HAS_UNIQUE_OBJ_REPRESENTATIONS:
418 case RID_HAS_VIRTUAL_DESTRUCTOR:
419 case RID_IS_ABSTRACT:
420 case RID_IS_AGGREGATE:
421 case RID_IS_BASE_OF:
422 case RID_IS_CLASS:
423 case RID_IS_EMPTY:
424 case RID_IS_ENUM:
425 case RID_IS_FINAL:
32c3a753 426 case RID_IS_LAYOUT_COMPATIBLE:
ad1539d5 427 case RID_IS_LITERAL_TYPE:
6cd005a2 428 case RID_IS_POINTER_INTERCONVERTIBLE_BASE_OF:
ad1539d5
MS
429 case RID_IS_POD:
430 case RID_IS_POLYMORPHIC:
431 case RID_IS_SAME_AS:
432 case RID_IS_STD_LAYOUT:
433 case RID_IS_TRIVIAL:
434 case RID_IS_TRIVIALLY_ASSIGNABLE:
435 case RID_IS_TRIVIALLY_CONSTRUCTIBLE:
436 case RID_IS_TRIVIALLY_COPYABLE:
437 case RID_IS_UNION:
438 case RID_IS_ASSIGNABLE:
439 case RID_IS_CONSTRUCTIBLE:
440 case RID_UNDERLYING_TYPE:
441 return true;
442 default:
443 break;
444 }
445
446 return false;
447}
448
2a8a8d7b
NS
449/* Register c++-specific dumps. */
450
451void
452cp_register_dumps (gcc::dump_manager *dumps)
453{
454 class_dump_id = dumps->dump_register
455 (".class", "lang-class", "lang-class", DK_lang, OPTGROUP_NONE, false);
58aca9d9 456
97b56dec
NS
457 module_dump_id = dumps->dump_register
458 (".module", "lang-module", "lang-module", DK_lang, OPTGROUP_NONE, false);
459
58aca9d9
NS
460 raw_dump_id = dumps->dump_register
461 (".raw", "lang-raw", "lang-raw", DK_lang, OPTGROUP_NONE, false);
2a8a8d7b
NS
462}
463
81f653d6
NF
464void
465cp_common_init_ts (void)
466{
7994803c
NS
467 /* With type. */
468 MARK_TS_TYPED (PTRMEM_CST);
469 MARK_TS_TYPED (LAMBDA_EXPR);
470 MARK_TS_TYPED (TYPE_ARGUMENT_PACK);
81f653d6 471
7994803c
NS
472 /* Random new trees. */
473 MARK_TS_COMMON (BASELINK);
81f653d6 474 MARK_TS_COMMON (OVERLOAD);
7994803c 475 MARK_TS_COMMON (TEMPLATE_PARM_INDEX);
81f653d6 476
7994803c
NS
477 /* New decls. */
478 MARK_TS_DECL_COMMON (TEMPLATE_DECL);
479 MARK_TS_DECL_COMMON (WILDCARD_DECL);
cb57504a 480 MARK_TS_DECL_COMMON (CONCEPT_DECL);
7994803c
NS
481
482 MARK_TS_DECL_NON_COMMON (USING_DECL);
598f50d7 483
7994803c 484 /* New Types. */
0b7a1187
JM
485 MARK_TS_TYPE_COMMON (UNBOUND_CLASS_TEMPLATE);
486 MARK_TS_TYPE_COMMON (TYPE_ARGUMENT_PACK);
bb2a7f80 487 MARK_TS_TYPE_COMMON (DEPENDENT_OPERATOR_TYPE);
0b7a1187
JM
488
489 MARK_TS_TYPE_NON_COMMON (DECLTYPE_TYPE);
490 MARK_TS_TYPE_NON_COMMON (TYPENAME_TYPE);
491 MARK_TS_TYPE_NON_COMMON (TYPEOF_TYPE);
492 MARK_TS_TYPE_NON_COMMON (UNDERLYING_TYPE);
7994803c
NS
493 MARK_TS_TYPE_NON_COMMON (BOUND_TEMPLATE_TEMPLATE_PARM);
494 MARK_TS_TYPE_NON_COMMON (TEMPLATE_TEMPLATE_PARM);
495 MARK_TS_TYPE_NON_COMMON (TEMPLATE_TYPE_PARM);
7994803c
NS
496 MARK_TS_TYPE_NON_COMMON (TYPE_PACK_EXPANSION);
497
498 /* Statements. */
7994803c 499 MARK_TS_EXP (CLEANUP_STMT);
7994803c 500 MARK_TS_EXP (EH_SPEC_BLOCK);
7994803c
NS
501 MARK_TS_EXP (HANDLER);
502 MARK_TS_EXP (IF_STMT);
503 MARK_TS_EXP (OMP_DEPOBJ);
504 MARK_TS_EXP (RANGE_FOR_STMT);
7994803c
NS
505 MARK_TS_EXP (TRY_BLOCK);
506 MARK_TS_EXP (USING_STMT);
7994803c
NS
507
508 /* Random expressions. */
509 MARK_TS_EXP (ADDRESSOF_EXPR);
598f50d7 510 MARK_TS_EXP (AGGR_INIT_EXPR);
7994803c
NS
511 MARK_TS_EXP (ALIGNOF_EXPR);
512 MARK_TS_EXP (ARROW_EXPR);
513 MARK_TS_EXP (AT_ENCODE_EXPR);
896048cf 514 MARK_TS_EXP (BIT_CAST_EXPR);
7994803c
NS
515 MARK_TS_EXP (CAST_EXPR);
516 MARK_TS_EXP (CONST_CAST_EXPR);
598f50d7 517 MARK_TS_EXP (CTOR_INITIALIZER);
7994803c
NS
518 MARK_TS_EXP (DELETE_EXPR);
519 MARK_TS_EXP (DOTSTAR_EXPR);
520 MARK_TS_EXP (DYNAMIC_CAST_EXPR);
598f50d7 521 MARK_TS_EXP (EMPTY_CLASS_EXPR);
7994803c
NS
522 MARK_TS_EXP (EXPR_STMT);
523 MARK_TS_EXP (IMPLICIT_CONV_EXPR);
524 MARK_TS_EXP (MEMBER_REF);
598f50d7 525 MARK_TS_EXP (MODOP_EXPR);
7994803c
NS
526 MARK_TS_EXP (MUST_NOT_THROW_EXPR);
527 MARK_TS_EXP (NEW_EXPR);
528 MARK_TS_EXP (NOEXCEPT_EXPR);
529 MARK_TS_EXP (NON_DEPENDENT_EXPR);
530 MARK_TS_EXP (OFFSETOF_EXPR);
531 MARK_TS_EXP (OFFSET_REF);
532 MARK_TS_EXP (PSEUDO_DTOR_EXPR);
598f50d7 533 MARK_TS_EXP (REINTERPRET_CAST_EXPR);
7994803c 534 MARK_TS_EXP (SCOPE_REF);
598f50d7 535 MARK_TS_EXP (STATIC_CAST_EXPR);
7994803c
NS
536 MARK_TS_EXP (STMT_EXPR);
537 MARK_TS_EXP (TAG_DEFN);
598f50d7 538 MARK_TS_EXP (TEMPLATE_ID_EXPR);
7994803c 539 MARK_TS_EXP (THROW_EXPR);
598f50d7 540 MARK_TS_EXP (TRAIT_EXPR);
598f50d7 541 MARK_TS_EXP (TYPEID_EXPR);
7994803c
NS
542 MARK_TS_EXP (TYPE_EXPR);
543 MARK_TS_EXP (UNARY_PLUS_EXPR);
544 MARK_TS_EXP (VEC_DELETE_EXPR);
598f50d7 545 MARK_TS_EXP (VEC_INIT_EXPR);
7994803c 546 MARK_TS_EXP (VEC_NEW_EXPR);
b7689b96 547 MARK_TS_EXP (SPACESHIP_EXPR);
598f50d7 548
7994803c
NS
549 /* Fold expressions. */
550 MARK_TS_EXP (BINARY_LEFT_FOLD_EXPR);
551 MARK_TS_EXP (BINARY_RIGHT_FOLD_EXPR);
598f50d7 552 MARK_TS_EXP (EXPR_PACK_EXPANSION);
7994803c 553 MARK_TS_EXP (NONTYPE_ARGUMENT_PACK);
598f50d7
NS
554 MARK_TS_EXP (UNARY_LEFT_FOLD_EXPR);
555 MARK_TS_EXP (UNARY_RIGHT_FOLD_EXPR);
598f50d7 556
7994803c 557 /* Constraints. */
598f50d7 558 MARK_TS_EXP (CHECK_CONSTR);
7994803c
NS
559 MARK_TS_EXP (COMPOUND_REQ);
560 MARK_TS_EXP (CONJ_CONSTR);
7994803c 561 MARK_TS_EXP (DISJ_CONSTR);
cb57504a 562 MARK_TS_EXP (ATOMIC_CONSTR);
7994803c 563 MARK_TS_EXP (NESTED_REQ);
7994803c
NS
564 MARK_TS_EXP (REQUIRES_EXPR);
565 MARK_TS_EXP (SIMPLE_REQ);
7994803c 566 MARK_TS_EXP (TYPE_REQ);
598f50d7 567
49789fd0
IS
568 MARK_TS_EXP (CO_AWAIT_EXPR);
569 MARK_TS_EXP (CO_YIELD_EXPR);
570 MARK_TS_EXP (CO_RETURN_EXPR);
571
598f50d7 572 c_common_init_ts ();
81f653d6 573}
3ed8593d 574
97b56dec
NS
575/* Handle C++-specficic options here. Punt to c_common otherwise. */
576
577bool
578cp_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
579 int kind, location_t loc,
580 const struct cl_option_handlers *handlers)
581{
582 if (handle_module_option (unsigned (scode), arg, value))
583 return true;
584 return c_common_handle_option (scode, arg, value, kind, loc, handlers);
585}
586
3ed8593d 587#include "gt-cp-cp-objcp-common.h"