diff options
| author | LemonBoy <thatlemon@gmail.com> | 2019-12-30 16:48:14 +0100 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-12-30 17:45:09 -0500 |
| commit | 28a8ded95a96b1e2af5d2a73f47db2c967233476 (patch) | |
| tree | ac9bc2f2248988c8ebc99d990ea315c0dcc397d9 /src/codegen.cpp | |
| parent | c1ee846c221a43b3bb3f9e427a2077b444435ec7 (diff) | |
| download | zig-28a8ded95a96b1e2af5d2a73f47db2c967233476.tar.gz zig-28a8ded95a96b1e2af5d2a73f47db2c967233476.zip | |
Resolve more types as needed
Closes #3994
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index 1455b4b743..01cda22cd4 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -1725,11 +1725,14 @@ static void gen_var_debug_decl(CodeGen *g, ZigVar *var) { static LLVMValueRef ir_llvm_value(CodeGen *g, IrInstruction *instruction) { Error err; - if ((err = type_resolve(g, instruction->value->type, ResolveStatusZeroBitsKnown))) { + + bool value_has_bits; + if ((err = type_has_bits2(g, instruction->value->type, &value_has_bits))) codegen_report_errors_and_exit(g); - } - if (!type_has_bits(instruction->value->type)) + + if (!value_has_bits) return nullptr; + if (!instruction->llvm_value) { if (instruction->id == IrInstructionIdAwaitGen) { IrInstructionAwaitGen *await = reinterpret_cast<IrInstructionAwaitGen*>(instruction); @@ -5560,13 +5563,21 @@ static LLVMValueRef ir_render_unwrap_err_code(CodeGen *g, IrExecutable *executab static LLVMValueRef ir_render_unwrap_err_payload(CodeGen *g, IrExecutable *executable, IrInstructionUnwrapErrPayload *instruction) { + Error err; + if (instruction->base.value->special != ConstValSpecialRuntime) return nullptr; bool want_safety = instruction->safety_check_on && ir_want_runtime_safety(g, &instruction->base) && g->errors_by_index.length > 1; - if (!want_safety && !type_has_bits(instruction->base.value->type)) + + bool value_has_bits; + if ((err = type_has_bits2(g, instruction->base.value->type, &value_has_bits))) + codegen_report_errors_and_exit(g); + + if (!want_safety && !value_has_bits) return nullptr; + ZigType *ptr_type = instruction->value->value->type; assert(ptr_type->id == ZigTypeIdPointer); ZigType *err_union_type = ptr_type->data.pointer.child_type; |
