[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2022-01-26 Thread Steffen Larsen via Phabricator via cfe-commits
steffenlarsen marked 2 inline comments as done. steffenlarsen added inline comments. Comment at: clang/lib/Parse/ParseDecl.cpp:497 +// Pack expansion is only allowed in the variadic argument at the end. +const size_t attrNumArgs = attributeNumberOfArguments(*AttrN

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2022-01-26 Thread Steffen Larsen via Phabricator via cfe-commits
steffenlarsen updated this revision to Diff 403187. steffenlarsen marked an inline comment as done. steffenlarsen added a comment. Removing top-level `const` and adjusting style. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D114439/new/ https://reviews.llvm.org/D114439 Files: clang/i

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2022-01-25 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Parse/ParseDecl.cpp:497 +// Pack expansion is only allowed in the variadic argument at the end. +const size_t attrNumArgs = attributeNumberOfArguments(*AttrName); +if (ArgExprs.size() + I + 1 < att

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2022-01-21 Thread Steffen Larsen via Phabricator via cfe-commits
steffenlarsen marked an inline comment as done. steffenlarsen added inline comments. Comment at: clang/lib/Parse/ParseDecl.cpp:468 + + // General case. Parse all available expressions. + CommaLocsTy CommaLocs; aaron.ballman wrote: > I think it'd be good

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2022-01-21 Thread Steffen Larsen via Phabricator via cfe-commits
steffenlarsen updated this revision to Diff 401910. steffenlarsen added a comment. Moved comment. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D114439/new/ https://reviews.llvm.org/D114439 Files: clang/include/clang/Basic/Attr.td clang/include/clang/Basic/DiagnosticParseKinds.td

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2022-01-20 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Parse/ParseDecl.cpp:468 + + // General case. Parse all available expressions. + CommaLocsTy CommaLocs; I think it'd be good to move this comment up closer to the `else` on line 461 so that it's

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2022-01-20 Thread Steffen Larsen via Phabricator via cfe-commits
steffenlarsen updated this revision to Diff 401580. steffenlarsen added a comment. Applied suggestions. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D114439/new/ https://reviews.llvm.org/D114439 Files: clang/include/clang/Basic/Attr.td clang/include/clang/Basic/DiagnosticParseKinds

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2022-01-20 Thread Steffen Larsen via Phabricator via cfe-commits
steffenlarsen added a comment. Thank you, @aaron.ballman ! I will update the revision in a moment with some of the suggested changes. Comment at: clang/lib/Parse/ParseDecl.cpp:436-438 +// Interpret "kw_this" as an identifier if the attributed requests it. +if (

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2022-01-19 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. Thanks for this, I think it's shaping up well! Comment at: clang/include/clang/Basic/DiagnosticParseKinds.td:723 +def err_attribute_argument_parm_pack_not_supported : Error< + "attribute %0 does not support pack expansion in arguments">; +def err

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2022-01-12 Thread Steffen Larsen via Phabricator via cfe-commits
steffenlarsen updated this revision to Diff 399334. steffenlarsen added a comment. I have made the changes suggested in my previous comment. This makes significantly more changes to the parsing of attribute arguments as the old path was needed for attributes that allow both expressions and types

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2021-12-21 Thread Steffen Larsen via Phabricator via cfe-commits
steffenlarsen added a comment. I agree that reusing existing parser logic for this would be preferable, but as @aaron.ballman mentions `Parser::ParseSimpleExpressionList` does not give us the parameter pack expansion parsing we need. We could potentially unify it with the logic from https://gi

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2021-12-15 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Parse/ParseDecl.cpp:447 Actions.CorrectDelayedTyposInExpr(ParseAssignmentExpression())); + +if (Tok.is(tok::ellipsis)) { erichkeane wrote: > steffenlarsen wrote: > > erichkeane wrote:

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2021-12-09 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments. Comment at: clang/lib/Parse/ParseDecl.cpp:447 Actions.CorrectDelayedTyposInExpr(ParseAssignmentExpression())); + +if (Tok.is(tok::ellipsis)) { steffenlarsen wrote: > erichkeane wrote: > > steffenlarsen wrote:

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2021-12-09 Thread Steffen Larsen via Phabricator via cfe-commits
steffenlarsen added inline comments. Comment at: clang/lib/Parse/ParseDecl.cpp:447 Actions.CorrectDelayedTyposInExpr(ParseAssignmentExpression())); + +if (Tok.is(tok::ellipsis)) { erichkeane wrote: > steffenlarsen wrote: > > erichkeane wrote:

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2021-12-09 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments. Comment at: clang/lib/Parse/ParseDecl.cpp:447 Actions.CorrectDelayedTyposInExpr(ParseAssignmentExpression())); + +if (Tok.is(tok::ellipsis)) { steffenlarsen wrote: > erichkeane wrote: > > steffenlarsen wrote:

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2021-12-09 Thread Steffen Larsen via Phabricator via cfe-commits
steffenlarsen added inline comments. Comment at: clang/lib/Parse/ParseDecl.cpp:447 Actions.CorrectDelayedTyposInExpr(ParseAssignmentExpression())); + +if (Tok.is(tok::ellipsis)) { erichkeane wrote: > steffenlarsen wrote: > > erichkeane wrote:

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2021-12-08 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments. Comment at: clang/lib/Parse/ParseDecl.cpp:447 Actions.CorrectDelayedTyposInExpr(ParseAssignmentExpression())); + +if (Tok.is(tok::ellipsis)) { steffenlarsen wrote: > erichkeane wrote: > > So I was thinking ab

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2021-12-08 Thread Steffen Larsen via Phabricator via cfe-commits
steffenlarsen added inline comments. Comment at: clang/lib/Parse/ParseDecl.cpp:447 Actions.CorrectDelayedTyposInExpr(ParseAssignmentExpression())); + +if (Tok.is(tok::ellipsis)) { erichkeane wrote: > So I was thinking about this overnight...

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2021-12-07 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments. Comment at: clang/lib/Parse/ParseDecl.cpp:447 Actions.CorrectDelayedTyposInExpr(ParseAssignmentExpression())); + +if (Tok.is(tok::ellipsis)) { So I was thinking about this overnight... I wonder if this logic

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2021-12-07 Thread Steffen Larsen via Phabricator via cfe-commits
steffenlarsen added inline comments. Comment at: clang/test/Parser/cxx0x-attributes.cpp:268 + void faz [[clang::annotate("B", (Is + ...))]] (); // expected-warning {{pack fold expression is a C++17 extension}} + void foz [[clang::annotate("C", Is...)]] (); }

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2021-12-07 Thread Steffen Larsen via Phabricator via cfe-commits
steffenlarsen updated this revision to Diff 392340. steffenlarsen added a comment. The new revision does the following: 1. Revisits the diagnostics. Now parameter packs will cause the same error on attributes that do not support parameter packs in arguments, while attributes that support it wil

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2021-12-07 Thread Steffen Larsen via Phabricator via cfe-commits
steffenlarsen added inline comments. Comment at: clang/include/clang/Basic/DiagnosticParseKinds.td:724 + "attribute %0 does not support pack expansion in the last argument">; +def err_attribute_parm_pack_last_argument_only : Error< + "pack expansion in attributes is restricted

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2021-12-06 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments. Comment at: clang/include/clang/Basic/DiagnosticParseKinds.td:724 + "attribute %0 does not support pack expansion in the last argument">; +def err_attribute_parm_pack_last_argument_only : Error< + "pack expansion in attributes is restricted to

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2021-12-03 Thread Steffen Larsen via Phabricator via cfe-commits
steffenlarsen added a comment. Thank you both for the reviews! Consensus seems to be having support for pack expansion at argument level for now and let more complicated logic be added when there is an actual need. I have applied these changes as I understood them and have added/adjusted the re

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2021-12-03 Thread Steffen Larsen via Phabricator via cfe-commits
steffenlarsen updated this revision to Diff 391588. steffenlarsen edited the summary of this revision. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D114439/new/ https://reviews.llvm.org/D114439 Files: clang/include/clang/Basic/Attr.td clang/include/clang/Basic/DiagnosticParseKinds.td

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2021-12-02 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments. Comment at: clang/include/clang/Basic/Attr.td:544-546 + // Set to true for attributes that support parameter pack expansion in its + // arguments. + bit ParmExpansionArgsSupport = 0; aaron.ballman wrote: > steffenlarsen wrote:

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2021-12-02 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/include/clang/Basic/Attr.td:544-546 + // Set to true for attributes that support parameter pack expansion in its + // arguments. + bit ParmExpansionArgsSupport = 0; steffenlarsen wrote: > aaron.ballman wro

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2021-12-02 Thread Steffen Larsen via Phabricator via cfe-commits
steffenlarsen added inline comments. Comment at: clang/lib/Parse/ParseDecl.cpp:447 + } + ArgExpr = Actions.ActOnPackExpansion(ArgExpr.get(), ConsumeToken()); +} steffenlarsen wrote: > erichkeane wrote: > > Do you have a test for somethin

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2021-12-02 Thread Steffen Larsen via Phabricator via cfe-commits
steffenlarsen added inline comments. Comment at: clang/include/clang/Basic/Attr.td:544-546 + // Set to true for attributes that support parameter pack expansion in its + // arguments. + bit ParmExpansionArgsSupport = 0; aaron.ballman wrote: > From a design per

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2021-12-01 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment. >> I think the safest bet is to be conservative and not allow mixing packs with >> variadics, and not allowing multiple packs. We should be able to diagnose >> that situation from ClangAttrEmitter.cpp to help attribute authors out. >> However, it'd be worth adding a

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2021-12-01 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman requested changes to this revision. aaron.ballman added inline comments. This revision now requires changes to proceed. Comment at: clang/include/clang/Basic/Attr.td:544-546 + // Set to true for attributes that support parameter pack expansion in its + // argument

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2021-12-01 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment. Aaron is way more familiar with this code than I am, but I've got some suggestions for more tests in the parsing, we need to make sure that we handle pack expansion completely here. Comment at: clang/lib/Parse/ParseDecl.cpp:447 + } +

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2021-11-23 Thread Tyker via Phabricator via cfe-commits
Tyker added a comment. This seems like a good change to me. but i don't think my approval is enough Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D114439/new/ https://reviews.llvm.org/D114439 ___ cfe-comm

[PATCH] D114439: [Annotation] Allow parameter pack expansions in annotate attribute

2021-11-23 Thread Steffen Larsen via Phabricator via cfe-commits
steffenlarsen created this revision. steffenlarsen added reviewers: erichkeane, aaron.ballman, Tyker, Naghasan. Herald added a subscriber: jdoerfert. steffenlarsen requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. These changes make the Clang