[clang] [clang-tools-extra] [clang-include-cleaner] Make cleanup attr report expr location (PR #140233)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon May 19 11:46:26 PDT 2025
================
@@ -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>];
----------------
AaronBallman wrote:
> I would lean AGAINST 3, unless we have a REALLY good reason to.
Being able to iterate over arguments generically would mean removing a *ton* of specific logic in places like pretty printing, AST matching, etc. Basically, if `Decl` and `Stmt` let you iterate over its `children()` generically, `Attr` would be good to handle for the same reasons.
> This would require that Attr have a trailing-objects,
Wha? `ParsedAttr` already tracks this generically, doesn't it? So I was thinking of lifting that onto `AttributeCommonInfo` so that `Attr` gets the benefit too. But yeah, if this requires a bunch of extra overhead, I'm also opposed -- we want attributes to be cheap rather than memory-hungry given how many of them show up in system headers.
https://github.com/llvm/llvm-project/pull/140233
More information about the cfe-commits
mailing list