[clang] [Clang] disallow attributes on void parameters (PR #124920)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 4 06:31:59 PST 2025


================
@@ -1190,6 +1190,11 @@ void Sema::ActOnPragmaAttributePop(SourceLocation PragmaLoc,
 void Sema::AddPragmaAttributes(Scope *S, Decl *D) {
   if (PragmaAttributeStack.empty())
     return;
+
+  if (ParmVarDecl *P = dyn_cast<ParmVarDecl>(D))
+    if (P->getIdentifier() == nullptr && P->getType()->isVoidType())
----------------
erichkeane wrote:

is the identifier-check necessary?  Identifier on a void parameter is invalid.

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


More information about the cfe-commits mailing list