diff options
| author | gingerBill <bill@gingerbill.org> | 2020-03-28 16:08:14 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-03-28 16:08:14 +0000 |
| commit | 1b3ee7153cd4afdb1b6f2689cd4d6c6f41ccc9fc (patch) | |
| tree | 16076fea649a5b3b813ac54540daa86125a9c573 /src/types.cpp | |
| parent | bda5e8cc6661906aa774a0692e5d6fc45ec4553a (diff) | |
Fix #599 - llvm-api GEP for structs with custom alignment
Diffstat (limited to 'src/types.cpp')
| -rw-r--r-- | src/types.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/types.cpp b/src/types.cpp index 86be0d38f..2ab0897da 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -3261,7 +3261,7 @@ gbString write_type_to_string(gbString str, Type *type) { case Type_Enum: str = gb_string_appendc(str, "enum"); if (type->Enum.base_type != nullptr) { - str = gb_string_appendc(str, " "); + str = gb_string_appendc(str, " "); str = write_type_to_string(str, type->Enum.base_type); } str = gb_string_appendc(str, " {"); @@ -3278,7 +3278,11 @@ gbString write_type_to_string(gbString str, Type *type) { break; case Type_Union: - str = gb_string_appendc(str, "union {"); + str = gb_string_appendc(str, "union"); + if (type->Union.no_nil != 0) str = gb_string_appendc(str, " #no_nil"); + if (type->Union.maybe != 0) str = gb_string_appendc(str, " #maybe"); + if (type->Union.custom_align != 0) str = gb_string_append_fmt(str, " #align %d", cast(int)type->Union.custom_align); + str = gb_string_appendc(str, " {"); for_array(i, type->Union.variants) { Type *t = type->Union.variants[i]; if (i > 0) str = gb_string_appendc(str, ", "); @@ -3302,6 +3306,7 @@ gbString write_type_to_string(gbString str, Type *type) { str = gb_string_appendc(str, "struct"); if (type->Struct.is_packed) str = gb_string_appendc(str, " #packed"); if (type->Struct.is_raw_union) str = gb_string_appendc(str, " #raw_union"); + if (type->Struct.custom_align != 0) str = gb_string_append_fmt(str, " #align %d", cast(int)type->Struct.custom_align); str = gb_string_appendc(str, " {"); for_array(i, type->Struct.fields) { Entity *f = type->Struct.fields[i]; |