Add NullStmt::Clone and use it

llvm-svn: 71823
This commit is contained in:
Anders Carlsson 2009-05-15 00:21:21 +00:00
parent f42de874b3
commit 03b0dd5913
3 changed files with 7 additions and 1 deletions

View File

@ -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; }

View File

@ -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);

View File

@ -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) {