mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Add missing types to minimum dependency checking
This commit is contained in:
+29
-1
@@ -1143,6 +1143,8 @@ void add_type_info_type(CheckerContext *c, Type *t) {
|
|||||||
add_type_info_type(c, bt);
|
add_type_info_type(c, bt);
|
||||||
|
|
||||||
switch (bt->kind) {
|
switch (bt->kind) {
|
||||||
|
case Type_Invalid:
|
||||||
|
break;
|
||||||
case Type_Basic:
|
case Type_Basic:
|
||||||
switch (bt->Basic.kind) {
|
switch (bt->Basic.kind) {
|
||||||
case Basic_string:
|
case Basic_string:
|
||||||
@@ -1194,6 +1196,7 @@ void add_type_info_type(CheckerContext *c, Type *t) {
|
|||||||
|
|
||||||
case Type_BitSet:
|
case Type_BitSet:
|
||||||
add_type_info_type(c, bt->BitSet.elem);
|
add_type_info_type(c, bt->BitSet.elem);
|
||||||
|
add_type_info_type(c, bt->BitSet.underlying);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Type_Opaque:
|
case Type_Opaque:
|
||||||
@@ -1239,6 +1242,10 @@ void add_type_info_type(CheckerContext *c, Type *t) {
|
|||||||
add_type_info_type(c, bt->Proc.params);
|
add_type_info_type(c, bt->Proc.params);
|
||||||
add_type_info_type(c, bt->Proc.results);
|
add_type_info_type(c, bt->Proc.results);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
GB_PANIC("Unhandled type: %*.s", LIT(type_strings[bt->kind]));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1304,6 +1311,8 @@ void add_min_dep_type_info(Checker *c, Type *t) {
|
|||||||
add_min_dep_type_info(c, bt);
|
add_min_dep_type_info(c, bt);
|
||||||
|
|
||||||
switch (bt->kind) {
|
switch (bt->kind) {
|
||||||
|
case Type_Invalid:
|
||||||
|
break;
|
||||||
case Type_Basic:
|
case Type_Basic:
|
||||||
switch (bt->Basic.kind) {
|
switch (bt->Basic.kind) {
|
||||||
case Basic_string:
|
case Basic_string:
|
||||||
@@ -1311,8 +1320,8 @@ void add_min_dep_type_info(Checker *c, Type *t) {
|
|||||||
add_min_dep_type_info(c, t_int);
|
add_min_dep_type_info(c, t_int);
|
||||||
break;
|
break;
|
||||||
case Basic_any:
|
case Basic_any:
|
||||||
add_min_dep_type_info(c, t_type_info_ptr);
|
|
||||||
add_min_dep_type_info(c, t_rawptr);
|
add_min_dep_type_info(c, t_rawptr);
|
||||||
|
add_min_dep_type_info(c, t_typeid);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Basic_complex64:
|
case Basic_complex64:
|
||||||
@@ -1326,6 +1335,15 @@ void add_min_dep_type_info(Checker *c, Type *t) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Type_Opaque:
|
||||||
|
add_min_dep_type_info(c, bt->Opaque.elem);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Type_BitSet:
|
||||||
|
add_min_dep_type_info(c, bt->BitSet.elem);
|
||||||
|
add_min_dep_type_info(c, bt->BitSet.underlying);
|
||||||
|
break;
|
||||||
|
|
||||||
case Type_Pointer:
|
case Type_Pointer:
|
||||||
add_min_dep_type_info(c, bt->Pointer.elem);
|
add_min_dep_type_info(c, bt->Pointer.elem);
|
||||||
break;
|
break;
|
||||||
@@ -1390,6 +1408,10 @@ void add_min_dep_type_info(Checker *c, Type *t) {
|
|||||||
add_min_dep_type_info(c, bt->Proc.params);
|
add_min_dep_type_info(c, bt->Proc.params);
|
||||||
add_min_dep_type_info(c, bt->Proc.results);
|
add_min_dep_type_info(c, bt->Proc.results);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
GB_PANIC("Unhandled type: %*.s", LIT(type_strings[bt->kind]));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3518,6 +3540,12 @@ void check_parsed_files(Checker *c) {
|
|||||||
|
|
||||||
TIME_SECTION("generate minimum dependency set");
|
TIME_SECTION("generate minimum dependency set");
|
||||||
generate_minimum_dependency_set(c, c->info.entry_point);
|
generate_minimum_dependency_set(c, c->info.entry_point);
|
||||||
|
for_array(i, c->info.minimum_dependency_set.entries) {
|
||||||
|
Entity *e = c->info.minimum_dependency_set.entries[i].ptr;
|
||||||
|
if (is_type_bit_set(e->type)) {
|
||||||
|
gb_printf("%.*s\n", LIT(e->token.string));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TIME_SECTION("calculate global init order");
|
TIME_SECTION("calculate global init order");
|
||||||
|
|||||||
+8
-2
@@ -4567,6 +4567,12 @@ irValue *ir_emit_conv(irProcedure *proc, irValue *value, Type *t) {
|
|||||||
if (is_type_u8_ptr(src) && is_type_cstring(dst)) {
|
if (is_type_u8_ptr(src) && is_type_cstring(dst)) {
|
||||||
return ir_emit_bitcast(proc, value, dst);
|
return ir_emit_bitcast(proc, value, dst);
|
||||||
}
|
}
|
||||||
|
if (is_type_cstring(src) && is_type_rawptr(dst)) {
|
||||||
|
return ir_emit_bitcast(proc, value, dst);
|
||||||
|
}
|
||||||
|
if (is_type_rawptr(src) && is_type_cstring(dst)) {
|
||||||
|
return ir_emit_bitcast(proc, value, dst);
|
||||||
|
}
|
||||||
|
|
||||||
if (are_types_identical(src, t_cstring) && are_types_identical(dst, t_string)) {
|
if (are_types_identical(src, t_cstring) && are_types_identical(dst, t_string)) {
|
||||||
irValue *c = ir_emit_conv(proc, value, t_cstring);
|
irValue *c = ir_emit_conv(proc, value, t_cstring);
|
||||||
@@ -4842,7 +4848,7 @@ irValue *ir_emit_transmute(irProcedure *proc, irValue *value, Type *t) {
|
|||||||
if (is_type_integer(src) && (is_type_pointer(dst) || is_type_cstring(dst))) {
|
if (is_type_integer(src) && (is_type_pointer(dst) || is_type_cstring(dst))) {
|
||||||
Type *vt = core_type(ir_type(value));
|
Type *vt = core_type(ir_type(value));
|
||||||
return ir_emit(proc, ir_instr_conv(proc, irConv_inttoptr, value, vt, t));
|
return ir_emit(proc, ir_instr_conv(proc, irConv_inttoptr, value, vt, t));
|
||||||
}else if ((is_type_pointer(src) || is_type_cstring(src)) && is_type_integer(dst)) {
|
} else if ((is_type_pointer(src) || is_type_cstring(src)) && is_type_integer(dst)) {
|
||||||
Type *vt = core_type(ir_type(value));
|
Type *vt = core_type(ir_type(value));
|
||||||
return ir_emit(proc, ir_instr_conv(proc, irConv_ptrtoint, value, vt, t));
|
return ir_emit(proc, ir_instr_conv(proc, irConv_ptrtoint, value, vt, t));
|
||||||
}
|
}
|
||||||
@@ -5014,7 +5020,7 @@ isize ir_type_info_index(CheckerInfo *info, Type *type, bool err_on_not_found=tr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (err_on_not_found) {
|
if (err_on_not_found) {
|
||||||
GB_PANIC("NOT FOUND ir_type_info_index %s", type_to_string(type));
|
GB_PANIC("NOT FOUND ir_type_info_index %s @ index %td", type_to_string(type), index);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user