[clang] [coroutine] Fix type of an ImplicitParamDecl used in generateAwaitSuspendWrapper (PR #87134)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 29 18:39:54 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-codegen
@llvm/pr-subscribers-clang
Author: Akira Hatanaka (ahatanak)
<details>
<summary>Changes</summary>
Use the correct type for AwaiterDecl instead of using `void *`.
See the discussion here:
https://github.com/llvm/llvm-project/pull/79712#discussion_r1544153100
---
Full diff: https://github.com/llvm/llvm-project/pull/87134.diff
1 Files Affected:
- (modified) clang/lib/CodeGen/CGCoroutine.cpp (+4-3)
``````````diff
diff --git a/clang/lib/CodeGen/CGCoroutine.cpp b/clang/lib/CodeGen/CGCoroutine.cpp
index 93ca711f716fce..dd005fdaa8f745 100644
--- a/clang/lib/CodeGen/CGCoroutine.cpp
+++ b/clang/lib/CodeGen/CGCoroutine.cpp
@@ -422,7 +422,9 @@ CodeGenFunction::generateAwaitSuspendWrapper(Twine const &CoroName,
FunctionArgList args;
- ImplicitParamDecl AwaiterDecl(C, C.VoidPtrTy, ImplicitParamKind::Other);
+ QualType AwaiterType = S.getOpaqueValue()->getType();
+ ImplicitParamDecl AwaiterDecl(C, C.getPointerType(AwaiterType),
+ ImplicitParamKind::Other);
ImplicitParamDecl FrameDecl(C, C.VoidPtrTy, ImplicitParamKind::Other);
QualType ReturnTy = S.getSuspendExpr()->getType();
@@ -449,8 +451,7 @@ CodeGenFunction::generateAwaitSuspendWrapper(Twine const &CoroName,
// FIXME: add TBAA metadata to the loads
llvm::Value *AwaiterPtr = Builder.CreateLoad(GetAddrOfLocalVar(&AwaiterDecl));
- auto AwaiterLValue =
- MakeNaturalAlignAddrLValue(AwaiterPtr, AwaiterDecl.getType());
+ auto AwaiterLValue = MakeNaturalAlignAddrLValue(AwaiterPtr, AwaiterType);
CurAwaitSuspendWrapper.FramePtr =
Builder.CreateLoad(GetAddrOfLocalVar(&FrameDecl));
``````````
</details>
https://github.com/llvm/llvm-project/pull/87134
More information about the cfe-commits
mailing list