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_finish_struct (tree t, tree fieldlist, tree attributes) { tree field, next_field; for (field = fieldlist; field; field = next_field) { next_field = TREE_CHAIN (field); /* insert one field at a time; */ TREE_CHAIN (field) = NULL_TREE; /* otherwise, grokfield croaks. */ finish_member_declaration (field); } t = finish_struct (t, attributes); pop_lang_context (); return t; }
tree objcp_finish_struct (location_t loc ATTRIBUTE_UNUSED, tree t, tree fieldlist, tree attributes) { tree field, next_field; for (field = fieldlist; field; field = next_field) { next_field = TREE_CHAIN (field); /* insert one field at a time; */ TREE_CHAIN (field) = NULL_TREE; /* otherwise, grokfield croaks. */ finish_member_declaration (field); } t = finish_struct (t, attributes); /* If we are inside an @interface and are generating the list of ivars, we need to check for duplicate ivars. */ if (fieldlist) objc_detect_field_duplicates (true); pop_lang_context (); return t; }