aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkristopher tate <kt@connectfree.co.jp>2018-07-28 11:46:31 +0900
committerkristopher tate <kt@connectfree.co.jp>2018-08-02 16:50:08 +0900
commita2e5691228c61e5c56220fc8f5f72e47b0611000 (patch)
treeb30961308c5e93d8859b4125fac897a8a7b21297 /src
parent9366a58bdd91a8b5e7bc7d4babb6f91b989769db (diff)
downloadzig-a2e5691228c61e5c56220fc8f5f72e47b0611000.tar.gz
zig-a2e5691228c61e5c56220fc8f5f72e47b0611000.zip
src/codegen.cpp: return null if calling convention is not async;
Tracking Issue #1296 ;
Diffstat (limited to 'src')
-rw-r--r--src/codegen.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 336aded82c..cbd1955839 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -4149,9 +4149,15 @@ static LLVMValueRef ir_render_frame_address(CodeGen *g, IrExecutable *executable
static LLVMValueRef ir_render_handle(CodeGen *g, IrExecutable *executable,
IrInstructionHandle *instruction)
{
- // @andrewrk, not sure what to place here ?
- // `get_promise_frame_type` ?
- LLVMValueRef handle = LLVMConstNull(g->builtin_types.entry_promise->type_ref);
+
+ bool is_async = executable->fn_entry != nullptr &&
+ executable->fn_entry->type_entry->data.fn.fn_type_id.cc == CallingConventionAsync;
+
+ if (!is_async || !executable->coro_handle) {
+ return LLVMConstNull(g->builtin_types.entry_promise->type_ref);
+ }
+
+ LLVMValueRef handle = ir_llvm_value(g, executable->coro_handle);
return LLVMBuildRet(g->builder, handle);
}