================
@@ -10326,6 +10326,15 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, 
DeclContext *DC,
       }
     }
 
+    if (FTIHasSingleVoidParameter(FTI)) {
+      ParmVarDecl *Param = cast<ParmVarDecl>(FTI.Params[0].Param);
+      if (Param->hasAttrs()) {
+        for (const auto *A : Param->attrs())
+          Diag(A->getLoc(), diag::warn_attribute_on_void_param)
+              << A << A->getRange();
+      }
----------------
AaronBallman wrote:

```suggestion
      for (const auto *A : Param->attrs())
        Diag(A->getLoc(), diag::warn_attribute_on_void_param)
            << A << A->getRange();
```
I forgot that `attrs()` handles the no-attributes case gracefully (it's 
`getAttrs()` that doesn't), so we don't need the extra check.

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

Reply via email to