================
@@ -1351,7 +1352,8 @@ def OSConsumesThis : InheritableAttr {
 
 def Cleanup : InheritableAttr {
   let Spellings = [GCC<"cleanup">];
-  let Args = [DeclArgument<Function, "FunctionDecl">];
+  let Args = [DeclArgument<Function, "FunctionDecl">,
+              ExprArgument<"Expr", /*opt=*/0, /*fake=*/1>];
----------------
erichkeane wrote:

If we're doing 1, we need to make sure we do this at the DeclArgument level, 
which means modifying quite a bit of other attributes potentially.  PERHAPS we 
could just have it cause us to store a `pair` of `DeclRefExpr` and 
`FunctionDecl`, that way it minimizes the amount of work.

As far as the extra source-location (2): that is reasonable as well.  I don't 
think we have an automagic `fake` argument to do here, so it would have to just 
be in `AdditionalMembers`.

I would lean AGAINST 3, unless we have a REALLY good reason to.  This would 
require that Attr have a trailing-objects, and thus store that much extra 
information.  We COULD potentially change the entire attributes infrastructure 
to just store the `ArgsUnion` type (which is a union of 
`Expr*`/`IdentifierInfo*` IIRC) then make every access just do the decoding 
from those, but that is a LOT of work.


IN THE END, I think 2 is easiest, so hackiest.  1 is IMO the 'best' situation 
here (and is only a medium amount of work, with some talbegen/minor other 
changes).  We might have other argument types that should do something similar, 
but no reason we couldn't do that in the future.

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

Reply via email to