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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 6 04:23:43 PDT 2021


aaron.ballman 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);
   }
----------------
haberman wrote:
> 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.
> 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.

I'll add a way for that to happen today or tomorrow and we can iterate from there.


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