================
@@ -50,8 +50,8 @@ struct testRecoverStrictnessStruct { };
 
 #pragma clang attribute pop
 
-#pragma clang attribute push (__attribute__((abi_tag("a"))), apply_to = 
any(function, record(unless(is_union)), variable, enum))
-// expected-error@-1 {{attribute 'abi_tag' cannot be applied to 'enum'}}
+#pragma clang attribute push (__attribute__((abi_tag("a"))), apply_to = 
any(function, record(unless(is_union)), variable, enum)) // expected-warning 
{{attribute 'abi_tag' cannot be applied to a 'void' parameter}}
+                                                                               
                                                  // expected-error@-1 
{{attribute 'abi_tag' cannot be applied to 'enum'}}
----------------
AaronBallman wrote:

> @AaronBallman if we're considering changes to `Attr.td`, 

I don't think we need changes in Attr.td itself; the changes should be limited 
to just the tablegen bits (or the part consuming the tablegen bits).

> it seems that `[Var]` and `[ParmVar]` should be extended to `AttrSubject`, 
> since `AttrSubjectMatcherRule` only accepts a list of `AttrSubject`. I'm 
> unsure if this qualifies as a `Subject`, though...

Those already are an `AttrSubject`; we have attributes using them already.

> https://github.com/llvm/llvm-project/blob/50082773223b9eced296d8223ca4e4a79ecdeb9b/clang/include/clang/Basic/Attr.td#L560-L567

I think that's correct as-is.

> or explicitly add a helper to exclude void parameters and use it with
> 
> https://github.com/llvm/llvm-project/blob/d00579be39e8a470d7a0ff79ff6deadf9e003781/clang/lib/Sema/ParsedAttr.cpp#L172-L175

I think that's what needs to be changed to exclude `void` parameters (or 
somewhere nearby that call).

> > Side note: pragma clang attribute push diagnostics are THE WORST here...
> 
> I suppose the diagnostic for void parameters will be skipped if the rules 
> exclude them, or should the diagnostic still handle this case?

The goal is to get rid of the diagnostics about `void` parameters. e.g., `// 
expected-warning {{attribute 'abi_tag' cannot be applied to a 'void' 
parameter}}` shouldn't be fired.

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