Separate Stmt::Destroy into the entrypoint for destroying a statement
or expression (Destroy) from the virtual function used to actually
destroy a given expression (DoDestroy).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78375 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp
index 1757791..668f7ef 100644
--- a/lib/AST/Stmt.cpp
+++ b/lib/AST/Stmt.cpp
@@ -51,19 +51,12 @@
if (Stmt* Child = *I++) Child->Destroy(C);
}
-void Stmt::Destroy(ASTContext &C) {
+void Stmt::DoDestroy(ASTContext &C) {
DestroyChildren(C);
- // FIXME: Eventually all Stmts should be allocated with the allocator
- // in ASTContext, just like with Decls.
this->~Stmt();
C.Deallocate((void *)this);
}
-void DeclStmt::Destroy(ASTContext &C) {
- this->~DeclStmt();
- C.Deallocate((void *)this);
-}
-
void Stmt::PrintStats() {
// Ensure the table is primed.
getStmtInfoTableEntry(Stmt::NullStmtClass);
@@ -569,10 +562,10 @@
return QualType();
}
-void CXXCatchStmt::Destroy(ASTContext& C) {
+void CXXCatchStmt::DoDestroy(ASTContext& C) {
if (ExceptionDecl)
ExceptionDecl->Destroy(C);
- Stmt::Destroy(C);
+ Stmt::DoDestroy(C);
}
// CXXTryStmt