[PATCH] D99861: [Clang] Record tokens in attribute arguments for user-defined C++/C2x attributes

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 19 09:05:47 PDT 2021


aaron.ballman added a comment.

In D99861#2697449 <https://reviews.llvm.org/D99861#2697449>, @Qix- wrote:

> I'm not sure exactly how to continue after the last few comments - what should the approach be for this patch? Or are these things we can shoot for in later patches?

I don't think they're things we should shoot for in a later patch; the token replay approach doesn't seem like it would work for more complicated attribute arguments. As a concrete example of what would be super difficult to support would be:

  struct S {
    int member;
    void func(int i, int j) [[plugin::attr(i + j + member)]];
  };

because it would be very difficult to recognize that `member` is looked up in the context of the declaration of `S::func()` after having left the parsing context for the structure.

I think the one way to continue is along the lines of what's described in https://bugs.llvm.org/show_bug.cgi?id=46446#c11 so that the plugin handles parsing the arguments by invoking calls on the parser.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99861/new/

https://reviews.llvm.org/D99861



More information about the cfe-commits mailing list