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.