================
@@ -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:

> Sorry, what do you mean by adding an assertion to DiagnoseUnusedParameters? 
> Do you say doing so after adopting my suggest? Then, it sounds good but how 
> can we do that? And it sounds not meaningful.

I didn't make it clear. I was asking what you may think about an assertion in 
DiagnoseUnusedParameters that !CurFunction()->isCoroutine()

> An instinct idea now is to mark all the parameters as non referenced/used 
> after building CoroutineParameterMoves. But it needs to be verified.

New to clang so I can't tell if I did something wrong. But the compiler crashed 
when I initially tried that. 

I have to sign off now. Catch up with you soon. 

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