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

Josh Haberman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 5 15:02:01 PDT 2021


haberman added inline comments.


================
Comment at: clang/lib/Sema/TreeTransform.h:1316
                                    Stmt *SubStmt) {
-    return SemaRef.ActOnAttributedStmt(AttrLoc, Attrs, SubStmt);
+    return SemaRef.BuildAttributedStmt(AttrLoc, Attrs, SubStmt);
   }
----------------
aaron.ballman wrote:
> haberman wrote:
> > aaron.ballman wrote:
> > > 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.
> > It appears that neither `TransformAttributedStmt()` nor `RebuildAttributedStmt()` calls `ProcessStmtAttributes()`, either directly or transitively, so I'm not seeing where we can run instantiation-time attribute processing logic. What am I missing?
> My thinking is: 
> 
> * From `handleMustTailAttr()` in SemaStmtAttr.cpp, call `CheckMustTailAttr()` to do the shared semantic checking.
> * Add a `TransformMustTailAttr()` to `TreeTransform`, have it call `SemaRef.CheckMustTailAttr()` as well.
I see. My main concern then is that `TransformMustTailAttr()` could get access to the `ReturnExpr` to perform the validation. Right now the `MustTailAttr` doesn't appear to have any reference to the `ReturnExpr`, and I don't know how to give it one.

If there is a solution to this problem, I don't have any objection. My main concern is to unblock my change which is a high priority for me and my team.


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