void build_module_descriptor (long vers, tree attr) { tree decls, *chain = NULL; #ifdef OBJCPLUS push_lang_context (lang_name_c); /* extern "C" */ #endif objc_module_template = objc_start_struct (get_identifier (UTAG_MODULE)); /* long version; */ decls = add_field_decl (long_integer_type_node, "version", &chain); /* long size; */ add_field_decl (long_integer_type_node, "size", &chain); /* char *name; */ add_field_decl (string_type_node, "name", &chain); /* struct _objc_symtab *symtab; */ add_field_decl (build_pointer_type (xref_tag (RECORD_TYPE, get_identifier (UTAG_SYMTAB))), "symtab", &chain); objc_finish_struct (objc_module_template, decls); /* Create an instance of "_objc_module". */ UOBJC_MODULES_decl = start_var_decl (objc_module_template, /* FIXME - why the conditional if the symbol is the same. */ flag_next_runtime ? "_OBJC_Module" : "_OBJC_Module"); /* This is the root of the metadata for defined classes and categories, it is referenced by the runtime and, therefore, needed. */ DECL_PRESERVE_P (UOBJC_MODULES_decl) = 1; /* Squash `defined but not used' warning. */ TREE_USED (UOBJC_MODULES_decl) = 1; /* Allow the runtime to mark meta-data such that it can be assigned to target specific sections by the back-end. */ if (attr) DECL_ATTRIBUTES (UOBJC_MODULES_decl) = attr; finish_var_decl (UOBJC_MODULES_decl, init_module_descriptor (TREE_TYPE (UOBJC_MODULES_decl), vers)); #ifdef OBJCPLUS pop_lang_context (); #endif }
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); }