Skip to content

Commit 0f3f51d

Browse files
committed
[coroutine] Fix type of an ImplicitParamDecl used in generateAwaitSuspendWrapper
Use the correct type for AwaiterDecl instead of using `void *`. See the discussion here: llvm#79712 (comment)
1 parent c0a3c5c commit 0f3f51d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

clang/lib/CodeGen/CGCoroutine.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,9 @@ CodeGenFunction::generateAwaitSuspendWrapper(Twine const &CoroName,
422422

423423
FunctionArgList args;
424424

425-
ImplicitParamDecl AwaiterDecl(C, C.VoidPtrTy, ImplicitParamKind::Other);
425+
QualType AwaiterType = S.getOpaqueValue()->getType();
426+
ImplicitParamDecl AwaiterDecl(C, C.getPointerType(AwaiterType),
427+
ImplicitParamKind::Other);
426428
ImplicitParamDecl FrameDecl(C, C.VoidPtrTy, ImplicitParamKind::Other);
427429
QualType ReturnTy = S.getSuspendExpr()->getType();
428430

@@ -449,8 +451,7 @@ CodeGenFunction::generateAwaitSuspendWrapper(Twine const &CoroName,
449451

450452
// FIXME: add TBAA metadata to the loads
451453
llvm::Value *AwaiterPtr = Builder.CreateLoad(GetAddrOfLocalVar(&AwaiterDecl));
452-
auto AwaiterLValue =
453-
MakeNaturalAlignAddrLValue(AwaiterPtr, AwaiterDecl.getType());
454+
auto AwaiterLValue = MakeNaturalAlignAddrLValue(AwaiterPtr, AwaiterType);
454455

455456
CurAwaitSuspendWrapper.FramePtr =
456457
Builder.CreateLoad(GetAddrOfLocalVar(&FrameDecl));

0 commit comments

Comments
 (0)