aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorscurest <scurest@users.noreply.github.com>2017-06-17 11:30:29 -0500
committerAndrew Kelley <superjoe30@gmail.com>2017-08-26 13:48:16 -0400
commit5bc877017ede3b85361a112987757ee277b9c889 (patch)
tree1403967c72b47399b0d2f796922007e350d14dda /src/codegen.cpp
parente726925e802eddab53cbfd9aacbc5eefe95c356f (diff)
downloadzig-5bc877017ede3b85361a112987757ee277b9c889.tar.gz
zig-5bc877017ede3b85361a112987757ee277b9c889.zip
use most_aligned_member+padding to represent enum unions
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index ad014e9e19..ac4f94e133 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -3663,13 +3663,13 @@ static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val) {
if (type_entry->data.enumeration.gen_field_count == 0) {
return tag_value;
} else {
- TypeTableEntry *union_type = type_entry->data.enumeration.union_type;
+ LLVMTypeRef union_type_ref = type_entry->data.enumeration.union_type_ref;
TypeEnumField *enum_field = &type_entry->data.enumeration.fields[const_val->data.x_enum.tag];
assert(enum_field->value == const_val->data.x_enum.tag);
LLVMValueRef union_value;
if (type_has_bits(enum_field->type_entry)) {
uint64_t union_type_bytes = LLVMStoreSizeOfType(g->target_data_ref,
- union_type->type_ref);
+ union_type_ref);
uint64_t field_type_bytes = LLVMStoreSizeOfType(g->target_data_ref,
enum_field->type_entry->type_ref);
uint64_t pad_bytes = union_type_bytes - field_type_bytes;
@@ -3685,7 +3685,7 @@ static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val) {
union_value = LLVMConstStruct(fields, 2, false);
}
} else {
- union_value = LLVMGetUndef(union_type->type_ref);
+ union_value = LLVMGetUndef(union_type_ref);
}
LLVMValueRef fields[] = {
tag_value,