int main(void) { ir_init(); ir_type *type = new_type_primitive(get_modeIs()); ident *id1 = new_id_from_str("foo"); ir_type *glob = get_glob_type(); ir_entity *x = new_global_entity(glob, id1, type, ir_visibility_external, IR_LINKAGE_DEFAULT); assert(get_entity_owner(x) == glob); ident *id2 = new_id_from_str("bar"); ir_type *cls = new_type_class(id2); set_entity_owner(x, cls); assert(get_entity_owner(x) == cls); ir_entity *gx = ir_get_global(id1); assert (NULL == gx); set_entity_owner(x, glob); assert(get_entity_owner(x) == glob); return 0; }
static ir_entity *extvar(char const *const name, ir_type *const type) { ident *id = ir_platform_mangle_global(name); return new_global_entity(get_glob_type(), id, type, ir_visibility_external, IR_LINKAGE_DEFAULT); }