aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-08-10 15:20:08 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-08-10 15:20:08 -0400
commit22428a75462e01877181501801dce4c090a87e9c (patch)
tree36affbe0da86d106bd7f6f4091dfb6e95fe461cc /src/analyze.cpp
parentb9d1d45dfd0f704bc762732c23aa2844f1d14e8d (diff)
downloadzig-22428a75462e01877181501801dce4c090a87e9c.tar.gz
zig-22428a75462e01877181501801dce4c090a87e9c.zip
fix try in an async function with error union and non-zero-bit payload
Diffstat (limited to 'src/analyze.cpp')
-rw-r--r--src/analyze.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp
index a09ba582c9..7482ba92ba 100644
--- a/src/analyze.cpp
+++ b/src/analyze.cpp
@@ -5190,6 +5190,18 @@ static Error resolve_coro_frame(CodeGen *g, ZigType *frame_type) {
}
ZigType *fn_type = get_async_fn_type(g, fn->type_entry);
+ if (fn->analyzed_executable.need_err_code_spill) {
+ IrInstructionAllocaGen *alloca_gen = allocate<IrInstructionAllocaGen>(1);
+ alloca_gen->base.id = IrInstructionIdAllocaGen;
+ alloca_gen->base.source_node = fn->proto_node;
+ alloca_gen->base.scope = fn->child_scope;
+ alloca_gen->base.value.type = get_pointer_to_type(g, g->builtin_types.entry_global_error_set, false);
+ alloca_gen->base.ref_count = 1;
+ alloca_gen->name_hint = "";
+ fn->alloca_gen_list.append(alloca_gen);
+ fn->err_code_spill = &alloca_gen->base;
+ }
+
for (size_t i = 0; i < fn->call_list.length; i += 1) {
IrInstructionCallGen *call = fn->call_list.at(i);
ZigFn *callee = call->fn_entry;