[clang] [clang-tools-extra] [clang-include-cleaner] Make cleanup attr report expr location (PR #140233)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Mon May 19 12:05:39 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>];
----------------
erichkeane wrote:
> Ah good call on those already being trailing objects on `ParsedAttr`, so it's an even bigger ask than I originally was thinking. Another good reason not to go that route yet, that's likely to be a complicated patch because of how much code changes (ClangAttrEmitter.cpp, SemaDeclAttr.cpp, probably the parser as well) and because of performance concerns (would definitely need to be tested for perf changes).
Yep. I'm somewhat talking myself into 2 above being acceptalbe, but I'll hate it :D
> (I am very much a drive by contributor and this discussion is making me very scared of ever getting this landed :p)
*sigh* I don't think we can accept it as-is. But I think with some mild work to how `DeclArgument` works in tablegen (in a way that causes us to need exposes the `Expr` as well) would be completely acceptable to us as well.
I THINK I would be OK having us have this Attr store the `SourceLocation` in `AdditionalMembers` for this one, as long as we had some sort of FIXME esque comment on it that results in pointing out the above.
https://github.com/llvm/llvm-project/pull/140233
More information about the cfe-commits
mailing list