Skip to content

Commit ef61a73

Browse files
aschwaighofermeg-gupta
authored andcommitted
IRGen: Another fix for opaque pointers
1 parent 1d11644 commit ef61a73

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/IRGen/GenBuiltin.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,11 @@ void irgen::emitBuiltinCall(IRGenFunction &IGF, const BuiltinInfo &Builtin,
210210
// getCurrentAsyncTask has no arguments.
211211
if (Builtin.ID == BuiltinValueKind::GetCurrentAsyncTask) {
212212
auto task = IGF.getAsyncTask();
213-
out.add(IGF.Builder.CreateBitCast(task, IGF.IGM.RefCountedPtrTy));
213+
if (!task->getType()->isPointerTy()) {
214+
out.add(IGF.Builder.CreateIntToPtr(task, IGF.IGM.RefCountedPtrTy));
215+
} else {
216+
out.add(IGF.Builder.CreateBitCast(task, IGF.IGM.RefCountedPtrTy));
217+
}
214218
return;
215219
}
216220

0 commit comments

Comments
 (0)