diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-08-07 06:08:38 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-08-07 06:08:38 +0000 |
commit | 42602bb40aefcc2751d4078ba88aacf4d965c9bd (patch) | |
tree | f06466787a5ac3936997adfcedd9fcd3d711a30f /lib/AST/ExprCXX.cpp | |
parent | ef888a4d7f0fa1596807f702d09df88044dcaf41 (diff) |
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
Diffstat (limited to 'lib/AST/ExprCXX.cpp')
-rw-r--r-- | lib/AST/ExprCXX.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp index d8e069d000..67d62a94ec 100644 --- a/lib/AST/ExprCXX.cpp +++ b/lib/AST/ExprCXX.cpp @@ -17,14 +17,6 @@ #include "clang/AST/ExprCXX.h" using namespace clang; -void CXXConditionDeclExpr::Destroy(ASTContext& C) { - // FIXME: Cannot destroy the decl here, because it is linked into the - // DeclContext's chain. - //getVarDecl()->Destroy(C); - this->~CXXConditionDeclExpr(); - C.Deallocate(this); -} - //===----------------------------------------------------------------------===// // Child Iterators for iterating over subexpressions/substatements //===----------------------------------------------------------------------===// @@ -196,11 +188,13 @@ TemplateIdRefExpr::Create(ASTContext &Context, QualType T, NumTemplateArgs, RAngleLoc); } -void TemplateIdRefExpr::Destroy(ASTContext &Context) { +void TemplateIdRefExpr::DoDestroy(ASTContext &Context) { const TemplateArgument *TemplateArgs = getTemplateArgs(); for (unsigned I = 0; I != NumTemplateArgs; ++I) if (Expr *E = TemplateArgs[I].getAsExpr()) E->Destroy(Context); + this->~TemplateIdRefExpr(); + Context.Deallocate(this); } Stmt::child_iterator TemplateIdRefExpr::child_begin() { @@ -348,9 +342,9 @@ CXXTemporary *CXXTemporary::Create(ASTContext &C, return new (C) CXXTemporary(Destructor); } -void CXXTemporary::Destroy(ASTContext &C) { +void CXXTemporary::Destroy(ASTContext &Ctx) { this->~CXXTemporary(); - C.Deallocate(this); + Ctx.Deallocate(this); } CXXBindTemporaryExpr *CXXBindTemporaryExpr::Create(ASTContext &C, @@ -362,7 +356,7 @@ CXXBindTemporaryExpr *CXXBindTemporaryExpr::Create(ASTContext &C, return new (C) CXXBindTemporaryExpr(Temp, SubExpr); } -void CXXBindTemporaryExpr::Destroy(ASTContext &C) { +void CXXBindTemporaryExpr::DoDestroy(ASTContext &C) { Temp->Destroy(C); this->~CXXBindTemporaryExpr(); C.Deallocate(this); @@ -406,7 +400,7 @@ CXXConstructExpr::CXXConstructExpr(ASTContext &C, StmtClass SC, QualType T, } } -void CXXConstructExpr::Destroy(ASTContext &C) { +void CXXConstructExpr::DoDestroy(ASTContext &C) { DestroyChildren(C); if (Args) C.Deallocate(Args); @@ -438,7 +432,7 @@ CXXExprWithTemporaries *CXXExprWithTemporaries::Create(ASTContext &C, ShouldDestroyTemps); } -void CXXExprWithTemporaries::Destroy(ASTContext &C) { +void CXXExprWithTemporaries::DoDestroy(ASTContext &C) { DestroyChildren(C); this->~CXXExprWithTemporaries(); C.Deallocate(this); |