Line data Source code
1 : /* Some code common to C++ and ObjC++ front ends.
2 : Copyright (C) 2004-2023 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 "dwarf2.h"
27 : #include "stringpool.h"
28 : #include "contracts.h"
29 :
30 : /* Special routine to get the alias set for C++. */
31 :
32 : alias_set_type
33 209741028 : cxx_get_alias_set (tree t)
34 : {
35 209741028 : if (IS_FAKE_BASE_TYPE (t))
36 : /* The base variant of a type must be in the same alias set as the
37 : complete type. */
38 535553 : return get_alias_set (TYPE_CONTEXT (t));
39 :
40 : /* Punt on PMFs until we canonicalize functions properly. */
41 502385 : if (TYPE_PTRMEMFUNC_P (t)
42 209530527 : || (INDIRECT_TYPE_P (t)
43 320615 : && TYPE_PTRMEMFUNC_P (TREE_TYPE (t))))
44 : return 0;
45 :
46 209011124 : return c_common_get_alias_set (t);
47 : }
48 :
49 : /* Called from check_global_declaration. */
50 :
51 : bool
52 3013 : cxx_warn_unused_global_decl (const_tree decl)
53 : {
54 3013 : if (TREE_CODE (decl) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (decl))
55 : return false;
56 92 : if (DECL_IN_SYSTEM_HEADER (decl))
57 : return false;
58 :
59 : return true;
60 : }
61 :
62 : /* Langhook for tree_size: determine size of our 'x' and 'c' nodes. */
63 : size_t
64 1444616655 : cp_tree_size (enum tree_code code)
65 : {
66 1444616655 : gcc_checking_assert (code >= NUM_TREE_CODES);
67 1444616655 : switch (code)
68 : {
69 : case PTRMEM_CST: return sizeof (ptrmem_cst);
70 : case BASELINK: return sizeof (tree_baselink);
71 : case TEMPLATE_PARM_INDEX: return sizeof (template_parm_index);
72 : case DEFERRED_PARSE: return sizeof (tree_deferred_parse);
73 : case DEFERRED_NOEXCEPT: return sizeof (tree_deferred_noexcept);
74 : case OVERLOAD: return sizeof (tree_overload);
75 : case STATIC_ASSERT: return sizeof (tree_static_assert);
76 : #if 0
77 : /* This would match cp_common_init_ts, but breaks GC because
78 : tree_node_structure_for_code returns TS_TYPE_NON_COMMON for all
79 : types. */
80 : case UNBOUND_CLASS_TEMPLATE:
81 : case TYPE_ARGUMENT_PACK: return sizeof (tree_type_common);
82 : #endif
83 : case ARGUMENT_PACK_SELECT: return sizeof (tree_argument_pack_select);
84 : case TRAIT_EXPR: return sizeof (tree_trait_expr);
85 251836 : case LAMBDA_EXPR: return sizeof (tree_lambda_expr);
86 : case TEMPLATE_INFO: return sizeof (tree_template_info);
87 : case CONSTRAINT_INFO: return sizeof (tree_constraint_info);
88 : case USERDEF_LITERAL: return sizeof (tree_userdef_literal);
89 132876223 : case TEMPLATE_DECL: return sizeof (tree_template_decl);
90 : case ASSERTION_STMT: return sizeof (tree_exp);
91 : case PRECONDITION_STMT: return sizeof (tree_exp);
92 : case POSTCONDITION_STMT: return sizeof (tree_exp);
93 429602771 : default:
94 429602771 : switch (TREE_CODE_CLASS (code))
95 : {
96 : case tcc_declaration: return sizeof (tree_decl_non_common);
97 411072191 : case tcc_type: return sizeof (tree_type_non_common);
98 0 : default: gcc_unreachable ();
99 : }
100 : }
101 : /* NOTREACHED */
102 : }
103 :
104 : /* Returns true if T is a variably modified type, in the sense of C99.
105 : FN is as passed to variably_modified_p.
106 : This routine needs only check cases that cannot be handled by the
107 : language-independent logic in tree.cc. */
108 :
109 : bool
110 885385009 : cp_var_mod_type_p (tree type, tree fn)
111 : {
112 : /* If TYPE is a pointer-to-member, it is variably modified if either
113 : the class or the member are variably modified. */
114 885385009 : if (TYPE_PTRMEM_P (type))
115 1514054 : return (variably_modified_type_p (TYPE_PTRMEM_CLASS_TYPE (type), fn)
116 1514054 : || variably_modified_type_p (TYPE_PTRMEM_POINTED_TO_TYPE (type),
117 : fn));
118 :
119 : /* All other types are not variably modified. */
120 : return false;
121 : }
122 :
123 : /* This compares two types for equivalence ("compatible" in C-based languages).
124 : This routine should only return 1 if it is sure. It should not be used
125 : in contexts where erroneously returning 0 causes problems. */
126 :
127 : int
128 1107199 : cxx_types_compatible_p (tree x, tree y)
129 : {
130 1107199 : return same_type_ignoring_top_level_qualifiers_p (x, y);
131 : }
132 :
133 : static GTY((cache)) type_tree_cache_map *debug_type_map;
134 :
135 : /* Return a type to use in the debug info instead of TYPE, or NULL_TREE to
136 : keep TYPE. */
137 :
138 : tree
139 646656100 : cp_get_debug_type (const_tree type)
140 : {
141 646656100 : tree dtype = NULL_TREE;
142 :
143 646656100 : if (TYPE_PTRMEMFUNC_P (type) && !typedef_variant_p (type))
144 225420 : dtype = build_offset_type (TYPE_PTRMEMFUNC_OBJECT_TYPE (type),
145 225420 : TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (type)));
146 :
147 : /* We cannot simply return the debug type here because the function uses
148 : the type canonicalization hashtable, which is GC-ed, so its behavior
149 : depends on the actual collection points. Since we are building these
150 : types on the fly for the debug info only, they would not be attached
151 : to any GC root and always be swept, so we would make the contents of
152 : the debug info depend on the collection points. */
153 646656100 : if (dtype)
154 : {
155 225420 : tree ktype = CONST_CAST_TREE (type);
156 443740 : if (tree *slot = hash_map_safe_get (debug_type_map, ktype))
157 202898 : return *slot;
158 22522 : hash_map_safe_put<hm_ggc> (debug_type_map, ktype, dtype);
159 : }
160 :
161 : return dtype;
162 : }
163 :
164 : /* Return -1 if dwarf ATTR shouldn't be added for DECL, or the attribute
165 : value otherwise. */
166 : int
167 292286405 : cp_decl_dwarf_attribute (const_tree decl, int attr)
168 : {
169 292286405 : if (decl == NULL_TREE)
170 : return -1;
171 :
172 292286405 : switch (attr)
173 : {
174 50392260 : case DW_AT_explicit:
175 50392260 : if (TREE_CODE (decl) == FUNCTION_DECL
176 50392260 : && DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl))
177 100784420 : && DECL_NONCONVERTING_P (decl))
178 1250813 : return 1;
179 : break;
180 :
181 50392236 : case DW_AT_deleted:
182 50392236 : if (TREE_CODE (decl) == FUNCTION_DECL
183 50392236 : && DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl))
184 100784372 : && DECL_DELETED_FN (decl))
185 1459405 : return 1;
186 : break;
187 :
188 51262331 : case DW_AT_defaulted:
189 51262331 : if (TREE_CODE (decl) == FUNCTION_DECL
190 51262331 : && DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl))
191 102524562 : && DECL_DEFAULTED_FN (decl))
192 : {
193 3378399 : if (DECL_DEFAULTED_IN_CLASS_P (decl))
194 : return DW_DEFAULTED_in_class;
195 :
196 413886 : if (DECL_DEFAULTED_OUTSIDE_CLASS_P (decl))
197 580 : return DW_DEFAULTED_out_of_class;
198 : }
199 : break;
200 :
201 14860520 : case DW_AT_const_expr:
202 14860520 : if (VAR_OR_FUNCTION_DECL_P (decl) && DECL_DECLARED_CONSTEXPR_P (decl))
203 11676475 : return 1;
204 : break;
205 :
206 50392236 : case DW_AT_reference:
207 50392236 : if (TREE_CODE (decl) == FUNCTION_DECL
208 50392236 : && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)
209 42856981 : && FUNCTION_REF_QUALIFIED (TREE_TYPE (decl))
210 50414773 : && !FUNCTION_RVALUE_QUALIFIED (TREE_TYPE (decl)))
211 11282 : return 1;
212 : break;
213 :
214 50392236 : case DW_AT_rvalue_reference:
215 50392236 : if (TREE_CODE (decl) == FUNCTION_DECL
216 50392236 : && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)
217 42856981 : && FUNCTION_REF_QUALIFIED (TREE_TYPE (decl))
218 50414773 : && FUNCTION_RVALUE_QUALIFIED (TREE_TYPE (decl)))
219 11255 : return 1;
220 : break;
221 :
222 24285572 : case DW_AT_inline:
223 24285572 : if (VAR_P (decl) && DECL_INLINE_VAR_P (decl))
224 : {
225 20301699 : if (DECL_VAR_DECLARED_INLINE_P (decl))
226 : return DW_INL_declared_inlined;
227 : else
228 17756238 : return DW_INL_inlined;
229 : }
230 : break;
231 :
232 309014 : case DW_AT_export_symbols:
233 309014 : if (TREE_CODE (decl) == NAMESPACE_DECL
234 309014 : && (DECL_NAMESPACE_INLINE_P (decl)
235 168473 : || (DECL_NAME (decl) == NULL_TREE && dwarf_version >= 5)))
236 141524 : return 1;
237 : break;
238 :
239 : default:
240 : break;
241 : }
242 :
243 : return -1;
244 : }
245 :
246 : /* Return -1 if dwarf ATTR shouldn't be added for TYPE, or the attribute
247 : value otherwise. */
248 : int
249 425184 : cp_type_dwarf_attribute (const_tree type, int attr)
250 : {
251 425184 : if (type == NULL_TREE)
252 : return -1;
253 :
254 425184 : switch (attr)
255 : {
256 212592 : case DW_AT_reference:
257 212592 : if (FUNC_OR_METHOD_TYPE_P (type)
258 212592 : && FUNCTION_REF_QUALIFIED (type)
259 212690 : && !FUNCTION_RVALUE_QUALIFIED (type))
260 72 : return 1;
261 : break;
262 :
263 212592 : case DW_AT_rvalue_reference:
264 212592 : if (FUNC_OR_METHOD_TYPE_P (type)
265 212592 : && FUNCTION_REF_QUALIFIED (type)
266 212690 : && FUNCTION_RVALUE_QUALIFIED (type))
267 26 : return 1;
268 : break;
269 :
270 : default:
271 : break;
272 : }
273 :
274 : return -1;
275 : }
276 :
277 : /* Return the unit size of TYPE without reusable tail padding. */
278 :
279 : tree
280 16643 : cp_unit_size_without_reusable_padding (tree type)
281 : {
282 16643 : if (CLASS_TYPE_P (type))
283 16643 : return CLASSTYPE_SIZE_UNIT (type);
284 0 : return TYPE_SIZE_UNIT (type);
285 : }
286 :
287 : /* Returns type corresponding to FIELD's type when FIELD is a C++ base class
288 : i.e., type without virtual base classes or tail padding. Returns
289 : NULL_TREE otherwise. */
290 :
291 : tree
292 2417 : cp_classtype_as_base (const_tree field)
293 : {
294 2417 : if (DECL_FIELD_IS_BASE (field))
295 : {
296 212 : tree type = TREE_TYPE (field);
297 212 : if (TYPE_LANG_SPECIFIC (type))
298 205 : return CLASSTYPE_AS_BASE (type);
299 : }
300 : return NULL_TREE;
301 : }
302 :
303 : /* Stubs to keep c-opts.cc happy. */
304 : void
305 88525 : push_file_scope (void)
306 : {
307 88525 : }
308 :
309 : void
310 88402 : pop_file_scope (void)
311 : {
312 88402 : }
313 :
314 : /* c-pragma.cc needs to query whether a decl has extern "C" linkage. */
315 : bool
316 30454913 : has_c_linkage (const_tree decl)
317 : {
318 30454913 : return DECL_EXTERN_C_P (decl);
319 : }
320 :
321 : /* Return true if stmt can fall through. Used by block_may_fallthru
322 : default case. */
323 :
324 : bool
325 1739328 : cxx_block_may_fallthru (const_tree stmt)
326 : {
327 1739328 : switch (TREE_CODE (stmt))
328 : {
329 806895 : case EXPR_STMT:
330 806895 : return block_may_fallthru (EXPR_STMT_EXPR (stmt));
331 :
332 : case THROW_EXPR:
333 : return false;
334 :
335 248262 : case IF_STMT:
336 248262 : if (IF_STMT_CONSTEXPR_P (stmt))
337 : {
338 172 : if (integer_nonzerop (IF_COND (stmt)))
339 14 : return block_may_fallthru (THEN_CLAUSE (stmt));
340 158 : if (integer_zerop (IF_COND (stmt)))
341 42 : return block_may_fallthru (ELSE_CLAUSE (stmt));
342 : }
343 248206 : if (block_may_fallthru (THEN_CLAUSE (stmt)))
344 : return true;
345 1214 : return block_may_fallthru (ELSE_CLAUSE (stmt));
346 :
347 12 : case CLEANUP_STMT:
348 : /* Just handle the try/finally cases. */
349 12 : if (!CLEANUP_EH_ONLY (stmt))
350 : {
351 12 : return (block_may_fallthru (CLEANUP_BODY (stmt))
352 20 : && block_may_fallthru (CLEANUP_EXPR (stmt)));
353 : }
354 : return true;
355 :
356 684135 : default:
357 684135 : return c_block_may_fallthru (stmt);
358 : }
359 : }
360 :
361 : /* Return the list of decls in the global namespace. */
362 :
363 : tree
364 0 : cp_get_global_decls ()
365 : {
366 0 : return NAMESPACE_LEVEL (global_namespace)->names;
367 : }
368 :
369 : /* Push DECL into the current (namespace) scope. */
370 :
371 : tree
372 1782429 : cp_pushdecl (tree decl)
373 : {
374 1782429 : DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
375 1782429 : return pushdecl (decl);
376 : }
377 :
378 : /* Get the global value binding of NAME. Called directly from
379 : c-common.cc, not via a hook. */
380 :
381 : tree
382 3124153 : identifier_global_value (tree name)
383 : {
384 3124153 : return get_global_binding (name);
385 : }
386 :
387 : /* Similarly, but return struct/class/union NAME instead. */
388 :
389 : tree
390 12 : identifier_global_tag (tree name)
391 : {
392 12 : tree ret = lookup_qualified_name (global_namespace, name, LOOK_want::TYPE,
393 : /*complain*/false);
394 12 : if (ret == error_mark_node)
395 4 : return NULL_TREE;
396 : return ret;
397 : }
398 :
399 : /* Returns true if NAME refers to a built-in function or function-like
400 : operator. */
401 :
402 : bool
403 284631 : names_builtin_p (const char *name)
404 : {
405 284631 : tree id = get_identifier (name);
406 284631 : if (tree binding = get_global_binding (id))
407 : {
408 79558 : if (TREE_CODE (binding) == FUNCTION_DECL
409 79558 : && DECL_IS_UNDECLARED_BUILTIN (binding))
410 : return true;
411 :
412 : /* Handle the case when an overload for a built-in name exists. */
413 12 : if (TREE_CODE (binding) != OVERLOAD)
414 : return false;
415 :
416 12 : for (ovl_iterator it (binding); it; ++it)
417 : {
418 12 : tree decl = *it;
419 12 : if (DECL_IS_UNDECLARED_BUILTIN (decl))
420 12 : return true;
421 : }
422 : }
423 :
424 : /* Also detect common reserved C++ words that aren't strictly built-in
425 : functions. */
426 205073 : switch (C_RID_CODE (id))
427 : {
428 : case RID_ADDRESSOF:
429 : case RID_BUILTIN_CONVERTVECTOR:
430 : case RID_BUILTIN_HAS_ATTRIBUTE:
431 : case RID_BUILTIN_SHUFFLE:
432 : case RID_BUILTIN_SHUFFLEVECTOR:
433 : case RID_BUILTIN_LAUNDER:
434 : case RID_BUILTIN_ASSOC_BARRIER:
435 : case RID_BUILTIN_BIT_CAST:
436 : case RID_OFFSETOF:
437 : #define DEFTRAIT(TCC, CODE, NAME, ARITY) \
438 : case RID_##CODE:
439 : #include "cp-trait.def"
440 : #undef DEFTRAIT
441 : return true;
442 : default:
443 : break;
444 : }
445 :
446 : return false;
447 : }
448 :
449 : /* Register c++-specific dumps. */
450 :
451 : void
452 89300 : cp_register_dumps (gcc::dump_manager *dumps)
453 : {
454 178600 : class_dump_id = dumps->dump_register
455 89300 : (".class", "lang-class", "lang-class", DK_lang, OPTGROUP_NONE, false);
456 :
457 178600 : module_dump_id = dumps->dump_register
458 89300 : (".module", "lang-module", "lang-module", DK_lang, OPTGROUP_NONE, false);
459 :
460 178600 : raw_dump_id = dumps->dump_register
461 89300 : (".raw", "lang-raw", "lang-raw", DK_lang, OPTGROUP_NONE, false);
462 89300 : }
463 :
464 : void
465 89300 : cp_common_init_ts (void)
466 : {
467 : /* With type. */
468 89300 : MARK_TS_TYPED (PTRMEM_CST);
469 89300 : MARK_TS_TYPED (LAMBDA_EXPR);
470 89300 : MARK_TS_TYPED (TYPE_ARGUMENT_PACK);
471 :
472 : /* Random new trees. */
473 89300 : MARK_TS_COMMON (BASELINK);
474 89300 : MARK_TS_COMMON (OVERLOAD);
475 89300 : MARK_TS_COMMON (TEMPLATE_PARM_INDEX);
476 :
477 : /* New decls. */
478 89300 : MARK_TS_DECL_COMMON (TEMPLATE_DECL);
479 89300 : MARK_TS_DECL_COMMON (WILDCARD_DECL);
480 :
481 89300 : MARK_TS_DECL_NON_COMMON (USING_DECL);
482 :
483 : /* New Types. */
484 89300 : MARK_TS_TYPE_COMMON (UNBOUND_CLASS_TEMPLATE);
485 89300 : MARK_TS_TYPE_COMMON (TYPE_ARGUMENT_PACK);
486 89300 : MARK_TS_TYPE_COMMON (DEPENDENT_OPERATOR_TYPE);
487 :
488 89300 : MARK_TS_TYPE_NON_COMMON (DECLTYPE_TYPE);
489 89300 : MARK_TS_TYPE_NON_COMMON (TYPENAME_TYPE);
490 89300 : MARK_TS_TYPE_NON_COMMON (TYPEOF_TYPE);
491 89300 : MARK_TS_TYPE_NON_COMMON (TRAIT_TYPE);
492 89300 : MARK_TS_TYPE_NON_COMMON (BOUND_TEMPLATE_TEMPLATE_PARM);
493 89300 : MARK_TS_TYPE_NON_COMMON (TEMPLATE_TEMPLATE_PARM);
494 89300 : MARK_TS_TYPE_NON_COMMON (TEMPLATE_TYPE_PARM);
495 89300 : MARK_TS_TYPE_NON_COMMON (TYPE_PACK_EXPANSION);
496 :
497 : /* Statements. */
498 89300 : MARK_TS_EXP (CLEANUP_STMT);
499 89300 : MARK_TS_EXP (EH_SPEC_BLOCK);
500 89300 : MARK_TS_EXP (HANDLER);
501 89300 : MARK_TS_EXP (IF_STMT);
502 89300 : MARK_TS_EXP (OMP_DEPOBJ);
503 89300 : MARK_TS_EXP (RANGE_FOR_STMT);
504 89300 : MARK_TS_EXP (TRY_BLOCK);
505 89300 : MARK_TS_EXP (USING_STMT);
506 :
507 : /* Random expressions. */
508 89300 : MARK_TS_EXP (ADDRESSOF_EXPR);
509 89300 : MARK_TS_EXP (AGGR_INIT_EXPR);
510 89300 : MARK_TS_EXP (ALIGNOF_EXPR);
511 89300 : MARK_TS_EXP (ARROW_EXPR);
512 89300 : MARK_TS_EXP (AT_ENCODE_EXPR);
513 89300 : MARK_TS_EXP (BIT_CAST_EXPR);
514 89300 : MARK_TS_EXP (CAST_EXPR);
515 89300 : MARK_TS_EXP (CONST_CAST_EXPR);
516 89300 : MARK_TS_EXP (CTOR_INITIALIZER);
517 89300 : MARK_TS_EXP (DELETE_EXPR);
518 89300 : MARK_TS_EXP (DOTSTAR_EXPR);
519 89300 : MARK_TS_EXP (DYNAMIC_CAST_EXPR);
520 89300 : MARK_TS_EXP (EMPTY_CLASS_EXPR);
521 89300 : MARK_TS_EXP (EXPR_STMT);
522 89300 : MARK_TS_EXP (IMPLICIT_CONV_EXPR);
523 89300 : MARK_TS_EXP (MEMBER_REF);
524 89300 : MARK_TS_EXP (MODOP_EXPR);
525 89300 : MARK_TS_EXP (MUST_NOT_THROW_EXPR);
526 89300 : MARK_TS_EXP (NEW_EXPR);
527 89300 : MARK_TS_EXP (NOEXCEPT_EXPR);
528 89300 : MARK_TS_EXP (NON_DEPENDENT_EXPR);
529 89300 : MARK_TS_EXP (OFFSETOF_EXPR);
530 89300 : MARK_TS_EXP (OFFSET_REF);
531 89300 : MARK_TS_EXP (PSEUDO_DTOR_EXPR);
532 89300 : MARK_TS_EXP (REINTERPRET_CAST_EXPR);
533 89300 : MARK_TS_EXP (SCOPE_REF);
534 89300 : MARK_TS_EXP (STATIC_CAST_EXPR);
535 89300 : MARK_TS_EXP (STMT_EXPR);
536 89300 : MARK_TS_EXP (TAG_DEFN);
537 89300 : MARK_TS_EXP (TEMPLATE_ID_EXPR);
538 89300 : MARK_TS_EXP (THROW_EXPR);
539 89300 : MARK_TS_EXP (TRAIT_EXPR);
540 89300 : MARK_TS_EXP (TYPEID_EXPR);
541 89300 : MARK_TS_EXP (TYPE_EXPR);
542 89300 : MARK_TS_EXP (UNARY_PLUS_EXPR);
543 89300 : MARK_TS_EXP (VEC_DELETE_EXPR);
544 89300 : MARK_TS_EXP (VEC_INIT_EXPR);
545 89300 : MARK_TS_EXP (VEC_NEW_EXPR);
546 89300 : MARK_TS_EXP (SPACESHIP_EXPR);
547 :
548 : /* Fold expressions. */
549 89300 : MARK_TS_EXP (BINARY_LEFT_FOLD_EXPR);
550 89300 : MARK_TS_EXP (BINARY_RIGHT_FOLD_EXPR);
551 89300 : MARK_TS_EXP (EXPR_PACK_EXPANSION);
552 89300 : MARK_TS_EXP (NONTYPE_ARGUMENT_PACK);
553 89300 : MARK_TS_EXP (UNARY_LEFT_FOLD_EXPR);
554 89300 : MARK_TS_EXP (UNARY_RIGHT_FOLD_EXPR);
555 :
556 : /* Constraints. */
557 89300 : MARK_TS_EXP (CHECK_CONSTR);
558 89300 : MARK_TS_EXP (COMPOUND_REQ);
559 89300 : MARK_TS_EXP (CONJ_CONSTR);
560 89300 : MARK_TS_EXP (DISJ_CONSTR);
561 89300 : MARK_TS_EXP (ATOMIC_CONSTR);
562 89300 : MARK_TS_EXP (NESTED_REQ);
563 89300 : MARK_TS_EXP (REQUIRES_EXPR);
564 89300 : MARK_TS_EXP (SIMPLE_REQ);
565 89300 : MARK_TS_EXP (TYPE_REQ);
566 :
567 89300 : MARK_TS_EXP (CO_AWAIT_EXPR);
568 89300 : MARK_TS_EXP (CO_YIELD_EXPR);
569 89300 : MARK_TS_EXP (CO_RETURN_EXPR);
570 :
571 89300 : MARK_TS_EXP (ASSERTION_STMT);
572 89300 : MARK_TS_EXP (PRECONDITION_STMT);
573 89300 : MARK_TS_EXP (POSTCONDITION_STMT);
574 :
575 89300 : c_common_init_ts ();
576 89300 : }
577 :
578 : /* Handle C++-specficic options here. Punt to c_common otherwise. */
579 :
580 : bool
581 1760189 : cp_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
582 : int kind, location_t loc,
583 : const struct cl_option_handlers *handlers)
584 : {
585 1760189 : if (handle_module_option (unsigned (scode), arg, value))
586 : return true;
587 :
588 1759480 : enum opt_code code = (enum opt_code) scode;
589 1759480 : bool handled_p = true;
590 :
591 1759480 : switch (code)
592 : {
593 4 : case OPT_fcontract_build_level_:
594 4 : handle_OPT_fcontract_build_level_ (arg);
595 4 : break;
596 :
597 0 : case OPT_fcontract_assumption_mode_:
598 0 : handle_OPT_fcontract_assumption_mode_ (arg);
599 0 : break;
600 :
601 43 : case OPT_fcontract_continuation_mode_:
602 43 : handle_OPT_fcontract_continuation_mode_ (arg);
603 43 : break;
604 :
605 25 : case OPT_fcontract_role_:
606 25 : handle_OPT_fcontract_role_ (arg);
607 25 : break;
608 :
609 3 : case OPT_fcontract_semantic_:
610 3 : handle_OPT_fcontract_semantic_ (arg);
611 3 : break;
612 :
613 : default:
614 : handled_p = false;
615 : break;
616 : }
617 75 : if (handled_p)
618 75 : return handled_p;
619 :
620 1759405 : return c_common_handle_option (scode, arg, value, kind, loc, handlers);
621 : }
622 :
623 : #include "gt-cp-cp-objcp-common.h"
|