diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-12-18 01:54:27 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-12-18 01:54:27 -0500 |
| commit | 0d2f2b79eaf844e6bcdb41fe61c7e1655df9b1a0 (patch) | |
| tree | 2072c39406d37f55f4505acd95e23edef42daa11 /src/codegen.cpp | |
| parent | 69cf0ea56877a6f9bae51a35cffde371bf142567 (diff) | |
| download | zig-0d2f2b79eaf844e6bcdb41fe61c7e1655df9b1a0.tar.gz zig-0d2f2b79eaf844e6bcdb41fe61c7e1655df9b1a0.zip | |
IR: basic support for implicit casting to const pointer
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index 7ed799611f..e486764db8 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -1677,6 +1677,7 @@ static LLVMValueRef ir_render_ref(CodeGen *g, IrExecutable *executable, IrInstru if (handle_is_ptr(instruction->value->type_entry)) { return value; } else { + assert(instruction->tmp_ptr); LLVMBuildStore(g->builder, value, instruction->tmp_ptr); return instruction->tmp_ptr; } @@ -2843,6 +2844,7 @@ static void do_code_gen(CodeGen *g) { for (size_t alloca_i = 0; alloca_i < fn_table_entry->alloca_list.length; alloca_i += 1) { IrInstruction *instruction = fn_table_entry->alloca_list.at(alloca_i); LLVMValueRef *slot; + TypeTableEntry *slot_type = instruction->type_entry; if (instruction->id == IrInstructionIdCast) { IrInstructionCast *cast_instruction = (IrInstructionCast *)instruction; slot = &cast_instruction->tmp_ptr; @@ -2876,7 +2878,7 @@ static void do_code_gen(CodeGen *g) { } else { zig_unreachable(); } - *slot = LLVMBuildAlloca(g->builder, instruction->type_entry->type_ref, ""); + *slot = LLVMBuildAlloca(g->builder, slot_type->type_ref, ""); } ImportTableEntry *import = get_scope_import(&fn_table_entry->fndef_scope->base); |
