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; }
static enum classify_record cp_classify_record (tree type) { if (CLASSTYPE_DECLARED_CLASS (type)) return RECORD_IS_CLASS; return RECORD_IS_STRUCT; }
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); }
tree visit_fun(tree *decl, int *subtrees, void *dummy) { (void)subtrees; (void)dummy; enum tree_code code = TREE_CODE(*decl); tree var = NULL_TREE; if(code == BIND_EXPR) { for(var = BIND_EXPR_VARS(*decl); var; var = TREE_CHAIN(var)) { if(TREE_CODE(var) == VAR_DECL) { if(auto_var_in_fn_p(var, current_function_decl) && !DECL_ARTIFICIAL(var)) { if(!DECL_INITIAL(var)) { tree init_var = walk_tree_without_duplicates(decl, walk_init, var); if(init_var == NULL_TREE) { // don't check classes initialization (too complicated) if(!(TREE_CODE(TREE_TYPE(var)) == RECORD_TYPE && CLASSTYPE_DECLARED_CLASS(TREE_TYPE(var)))) { WARNING_DECL(*decl, "uninititialized auto var %qD", var); } } } } } } } return NULL_TREE; }