authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-10-01 03:05:01-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-10-01 03:05:01-04:00
log5e6fc94b7f43dda028de779a874f12591fa0a50d
treee4d8092800d0e83750005f9545163151830582a5
parent6f250f568a5d5dd667b9f290ed8afc9412175b1d

fix codegen on windows


1 files changed, 14 insertions(+), 10 deletions(-)

src/codegen.cpp+14-10
......@@ -733,18 +733,21 @@ static Buf *panic_msg_buf(PanicMsgId msg_id) {
733733
734734static LLVMValueRef get_panic_msg_ptr_val(CodeGen *g, PanicMsgId msg_id) {
735735 ConstExprValue *val = &g->panic_msg_vals[msg_id];
736 if (val->global_refs->llvm_global)
737 return val->global_refs->llvm_global;
736 if (!val->global_refs->llvm_global) {
738737
739 Buf *buf_msg = panic_msg_buf(msg_id);
740 ConstExprValue *array_val = create_const_str_lit(g, buf_msg);
741 init_const_slice(g, val, array_val, 0, buf_len(buf_msg), true);
738 Buf *buf_msg = panic_msg_buf(msg_id);
739 ConstExprValue *array_val = create_const_str_lit(g, buf_msg);
740 init_const_slice(g, val, array_val, 0, buf_len(buf_msg), true);
742741
743 render_const_val(g, val);
744 render_const_val_global(g, val, "");
742 render_const_val(g, val);
743 render_const_val_global(g, val, "");
745744
746 assert(val->global_refs->llvm_global);
747 return val->global_refs->llvm_global;
745 assert(val->global_refs->llvm_global);
746 }
747
748 TypeTableEntry *u8_ptr_type = get_pointer_to_type(g, g->builtin_types.entry_u8, true);
749 TypeTableEntry *str_type = get_slice_type(g, u8_ptr_type);
750 return LLVMConstBitCast(val->global_refs->llvm_global, LLVMPointerType(str_type->type_ref, 0));
748751}
749752
750753static void gen_panic(CodeGen *g, LLVMValueRef msg_arg) {
......@@ -3743,7 +3746,8 @@ static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val) {
37433746 fields[type_struct_field->gen_index] = gen_const_val(g, &const_val->data.x_struct.fields[i]);
37443747 }
37453748 }
3746 return LLVMConstNamedStruct(type_entry->type_ref, fields, type_entry->data.structure.gen_field_count);
3749 return LLVMConstStruct(fields, type_entry->data.structure.gen_field_count,
3750 type_entry->data.structure.layout == ContainerLayoutPacked);
37473751 }
37483752 case TypeTableEntryIdUnion:
37493753 {