Delay determination of procedure abi types until as late as possible to prevent type undetermination in self-referential data types #454

This commit is contained in:
gingerBill
2019-10-31 18:25:39 +00:00
parent 4aad45e3e7
commit ee8d3e03f8
5 changed files with 29 additions and 12 deletions

View File

@@ -205,6 +205,7 @@ struct TypeUnion {
Type * abi_compat_result_type; \
i32 variadic_index; \
bool variadic; \
bool abi_types_set; \
bool require_results; \
bool c_vararg; \
bool is_polymorphic; \
@@ -2360,7 +2361,9 @@ i64 type_size_of(Type *t) {
return 0;
}
// NOTE(bill): Always calculate the size when it is a Type_Basic
if (t->kind != Type_Basic && t->cached_size >= 0) {
if (t->kind == Type_Named && t->cached_size >= 0) {
} else if (t->kind != Type_Basic && t->cached_size >= 0) {
return t->cached_size;
}
TypePath path = {0};
@@ -2375,7 +2378,9 @@ i64 type_align_of(Type *t) {
return 1;
}
// NOTE(bill): Always calculate the size when it is a Type_Basic
if (t->kind != Type_Basic && t->cached_align > 0) {
if (t->kind == Type_Named && t->cached_align >= 0) {
} if (t->kind != Type_Basic && t->cached_align > 0) {
return t->cached_align;
}