tree lambda_proxy_type (tree ref) { tree type; if (ref == error_mark_node) return error_mark_node; if (REFERENCE_REF_P (ref)) ref = TREE_OPERAND (ref, 0); gcc_assert (TREE_CODE (ref) == COMPONENT_REF); type = TREE_TYPE (ref); if (!type || WILDCARD_TYPE_P (non_reference (type))) { type = cxx_make_type (DECLTYPE_TYPE); DECLTYPE_TYPE_EXPR (type) = ref; DECLTYPE_FOR_LAMBDA_PROXY (type) = true; SET_TYPE_STRUCTURAL_EQUALITY (type); } if (DECL_PACK_P (TREE_OPERAND (ref, 1))) type = make_pack_expansion (type); return type; }
tree lambda_capture_field_type (tree expr, bool explicit_init_p) { tree type; if (explicit_init_p) { type = make_auto (); type = do_auto_deduction (type, expr, type); } else type = non_reference (unlowered_expr_type (expr)); if (!type || WILDCARD_TYPE_P (type) || type_uses_auto (type) || DECL_PACK_P (expr)) { type = cxx_make_type (DECLTYPE_TYPE); DECLTYPE_TYPE_EXPR (type) = expr; DECLTYPE_FOR_LAMBDA_CAPTURE (type) = true; DECLTYPE_FOR_INIT_CAPTURE (type) = explicit_init_p; SET_TYPE_STRUCTURAL_EQUALITY (type); } return type; }
tree lambda_capture_field_type (tree expr, bool explicit_init_p) { tree type; if (explicit_init_p) { type = make_auto (); type = do_auto_deduction (type, expr, type); } else type = non_reference (unlowered_expr_type (expr)); if (type_dependent_expression_p (expr) && !is_this_parameter (tree_strip_nop_conversions (expr))) { type = cxx_make_type (DECLTYPE_TYPE); DECLTYPE_TYPE_EXPR (type) = expr; DECLTYPE_FOR_LAMBDA_CAPTURE (type) = true; DECLTYPE_FOR_INIT_CAPTURE (type) = explicit_init_p; SET_TYPE_STRUCTURAL_EQUALITY (type); } return type; }
void cxx_print_type (FILE *file, tree node, int indent) { switch (TREE_CODE (node)) { case TEMPLATE_TYPE_PARM: case TEMPLATE_TEMPLATE_PARM: case BOUND_TEMPLATE_TEMPLATE_PARM: indent_to (file, indent + 3); fprintf (file, "index %d level %d orig_level %d", TEMPLATE_TYPE_IDX (node), TEMPLATE_TYPE_LEVEL (node), TEMPLATE_TYPE_ORIG_LEVEL (node)); return; case FUNCTION_TYPE: case METHOD_TYPE: if (TYPE_RAISES_EXCEPTIONS (node)) print_node (file, "throws", TYPE_RAISES_EXCEPTIONS (node), indent + 4); return; case RECORD_TYPE: case UNION_TYPE: break; case DECLTYPE_TYPE: print_node (file, "expr", DECLTYPE_TYPE_EXPR (node), indent + 4); return; case TYPENAME_TYPE: print_node (file, "fullname", TYPENAME_TYPE_FULLNAME (node), indent + 4); return; case TYPE_PACK_EXPANSION: print_node (file, "args", PACK_EXPANSION_EXTRA_ARGS (node), indent + 4); return; default: return; } if (TYPE_PTRMEMFUNC_P (node)) print_node (file, "ptrmemfunc fn type", TYPE_PTRMEMFUNC_FN_TYPE (node), indent + 4); if (! CLASS_TYPE_P (node)) return; indent_to (file, indent + 4); fprintf (file, "full-name \"%s\"", type_as_string (node, TFF_CLASS_KEY_OR_ENUM)); indent_to (file, indent + 3); if (TYPE_NEEDS_CONSTRUCTING (node)) fputs ( " needs-constructor", file); if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (node)) fputs (" needs-destructor", file); if (TYPE_HAS_DEFAULT_CONSTRUCTOR (node)) fputs (" X()", file); if (TYPE_HAS_CONVERSION (node)) fputs (" has-type-conversion", file); if (TYPE_HAS_COPY_CTOR (node)) { if (TYPE_HAS_CONST_COPY_CTOR (node)) fputs (" X(constX&)", file); else fputs (" X(X&)", file); } if (TYPE_HAS_NEW_OPERATOR (node)) fputs (" new", file); if (TYPE_HAS_ARRAY_NEW_OPERATOR (node)) fputs (" new[]", file); if (TYPE_GETS_DELETE (node) & 1) fputs (" delete", file); if (TYPE_GETS_DELETE (node) & 2) fputs (" delete[]", file); if (TYPE_HAS_COPY_ASSIGN (node)) fputs (" this=(X&)", file); if (CLASSTYPE_SORTED_FIELDS (node)) fprintf (file, " sorted-fields %p", (void *) CLASSTYPE_SORTED_FIELDS (node)); if (TREE_CODE (node) == RECORD_TYPE) { if (TYPE_BINFO (node)) fprintf (file, " n_parents=%d", BINFO_N_BASE_BINFOS (TYPE_BINFO (node))); else fprintf (file, " no-binfo"); fprintf (file, " use_template=%d", CLASSTYPE_USE_TEMPLATE (node)); if (CLASSTYPE_INTERFACE_ONLY (node)) fprintf (file, " interface-only"); if (CLASSTYPE_INTERFACE_UNKNOWN (node)) fprintf (file, " interface-unknown"); } }