void gcji_create_vtable_entity(ir_type *type) { const char *name = get_compound_name(type); ident *vtable_ident = mangle_vtable_name(name); ir_type *unknown = get_unknown_type(); ir_type *glob = get_glob_type(); ir_entity *vtable = new_entity(glob, vtable_ident, unknown); oo_set_class_vtable_entity(type, vtable); }
void gcji_create_rtti_entity(ir_type *type) { const char *name = get_compound_name(type); /* create RTTI object entity (actual initializer is constructed in liboo) */ ident *rtti_ident = mangle_rtti_name(name); ir_type *unknown = get_unknown_type(); ir_entity *rtti_entity = new_entity(glob, rtti_ident, unknown); oo_set_class_rtti_entity(type, rtti_entity); }
static bool verify_info_member(ir_type const *const segment, ir_entity const *const entity) { bool fine = true; /* Mach-O does not allow labels in segments like constructors, * destructors, ... */ ident *const ld_ident = get_entity_ld_ident(entity); if (ld_ident[0] != '\0') { report_error("entity %+F in %s segment must not have an ld_name", entity, get_compound_name(segment)); fine = false; } if ((get_entity_linkage(entity) & IR_LINKAGE_HIDDEN_USER) == 0) { report_error("entity %+F in segment %s without LINKAGE_HIDDEN_USER", entity, get_compound_name(segment)); fine = false; } return fine; }
static ir_entity *emit_type_signature(ir_type *type) { ir_type *curtype = type; unsigned n_pointer_levels = 0; while (is_Pointer_type(curtype)) { n_pointer_levels++; curtype = get_pointer_points_to_type(curtype); } struct obstack obst; obstack_init(&obst); if (n_pointer_levels > 0) { for (unsigned i = 0; i < n_pointer_levels-1; i++) obstack_1grow(&obst, '['); if (is_Primitive_type(curtype)) obstack_1grow(&obst, '['); } if (is_Primitive_type(curtype)) { char c = get_prim_type_char(curtype); obstack_1grow(&obst, c); } else { assert(is_Class_type(curtype)); obstack_1grow(&obst, 'L'); obstack_printf(&obst, "%s", get_compound_name(curtype)); obstack_1grow(&obst, ';'); obstack_1grow(&obst, '\0'); } const char *sig_bytes = obstack_finish(&obst); ir_entity *res = do_emit_utf8_const(sig_bytes, strlen(sig_bytes)); obstack_free(&obst, NULL); return res; }