This is an archive of the discontinued LLVM Phabricator instance.

Provide TreeTransform::TransformAttr the transformed statement; NFC
AcceptedPublic

Authored by aaron.ballman on Apr 6 2021, 11:53 AM.

Details

Reviewers
rsmith
haberman
Summary

It is useful statement an attribute is being applied to when performing semantic processing of the attribute during template instantiation. This functionality is not currently needed by existing attributes, but is anticipated to be used by new attributes being worked on.

One design choice with this is whether to transform attributes then the attributed statement, or to transform the attributed statement and then the attributes. I elected to transform the attributed statement first because it seems less likely that the statement transformation would require the instanatiated attributes compared to when we transform attributes (those would benefit from knowing the fully instantiated statement). This patch passes a non-const Stmt * to TransformAttr() in case the attribute instantiation needs to modify the attributed statement for some reason.

Diff Detail

Event Timeline

aaron.ballman requested review of this revision.Apr 6 2021, 11:53 AM
aaron.ballman created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptApr 6 2021, 11:53 AM

Now that [[clang::musttail]] has landed, I can show the refactoring I had in mind by implementing it myself. WDYT of this approach?

haberman accepted this revision.Apr 21 2021, 2:07 PM

This seems fine to me, but I'll defer to @rsmith for final review.

This revision is now accepted and ready to land.Apr 21 2021, 2:07 PM