[PATCH] D86169: Initial support for letting plugins perform custom parsing of attribute arguments.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 21 07:26:47 PDT 2020


aaron.ballman added reviewers: john.brawn, rsmith, erichkeane.
aaron.ballman added a comment.

Thank you for the work in progress patch as a starting point for discussion! I'm adding a few more reviewers who may be interested in this work.

One part of the design I'm not yet certain of is passing in the `Declarator *` to the various parsing functions. While I understand the idea (and appreciate the explanation of why you'd like this), my concern is that attributes appertain to more than just declarators (like declaration specifiers, types,  and statements). Do you envision supporting all the various entities that an attribute can appertain to? Also, do you intend to provide the same information to the other spellings, like `__attribute__` or `__declspec` (because plugins can define custom attributes with those spellings as well)?



================
Comment at: clang/include/clang/Sema/ParsedAttr.h:97
+  virtual AttrHandling
+  parseAttributePayload(Parser *P, ParsedAttributes &Attrs, Declarator *D,
+                        IdentifierInfo *AttrName, SourceLocation AttrNameLoc,
----------------
I think this should also have a parameter for the syntax used for the attribute, because different syntaxes may have different rules for how to parse the arguments to the attribute (this is one of the reasons why we have common attribute argument parsing as well as syntax-specific attribute argument parsing in `Parser`).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86169



More information about the cfe-commits mailing list