Use __type_info_of internally

This commit is contained in:
gingerBill
2018-05-12 20:17:12 +01:00
parent 373a60b9ef
commit 324b7d65e7
4 changed files with 17 additions and 8 deletions
+1 -1
View File
@@ -3422,7 +3422,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
add_type_info_type(c, t);
if (is_operand_value(o) && is_type_typeid(t)) {
// Okay
add_preload_dependency(c, "__type_info_of");
} else if (o.mode != Addressing_Type) {
error(ce->args[0], "Expected a type or typeid for 'type_info_of'");
return false;
+4 -2
View File
@@ -4216,8 +4216,10 @@ irValue *ir_build_builtin_proc(irProcedure *proc, AstNode *expr, TypeAndValue tv
return ir_type_info(proc, t);
}
GB_ASSERT(is_type_typeid(tav.type));
irValue *id = ir_emit_bitcast(proc, ir_build_expr(proc, arg), t_uintptr);
return ir_emit_array_ep(proc, ir_global_type_info_data, id);
auto args = array_make<irValue *>(proc->module->allocator, 1);
args[0] = ir_build_expr(proc, arg);
return ir_emit_global_call(proc, "__type_info_of", args);
}
case BuiltinProc_typeid_of: {