================ @@ -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); ---------------- ChuanqiXu9 wrote:
Let's try to not polluting the interfaces as much as possible. Since most of the functions are not coroutines, it looks not good to pollute the interfaces. Personally, I prefer the style: ``` if (the function is coroutine) DiagnoseUnusedParametersInCoroutines(...); else DiagnoseUnusedParameters(...); // Original call. ``` Also it may be better to use `FunctionScopeInfo::CoroutineParameterMoves` than yet another DeclsVisitor. It is easy prone and hard to maintain. 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