[PATCH] D99896: Rework the way statement attributes are processed; NFC

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 5 13:18:35 PDT 2021


aaron.ballman added a comment.

In D99896#2669471 <https://reviews.llvm.org/D99896#2669471>, @erichkeane wrote:

> It is really sad that the attributes can't 'auto transform' themselves.  ParsedAttr could (since it has a union of expressions/identifiers), but we don't really seem to have a good way to do it for Attr.
>
> Could we possibly do some table-gen to auto create the 'simple' ones?  Basically, any parameter to an attribute that is an 'expr' gets auto-transformed?  Similar to how we have handleSimpleAttr, we could have TransformSimpleAttr (or, a generated one).

I think that's likely plausible, though as a follow-up. We have enough declaration attributes with template instantiation that I'd probably start with those and do statement attributes in a second cleanup.



================
Comment at: clang/lib/Sema/TreeTransform.h:1316
                                    Stmt *SubStmt) {
-    return SemaRef.ActOnAttributedStmt(AttrLoc, Attrs, SubStmt);
+    return SemaRef.BuildAttributedStmt(AttrLoc, Attrs, SubStmt);
   }
----------------
erichkeane wrote:
> Am I missing where the attributes themselves are being rebuilt/transformed??  
> 
> 
The transformation happens in `TreeTransform<Derived>::TransformAttributedStmt()` which calls `RebuildAttributedStmt()` with the rebuilt attributes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99896



More information about the cfe-commits mailing list