Skip to content

Commit 1483be0

Browse files
Merge pull request #65951 from aschwaighofer/another_opaque_ptr_fix
IRGen: Another fix for opaque pointers
2 parents fa55fa3 + f5b17bd commit 1483be0

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)