[clang] [Clang] Warn against unused parameters in C++ coroutines with `-Wunused-parameters` (PR #70567)

via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 28 12:41:35 PDT 2023


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff b1554fe080e8b074a30f2a4cb88666bdb7b1ce9e ba6c43cc63e9ae3c8d174406ced4df839af3e0a7 -- clang/test/SemaCXX/warn-unused-parameters-coroutine.cpp clang/include/clang/AST/DeclBase.h clang/lib/Sema/SemaCoroutine.cpp clang/lib/Sema/SemaDecl.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 06487d359..948fdd18d 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -15089,11 +15089,11 @@ void Sema::DiagnoseUnusedParameters(ArrayRef<ParmVarDecl *> Parameters) {
     return;
 
   for (const ParmVarDecl *Parameter : Parameters) {
-    if (Parameter->isReferenced() && !Parameter->isLastReferenceInCoroutineParamMoves())
+    if (Parameter->isReferenced() &&
+        !Parameter->isLastReferenceInCoroutineParamMoves())
       continue;
 
-    if (Parameter->getDeclName() &&
-        !Parameter->hasAttr<UnusedAttr>() &&
+    if (Parameter->getDeclName() && !Parameter->hasAttr<UnusedAttr>() &&
         !Parameter->getIdentifier()->isPlaceholder()) {
       Diag(Parameter->getLocation(), diag::warn_unused_parameter)
         << Parameter->getDeclName();

``````````

</details>


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


More information about the cfe-commits mailing list