tree begin_lambda_type (tree lambda) { tree type; { /* Unique name. This is just like an unnamed class, but we cannot use make_anon_name because of certain checks against TYPE_ANONYMOUS_P. */ tree name; name = make_lambda_name (); /* Create the new RECORD_TYPE for this lambda. */ type = xref_tag (/*tag_code=*/record_type, name, /*scope=*/ts_lambda, /*template_header_p=*/false); if (type == error_mark_node) return error_mark_node; } /* Designate it as a struct so that we can use aggregate initialization. */ CLASSTYPE_DECLARED_CLASS (type) = false; /* Cross-reference the expression and the type. */ LAMBDA_EXPR_CLOSURE (lambda) = type; CLASSTYPE_LAMBDA_EXPR (type) = lambda; /* Clear base types. */ xref_basetypes (type, /*bases=*/NULL_TREE); /* Start the class. */ type = begin_class_definition (type); return type; }
tree objcp_start_struct (enum tree_code code ATTRIBUTE_UNUSED, tree name) { tree s; /* The idea here is to mimic the actions that the C++ parser takes when constructing 'extern "C" struct NAME {'. */ push_lang_context (lang_name_c); if (!name) name = make_anon_name (); s = xref_tag (record_type, name, ts_global, 0); CLASSTYPE_DECLARED_CLASS (s) = 0; /* this is a 'struct', not a 'class'. */ xref_basetypes (s, NULL_TREE); /* no base classes here! */ return begin_class_definition (s, NULL_TREE); }
static tree vla_capture_type (tree array_type) { static tree ptr_id, max_id; tree type = xref_tag (record_type, make_anon_name (), ts_current, false); xref_basetypes (type, NULL_TREE); type = begin_class_definition (type); if (!ptr_id) { ptr_id = get_identifier ("ptr"); max_id = get_identifier ("max"); } tree ptrtype = build_pointer_type (TREE_TYPE (array_type)); tree field = build_decl (input_location, FIELD_DECL, ptr_id, ptrtype); finish_member_declaration (field); field = build_decl (input_location, FIELD_DECL, max_id, sizetype); finish_member_declaration (field); return finish_struct (type, NULL_TREE); }