aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-05-15 00:21:21 +0000
committerAnders Carlsson <andersca@mac.com>2009-05-15 00:21:21 +0000
commitd19cd90b266181c4a8d186adfa20ccebe73336cc (patch)
treea64f64979e70e63243b37d8e15a860aa8d04fff6
parent137fa562caedf11df4bb10f2657651a785769ca7 (diff)
Add NullStmt::Clone and use it
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71823 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/Stmt.h2
-rw-r--r--lib/AST/Stmt.cpp4
-rw-r--r--lib/Sema/SemaTemplateInstantiateExpr.cpp2
3 files changed, 7 insertions, 1 deletions
diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h
index 5165d2ab2e..99e49722af 100644
--- a/include/clang/AST/Stmt.h
+++ b/include/clang/AST/Stmt.h
@@ -290,6 +290,8 @@ public:
/// \brief Build an empty null statement.
explicit NullStmt(EmptyShell Empty) : Stmt(NullStmtClass, Empty) { }
+ NullStmt* Clone(ASTContext &C) const;
+
SourceLocation getSemiLoc() const { return SemiLoc; }
void setSemiLoc(SourceLocation L) { SemiLoc = L; }
diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp
index 02f5eee828..f8f6e067e1 100644
--- a/lib/AST/Stmt.cpp
+++ b/lib/AST/Stmt.cpp
@@ -98,6 +98,10 @@ bool Stmt::CollectingStats(bool enable) {
return StatSwitch;
}
+NullStmt* NullStmt::Clone(ASTContext &C) const {
+ return new (C) NullStmt(SemiLoc);
+}
+
void CompoundStmt::setStmts(ASTContext &C, Stmt **Stmts, unsigned NumStmts) {
if (this->Body)
C.Deallocate(Body);
diff --git a/lib/Sema/SemaTemplateInstantiateExpr.cpp b/lib/Sema/SemaTemplateInstantiateExpr.cpp
index e747236204..50d5d4442f 100644
--- a/lib/Sema/SemaTemplateInstantiateExpr.cpp
+++ b/lib/Sema/SemaTemplateInstantiateExpr.cpp
@@ -480,7 +480,7 @@ Sema::OwningStmtResult TemplateStmtInstantiator::VisitDeclStmt(DeclStmt *S) {
}
Sema::OwningStmtResult TemplateStmtInstantiator::VisitNullStmt(NullStmt *S) {
- return SemaRef.Owned(new (SemaRef.Context) NullStmt(S->getSemiLoc()));
+ return SemaRef.Owned(S->Clone(SemaRef.Context));
}
Sema::OwningStmtResult TemplateStmtInstantiator::VisitLabelStmt(LabelStmt *S) {