[clang] [Clang] Fix -Wunused-parameter for implicit coroutine uses (PR #217518)

via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 21 19:04:57 PDT 2026


================
@@ -1650,8 +1667,11 @@ bool CoroutineStmtBuilder::makeNewAndDeleteExpr() {
       isAlignedAllocation(IAP.PassAlignment))
     NewArgs.push_back(FrameAlignment);
 
-  if (OperatorNew->getNumParams() > NewArgs.size())
+  if (OperatorNew->getNumParams() > NewArgs.size()) {
     llvm::append_range(NewArgs, PlacementArgs);
+    if (PlacementArgsAreCoroutineParameters)
+      markCoroutineParametersReferenced(FD);
----------------
Lane0218 wrote:

Yes, this is a real case. `getNumParams()` does not include the ellipsis, so the old condition skipped the coroutine placement arguments for `operator new(size_t, ...)`.

The condition now also checks `OperatorNew->isVariadic()`, with a regression test covering this case.

https://github.com/llvm/llvm-project/pull/217518


More information about the cfe-commits mailing list