Add an AttributedStmt type to represent a statement with C++11 attributes
attached. Since we do not support any attributes which appertain to a statement
(yet), testing of this is necessarily quite minimal.
Patch by Alexander Kornienko!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154723 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h
index fdb861e..acfea6e 100644
--- a/lib/Sema/TreeTransform.h
+++ b/lib/Sema/TreeTransform.h
@@ -1044,6 +1044,15 @@
return SemaRef.ActOnLabelStmt(IdentLoc, L, ColonLoc, SubStmt);
}
+ /// \brief Build a new label statement.
+ ///
+ /// By default, performs semantic analysis to build the new statement.
+ /// Subclasses may override this routine to provide different behavior.
+ StmtResult RebuildAttributedStmt(SourceLocation AttrLoc, const AttrVec &Attrs,
+ Stmt *SubStmt) {
+ return SemaRef.ActOnAttributedStmt(AttrLoc, Attrs, SubStmt);
+ }
+
/// \brief Build a new "if" statement.
///
/// By default, performs semantic analysis to build the new statement.
@@ -5154,8 +5163,8 @@
S->getDecl());
if (!LD)
return StmtError();
-
-
+
+
// FIXME: Pass the real colon location in.
return getDerived().RebuildLabelStmt(S->getIdentLoc(),
cast<LabelDecl>(LD), SourceLocation(),
@@ -5164,6 +5173,22 @@
template<typename Derived>
StmtResult
+TreeTransform<Derived>::TransformAttributedStmt(AttributedStmt *S) {
+ StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt());
+ if (SubStmt.isInvalid())
+ return StmtError();
+
+ // TODO: transform attributes
+ if (SubStmt.get() == S->getSubStmt() /* && attrs are the same */)
+ return S;
+
+ return getDerived().RebuildAttributedStmt(S->getAttrLoc(),
+ S->getAttrs(),
+ SubStmt.get());
+}
+
+template<typename Derived>
+StmtResult
TreeTransform<Derived>::TransformIfStmt(IfStmt *S) {
// Transform the condition
ExprResult Cond;