================
@@ -3165,7 +3165,16 @@ class Sema final {
 
   /// Diagnose any unused parameters in the given sequence of
   /// ParmVarDecl pointers.
-  void DiagnoseUnusedParameters(ArrayRef<ParmVarDecl *> Parameters);
+  ///
+  /// Normally, we check if the parameter decls have the Referenced bit set.
+  /// C++ Coroutines, however, are a special case due to the existences of
+  /// parameter moves (See Sema::buildCoroutineParameterMoves), the parameters
+  /// are always referenced in coroutines. Therefore, in the case of 
coroutines,
+  /// CoroutineBodyRefs must be passed to correctly diagnose parameter usages
+  /// as written by the user.
+  void DiagnoseUnusedParameters(
+      ArrayRef<ParmVarDecl *> Parameters,
+      llvm::SmallSet<ParmVarDecl *, 4> *CoroutineBodyRefs = nullptr);
----------------
yuxuanchen1997 wrote:

If so, what about adding an assertion in the original version of 
`DiagnoseUnusedParameters`? Or should we keep the interface as is (allowing 
coroutines to be diagnosed in the same function, but handle the special case in 
`DiagnoseUnusedParameters` without changing the interface?)

`CoroutineParameterMoves` does not give me what I want. It points me to `Stmt`s 
that moved the parameters while I need the opposite -- All other references to 
the parameters. 

https://github.com/llvm/llvm-project/pull/70567
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to