aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-08-15 06:51:33 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-08-26 00:34:40 -0400
commit105a09e1d654c76addc26fd5616c06fcbd8b6a12 (patch)
treeec2c32f256002d5f5c999b2670e3fc9506adbcf7 /src/codegen.cpp
parent234030c37a97d3da7bc6325e4dfb32fe37e9b039 (diff)
downloadzig-105a09e1d654c76addc26fd5616c06fcbd8b6a12.tar.gz
zig-105a09e1d654c76addc26fd5616c06fcbd8b6a12.zip
fix invalid llvm IR for const enum
closes #394
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 640bece896..80ea5e6f6d 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -725,8 +725,8 @@ static LLVMValueRef get_panic_msg_ptr_val(CodeGen *g, PanicMsgId msg_id) {
ConstExprValue *array_val = create_const_str_lit(g, buf_msg);
init_const_slice(g, val, array_val, 0, buf_len(buf_msg), true);
- render_const_val_global(g, val, "");
render_const_val(g, val);
+ render_const_val_global(g, val, "");
assert(val->global_refs->llvm_global);
return val->global_refs->llvm_global;
@@ -3635,7 +3635,8 @@ static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val) {
fields[type_struct_field->gen_index] = gen_const_val(g, &const_val->data.x_struct.fields[i]);
}
}
- return LLVMConstNamedStruct(type_entry->type_ref, fields, type_entry->data.structure.gen_field_count);
+ return LLVMConstStruct(fields, type_entry->data.structure.gen_field_count,
+ type_entry->data.structure.layout == ContainerLayoutPacked);
}
case TypeTableEntryIdUnion:
{