diff options
author | Yuxuan Chen <yuxuanchen1997@outlook.com> | 2023-11-01 23:03:47 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-02 14:03:47 +0800 |
commit | 858b56e4962749013ded409ff43370b542c8b6cb (patch) | |
tree | 778218c0eb44ae70fba337d7ee87fc129184d4c8 /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | |
parent | d76b56fd28582c1cc6663cefa5ae2f8a23492d0a (diff) | |
download | llvm-858b56e4962749013ded409ff43370b542c8b6cb.zip llvm-858b56e4962749013ded409ff43370b542c8b6cb.tar.gz llvm-858b56e4962749013ded409ff43370b542c8b6cb.tar.bz2 |
[Clang] Preserve coroutine parameter referenced state (#70973)
This PR is proposing a fix for
https://github.com/llvm/llvm-project/issues/65971.
Previously, given a coroutine like this
```
task foo(int a) {
co_return;
}
```
Parameter `a` is never used. However, because C++ coroutines move
constructs the variable to a heap allocated coroutine activation frame,
we considered all parameters referenced. When diagnosing unused
parameters, we cannot distinguish if the variable reference was due to
coroutine parameter moves.
Compiler Explorer shows that GCC warns against this case correctly, but
clang does not: https://godbolt.org/z/Wo7dfqeaf
This patch addresses this issue by preserving the original
`ParmVarDecl`'s `Referenced` state.
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
0 files changed, 0 insertions, 0 deletions