Single code path for kind/inner/len/sizeof on type and typeid. Fix of #493. Bump to 0.2.24. Remove ´func´ deprecated keyword. Unify builtin access. Enum and fault name reflection.
This commit is contained in:
Christoffer Lerno
2022-07-26 00:56:59 +02:00
committed by GitHub
parent cc1bc58ed0
commit cdff5c3e26
58 changed files with 950 additions and 610 deletions

View File

@@ -23,6 +23,19 @@ static inline LLVMTypeRef create_introspection_type(GenContext *c)
return type;
}
static inline LLVMTypeRef create_fault_type(GenContext *c)
{
LLVMTypeRef type = LLVMStructCreateNamed(c->context, ".fault");
LLVMTypeRef typeid_type = llvm_get_type(c, type_typeid);
LLVMTypeRef chars_type = llvm_get_type(c, type_chars);
LLVMTypeRef fault_type[] = {
[0] = typeid_type,
[1] = chars_type,
};
LLVMStructSetBody(type, fault_type, 2, false);
return type;
}
void gencontext_begin_module(GenContext *c)
{
assert(!c->module && "Expected no module");
@@ -105,7 +118,8 @@ void gencontext_begin_module(GenContext *c)
c->bool_type = LLVMInt1TypeInContext(c->context);
c->byte_type = LLVMInt8TypeInContext(c->context);
c->introspect_type = create_introspection_type(c);
c->fault_type = create_fault_type(c);
c->size_type = llvm_get_type(c, type_usize);
if (c->panicfn) c->panicfn->backend_ref = NULL;
if (active_target.debug_info != DEBUG_INFO_NONE)