diff options
38 files changed, 17 insertions, 777 deletions
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 737eeff2a1..e61e860b3e 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -264,8 +264,6 @@ public: static NamespaceDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id); - virtual void Destroy(ASTContext& C); - // \brief Returns true if this is an anonymous namespace declaration. // // For example: @@ -392,8 +390,6 @@ struct QualifierInfo { unsigned NumTPLists, TemplateParameterList **TPLists); - void Destroy(ASTContext &Context); - private: // Copy constructor and copy assignment are disabled. QualifierInfo(const QualifierInfo&); @@ -422,7 +418,6 @@ protected: public: virtual ~DeclaratorDecl(); - virtual void Destroy(ASTContext &C); TypeSourceInfo *getTypeSourceInfo() const { return hasExtInfo() @@ -609,7 +604,6 @@ public: QualType T, TypeSourceInfo *TInfo, StorageClass S, StorageClass SCAsWritten); - virtual void Destroy(ASTContext& C); virtual ~VarDecl(); virtual SourceLocation getInnerLocStart() const; @@ -1194,7 +1188,6 @@ protected: EndRangeLoc(L), TemplateOrSpecialization() {} virtual ~FunctionDecl() {} - virtual void Destroy(ASTContext& C); typedef Redeclarable<FunctionDecl> redeclarable_base; virtual FunctionDecl *getNextRedeclaration() { return RedeclLink.getNext(); } @@ -1713,8 +1706,6 @@ public: QualType T, Expr *E, const llvm::APSInt &V); - virtual void Destroy(ASTContext& C); - const Expr *getInitExpr() const { return (const Expr*) Init; } Expr *getInitExpr() { return (Expr*) Init; } const llvm::APSInt &getInitVal() const { return Val; } @@ -1881,8 +1872,6 @@ protected: virtual TagDecl *getNextRedeclaration() { return RedeclLink.getNext(); } public: - void Destroy(ASTContext &C); - typedef redeclarable_base::redecl_iterator redecl_iterator; redecl_iterator redecls_begin() const { return redeclarable_base::redecls_begin(); @@ -2060,8 +2049,6 @@ public: SourceLocation TKL, EnumDecl *PrevDecl); static EnumDecl *Create(ASTContext &C, EmptyShell Empty); - virtual void Destroy(ASTContext& C); - /// completeDefinition - When created, the EnumDecl corresponds to a /// forward-declared enum. This method is used to mark the /// declaration as being defined; it's enumerators have already been @@ -2185,8 +2172,6 @@ public: return cast_or_null<RecordDecl>(TagDecl::getPreviousDeclaration()); } - virtual void Destroy(ASTContext& C); - bool hasFlexibleArrayMember() const { return HasFlexibleArrayMember; } void setHasFlexibleArrayMember(bool V) { HasFlexibleArrayMember = V; } @@ -2310,7 +2295,6 @@ protected: SignatureAsWritten(0) {} virtual ~BlockDecl(); - virtual void Destroy(ASTContext& C); public: static BlockDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L); diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h index be30b8ed29..07688473ef 100644 --- a/include/clang/AST/DeclBase.h +++ b/include/clang/AST/DeclBase.h @@ -572,9 +572,6 @@ public: static DeclContext *castToDeclContext(const Decl *); static Decl *castFromDeclContext(const DeclContext *); - /// Destroy - Call destructors and release memory. - virtual void Destroy(ASTContext& C); - void print(llvm::raw_ostream &Out, unsigned Indentation = 0) const; void print(llvm::raw_ostream &Out, const PrintingPolicy &Policy, unsigned Indentation = 0) const; @@ -654,8 +651,6 @@ protected: ExternalVisibleStorage(false), LookupPtr(0), FirstDecl(0), LastDecl(0) { } - void DestroyDecls(ASTContext &C); - public: ~DeclContext(); diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h index 9cea17e8ac..19bdc9c3c3 100644 --- a/include/clang/AST/DeclCXX.h +++ b/include/clang/AST/DeclCXX.h @@ -449,8 +449,6 @@ public: bool DelayTypeCreation = false); static CXXRecordDecl *Create(ASTContext &C, EmptyShell Empty); - virtual void Destroy(ASTContext& C); - bool isDynamicClass() const { return data().Polymorphic || data().NumVBases != 0; } @@ -1249,9 +1247,6 @@ public: VarDecl **Indices, unsigned NumIndices); - /// \brief Destroy the base or member initializer. - void Destroy(ASTContext &Context); - /// isBaseInitializer - Returns true when this initializer is /// initializing a base class. bool isBaseInitializer() const { return BaseOrMember.is<TypeSourceInfo*>(); } @@ -1404,7 +1399,6 @@ class CXXConstructorDecl : public CXXMethodDecl { BaseOrMemberInitializers(0), NumBaseOrMemberInitializers(0) { setImplicit(isImplicitlyDeclared); } - virtual void Destroy(ASTContext& C); public: static CXXConstructorDecl *Create(ASTContext &C, EmptyShell Empty); @@ -2244,7 +2238,6 @@ public: const StringLiteral *getMessage() const { return Message; } virtual ~StaticAssertDecl(); - virtual void Destroy(ASTContext& C); static bool classof(const Decl *D) { return classofKind(D->getKind()); } static bool classof(StaticAssertDecl *D) { return true; } diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h index d4735bfb84..0c298779a1 100644 --- a/include/clang/AST/DeclObjC.h +++ b/include/clang/AST/DeclObjC.h @@ -42,11 +42,8 @@ protected: public: ObjCListBase() : List(0), NumElts(0) {} ~ObjCListBase() { - assert(List == 0 && "Destroy should have been called before dtor"); } - void Destroy(ASTContext &Ctx); - unsigned size() const { return NumElts; } bool empty() const { return NumElts == 0; } @@ -92,7 +89,6 @@ public: void set(ObjCProtocolDecl* const* InList, unsigned Elts, const SourceLocation *Locs, ASTContext &Ctx); - void Destroy(ASTContext &Ctx); }; @@ -195,10 +191,6 @@ private: virtual ObjCMethodDecl *getNextRedeclaration(); public: - - /// Destroy - Call destructors and release memory. - virtual void Destroy(ASTContext& C); - static ObjCMethodDecl *Create(ASTContext &C, SourceLocation beginLoc, SourceLocation endLoc, Selector SelInfo, @@ -494,10 +486,6 @@ class ObjCInterfaceDecl : public ObjCContainerDecl { virtual ~ObjCInterfaceDecl() {} public: - - /// Destroy - Call destructors and release memory. - virtual void Destroy(ASTContext& C); - static ObjCInterfaceDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation atLoc, IdentifierInfo *Id, @@ -715,8 +703,6 @@ public: IdentifierInfo *Id, QualType T, Expr *BW); - virtual void Destroy(ASTContext& C); - // Implement isa/cast/dyncast/etc. static bool classof(const Decl *D) { return classofKind(D->getKind()); } static bool classof(const ObjCAtDefsFieldDecl *D) { return true; } @@ -766,9 +752,6 @@ public: static ObjCProtocolDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id); - /// Destroy - Call destructors and release memory. - virtual void Destroy(ASTContext& C); - const ObjCProtocolList &getReferencedProtocols() const { return ReferencedProtocols; } @@ -839,10 +822,6 @@ private: unsigned nElts, ASTContext &C); virtual ~ObjCClassDecl() {} public: - - /// Destroy - Call destructors and release memory. - virtual void Destroy(ASTContext& C); - static ObjCClassDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L, ObjCInterfaceDecl *const *Elts = 0, const SourceLocation *Locs = 0, @@ -889,9 +868,6 @@ public: return Create(C, DC, L, 0, 0, 0); } - /// Destroy - Call destructors and release memory. - virtual void Destroy(ASTContext& C); - typedef ObjCProtocolList::iterator protocol_iterator; protocol_iterator protocol_begin() const {return ReferencedProtocols.begin();} protocol_iterator protocol_end() const { return ReferencedProtocols.end(); } diff --git a/include/clang/AST/DeclTemplate.h b/include/clang/AST/DeclTemplate.h index 0b3727e50c..6c83e00198 100644 --- a/include/clang/AST/DeclTemplate.h +++ b/include/clang/AST/DeclTemplate.h @@ -193,11 +193,6 @@ public: TemplateArgumentList() : NumFlatArguments(0), NumStructuredArguments(0) { } - /// Used to release the memory associated with a TemplateArgumentList - /// object. FIXME: This is currently not called anywhere, but the - /// memory will still be freed when using a BumpPtrAllocator. - void Destroy(ASTContext &C); - ~TemplateArgumentList(); /// \brief Copies the template arguments into a locally new[]'d array. @@ -542,8 +537,6 @@ protected: CommonOrPrev((Common*)0) { } public: - void Destroy(ASTContext &C); - /// Get the underlying function declaration of the template. FunctionDecl *getTemplatedDecl() const { return static_cast<FunctionDecl*>(TemplatedDecl); @@ -1004,8 +997,6 @@ public: static ClassTemplateSpecializationDecl * Create(ASTContext &Context, EmptyShell Empty); - virtual void Destroy(ASTContext& C); - virtual void getNameForDiagnostic(std::string &S, const PrintingPolicy &Policy, bool Qualified) const; @@ -1609,8 +1600,6 @@ public: static bool classof(const ClassTemplateDecl *D) { return true; } static bool classofKind(Kind K) { return K == ClassTemplate; } - virtual void Destroy(ASTContext& C); - friend class PCHDeclReader; friend class PCHDeclWriter; }; diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h index bbef5a25ea..58743c72d7 100644 --- a/include/clang/AST/Expr.h +++ b/include/clang/AST/Expr.h @@ -888,9 +888,6 @@ class StringLiteral : public Expr { StringLiteral(QualType Ty) : Expr(StringLiteralClass, Ty, false, false) {} -protected: - virtual void DoDestroy(ASTContext &C); - public: /// This is the "fully general" constructor that allows representation of /// strings formed from multiple concatenated tokens. @@ -1309,9 +1306,6 @@ class SizeOfAlignOfExpr : public Expr { } Argument; SourceLocation OpLoc, RParenLoc; -protected: - virtual void DoDestroy(ASTContext& C); - public: SizeOfAlignOfExpr(bool issizeof, TypeSourceInfo *TInfo, QualType resultType, SourceLocation op, @@ -1484,8 +1478,6 @@ protected: CallExpr(ASTContext& C, StmtClass SC, Expr *fn, Expr **args, unsigned numargs, QualType t, SourceLocation rparenloc); - virtual void DoDestroy(ASTContext& C); - public: CallExpr(ASTContext& C, Expr *fn, Expr **args, unsigned numargs, QualType t, SourceLocation rparenloc); @@ -2004,8 +1996,6 @@ protected: CastExpr(StmtClass SC, EmptyShell Empty) : Expr(SC, Empty) { } - virtual void DoDestroy(ASTContext &C); - public: CastKind getCastKind() const { return Kind; } void setCastKind(CastKind K) { Kind = K; } @@ -2561,9 +2551,6 @@ class ShuffleVectorExpr : public Expr { Stmt **SubExprs; unsigned NumExprs; -protected: - virtual void DoDestroy(ASTContext &C); - public: // FIXME: Can a shufflevector be value-dependent? Does type-dependence need // to be computed differently? @@ -2975,11 +2962,6 @@ private: : Expr(DesignatedInitExprClass, EmptyShell()), NumDesignators(0), Designators(0), NumSubExprs(NumSubExprs) { } -protected: - virtual void DoDestroy(ASTContext &C); - - void DestroyDesignators(ASTContext &C); - public: /// A field designator, e.g., ".x". struct FieldDesignator { @@ -3247,9 +3229,6 @@ class ParenListExpr : public Expr { unsigned NumExprs; SourceLocation LParenLoc, RParenLoc; -protected: - virtual void DoDestroy(ASTContext& C); - public: ParenListExpr(ASTContext& C, SourceLocation lparenloc, Expr **exprs, unsigned numexprs, SourceLocation rparenloc); diff --git a/include/clang/AST/ExprCXX.h b/include/clang/AST/ExprCXX.h index b9553815d8..7336f5f051 100644 --- a/include/clang/AST/ExprCXX.h +++ b/include/clang/AST/ExprCXX.h @@ -479,9 +479,6 @@ class CXXDefaultArgExpr : public Expr { *reinterpret_cast<Expr **>(this + 1) = SubExpr; } -protected: - virtual void DoDestroy(ASTContext &C); - public: CXXDefaultArgExpr(EmptyShell Empty) : Expr(CXXDefaultArgExprClass, Empty) {} @@ -552,8 +549,6 @@ public: static CXXTemporary *Create(ASTContext &C, const CXXDestructorDecl *Destructor); - void Destroy(ASTContext &Ctx); - const CXXDestructorDecl *getDestructor() const { return Destructor; } }; @@ -581,9 +576,6 @@ class CXXBindTemporaryExpr : public Expr { Temp(temp), SubExpr(subexpr) { } ~CXXBindTemporaryExpr() { } -protected: - virtual void DoDestroy(ASTContext &C); - public: CXXBindTemporaryExpr(EmptyShell Empty) : Expr(CXXBindTemporaryExprClass, Empty), Temp(0), SubExpr(0) {} @@ -641,9 +633,6 @@ class CXXBindReferenceExpr : public Expr { RequiresTemporaryCopy(RequiresTemporaryCopy) { } ~CXXBindReferenceExpr() { } -protected: - virtual void DoDestroy(ASTContext &C); - public: static CXXBindReferenceExpr *Create(ASTContext &C, Expr *SubExpr, bool ExtendsLifetime, @@ -714,8 +703,6 @@ protected: : Expr(SC, Empty), Constructor(0), Elidable(0), ZeroInitialization(0), ConstructKind(0), Args(0), NumArgs(0) { } - virtual void DoDestroy(ASTContext &C); - public: /// \brief Construct an empty C++ construction expression. explicit CXXConstructExpr(EmptyShell Empty) @@ -967,8 +954,6 @@ public: void AllocateArgsArray(ASTContext &C, bool isArray, unsigned numPlaceArgs, unsigned numConsArgs); - virtual void DoDestroy(ASTContext &C); - QualType getAllocatedType() const { assert(getType()->isPointerType()); return getType()->getAs<PointerType>()->getPointeeType(); @@ -1779,9 +1764,6 @@ class CXXExprWithTemporaries : public Expr { unsigned NumTemps); ~CXXExprWithTemporaries(); -protected: - virtual void DoDestroy(ASTContext &C); - public: CXXExprWithTemporaries(EmptyShell Empty) : Expr(CXXExprWithTemporariesClass, Empty), diff --git a/include/clang/AST/FullExpr.h b/include/clang/AST/FullExpr.h index bb81bf0fe7..6ceefed8a6 100644 --- a/include/clang/AST/FullExpr.h +++ b/include/clang/AST/FullExpr.h @@ -47,7 +47,6 @@ class FullExpr { public: static FullExpr Create(ASTContext &Context, Expr *SubExpr, CXXTemporary **Temps, unsigned NumTemps); - void Destroy(ASTContext &Context); Expr *getExpr() { if (Expr *E = SubExpr.dyn_cast<Expr *>()) diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h index a0c95b1fce..ec3dac4bc3 100644 --- a/include/clang/AST/Stmt.h +++ b/include/clang/AST/Stmt.h @@ -151,22 +151,11 @@ public: struct EmptyShell { }; protected: - /// DestroyChildren - Invoked by destructors of subclasses of Stmt to - /// recursively release child AST nodes. - void DestroyChildren(ASTContext& Ctx); - /// \brief Construct an empty statement. explicit Stmt(StmtClass SC, EmptyShell) : sClass(SC), RefCount(1) { if (Stmt::CollectingStats()) Stmt::addStmtClass(SC); } - /// \brief Virtual method that performs the actual destruction of - /// this statement. - /// - /// Subclasses should override this method (not Destroy()) to - /// provide class-specific destruction. - virtual void DoDestroy(ASTContext &Ctx); - public: Stmt(StmtClass SC) : sClass(SC), RefCount(1) { if (Stmt::CollectingStats()) Stmt::addStmtClass(SC); @@ -181,13 +170,6 @@ public: } #endif - /// \brief Destroy the current statement and its children. - void Destroy(ASTContext &Ctx) { - assert(RefCount >= 1); - if (--RefCount == 0) - DoDestroy(Ctx); - } - /// \brief Increases the reference count for this statement. /// /// Invoke the Retain() operation when this statement or expression @@ -295,9 +277,6 @@ class DeclStmt : public Stmt { DeclGroupRef DG; SourceLocation StartLoc, EndLoc; -protected: - virtual void DoDestroy(ASTContext &Ctx); - public: DeclStmt(DeclGroupRef dg, SourceLocation startLoc, SourceLocation endLoc) : Stmt(DeclStmtClass), DG(dg), @@ -671,9 +650,6 @@ public: // over the initialization expression referenced by the condition variable. virtual child_iterator child_begin(); virtual child_iterator child_end(); - -protected: - virtual void DoDestroy(ASTContext &Ctx); }; /// SwitchStmt - This represents a 'switch' stmt. @@ -685,9 +661,6 @@ class SwitchStmt : public Stmt { SwitchCase *FirstCase; SourceLocation SwitchLoc; -protected: - virtual void DoDestroy(ASTContext &Ctx); - public: SwitchStmt(ASTContext &C, VarDecl *Var, Expr *cond); @@ -794,9 +767,6 @@ public: // Iterators virtual child_iterator child_begin(); virtual child_iterator child_end(); - -protected: - virtual void DoDestroy(ASTContext &Ctx); }; /// DoStmt - This represents a 'do/while' stmt. @@ -910,9 +880,6 @@ public: // Iterators virtual child_iterator child_begin(); virtual child_iterator child_end(); - -protected: - virtual void DoDestroy(ASTContext &Ctx); }; /// GotoStmt - This represents a direct goto. @@ -1113,9 +1080,6 @@ class AsmStmt : public Stmt { StringLiteral **Constraints; Stmt **Exprs; StringLiteral **Clobbers; - -protected: - virtual void DoDestroy(ASTContext &Ctx); public: AsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple, bool isvolatile, diff --git a/include/clang/AST/StmtCXX.h b/include/clang/AST/StmtCXX.h index 58d45e801e..6dbf18d43c 100644 --- a/include/clang/AST/StmtCXX.h +++ b/include/clang/AST/StmtCXX.h @@ -29,9 +29,6 @@ class CXXCatchStmt : public Stmt { /// The handler block. Stmt *HandlerBlock; -protected: - virtual void DoDestroy(ASTContext& Ctx); - public: CXXCatchStmt(SourceLocation catchLoc, VarDecl *exDecl, Stmt *handlerBlock) : Stmt(CXXCatchStmtClass), CatchLoc(catchLoc), ExceptionDecl(exDecl), diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index e8721058a7..203d13b09f 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -808,7 +808,6 @@ protected: TC(tc), Dependent(dependent), LinkageKnown(false), CachedLinkage(NoLinkage), FromPCH(false) {} virtual ~Type() {} - virtual void Destroy(ASTContext& C); friend class ASTContext; public: @@ -1545,7 +1544,6 @@ class VariableArrayType : public ArrayType { : ArrayType(VariableArray, et, can, sm, tq), SizeExpr((Stmt*) e), Brackets(brackets) {} friend class ASTContext; // ASTContext creates these. - virtual void Destroy(ASTContext& C); public: Expr *getSizeExpr() const { @@ -1604,7 +1602,6 @@ class DependentSizedArrayType : public ArrayType { : ArrayType(DependentSizedArray, et, can, sm, tq), Context(Context), SizeExpr((Stmt*) e), Brackets(brackets) {} friend class ASTContext; // ASTContext creates these. - virtual void Destroy(ASTContext& C); public: Expr *getSizeExpr() const { @@ -1658,7 +1655,6 @@ class DependentSizedExtVectorType : public Type, public llvm::FoldingSetNode { Context(Context), SizeExpr(SizeExpr), ElementType(ElementType), loc(loc) {} friend class ASTContext; - virtual void Destroy(ASTContext& C); public: Expr *getSizeExpr() const { return SizeExpr; } @@ -2480,8 +2476,6 @@ class TemplateSpecializationType const TemplateArgument *Args, unsigned NumArgs, QualType Canon); - virtual void Destroy(ASTContext& C); - friend class ASTContext; // ASTContext creates these public: @@ -2848,8 +2842,6 @@ class DependentTemplateSpecializationType : const TemplateArgument *Args, QualType Canon); - virtual void Destroy(ASTContext& C); - friend class ASTContext; // ASTContext creates these public: @@ -3026,8 +3018,6 @@ class ObjCObjectTypeImpl : public ObjCObjectType, public llvm::FoldingSetNode { : ObjCObjectType(Canonical, Base, Protocols, NumProtocols) {} public: - void Destroy(ASTContext& C); // key function - void Profile(llvm::FoldingSetNodeID &ID); static void Profile(llvm::FoldingSetNodeID &ID, QualType Base, @@ -3061,8 +3051,6 @@ class ObjCInterfaceType : public ObjCObjectType { Decl(const_cast<ObjCInterfaceDecl*>(D)) {} friend class ASTContext; // ASTContext creates these. public: - void Destroy(ASTContext& C); // key function - /// getDecl - Get the declaration of this interface. ObjCInterfaceDecl *getDecl() const { return Decl; } @@ -3115,8 +3103,6 @@ protected: virtual Linkage getLinkageImpl() const; public: - void Destroy(ASTContext& C); - /// getPointeeType - Gets the type pointed to by this ObjC pointer. /// The result will always be an ObjCObjectType or sugar thereof. QualType getPointeeType() const { return PointeeType; } diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index e695310c37..e92f530d45 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -532,11 +532,6 @@ static SourceLocation getTemplateOrInnerLocStart(const DeclT *decl) { } DeclaratorDecl::~DeclaratorDecl() {} -void DeclaratorDecl::Destroy(ASTContext &C) { - if (hasExtInfo()) - C.Deallocate(getExtInfo()); - ValueDecl::Destroy(C); -} SourceLocation DeclaratorDecl::getTypeSpecStartLoc() const { TypeSourceInfo *TSI = getTypeSourceInfo(); @@ -602,12 +597,6 @@ QualifierInfo::setTemplateParameterListsInfo(ASTContext &Context, } } -void QualifierInfo::Destroy(ASTContext &Context) { - // FIXME: Deallocate template parameter lists themselves! - if (TemplParamLists) - Context.Deallocate(TemplParamLists); -} - //===----------------------------------------------------------------------===// // VarDecl Implementation //===----------------------------------------------------------------------===// @@ -632,19 +621,6 @@ VarDecl *VarDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, return new (C) VarDecl(Var, DC, L, Id, T, TInfo, S, SCAsWritten); } -void VarDecl::Destroy(ASTContext& C) { - Expr *Init = getInit(); - if (Init) { - Init->Destroy(C); - if (EvaluatedStmt *Eval = this->Init.dyn_cast<EvaluatedStmt *>()) { - Eval->~EvaluatedStmt(); - C.Deallocate(Eval); - } - } - this->~VarDecl(); - DeclaratorDecl::Destroy(C); -} - VarDecl::~VarDecl() { } @@ -912,28 +888,6 @@ SourceRange ParmVarDecl::getDefaultArgRange() const { // FunctionDecl Implementation //===----------------------------------------------------------------------===// -void FunctionDecl::Destroy(ASTContext& C) { - if (Body && Body.isOffset()) - Body.get(C.getExternalSource())->Destroy(C); - - for (param_iterator I=param_begin(), E=param_end(); I!=E; ++I) - (*I)->Destroy(C); - - FunctionTemplateSpecializationInfo *FTSInfo - = TemplateOrSpecialization.dyn_cast<FunctionTemplateSpecializationInfo*>(); - if (FTSInfo) - C.Deallocate(FTSInfo); - - MemberSpecializationInfo *MSInfo - = TemplateOrSpecialization.dyn_cast<MemberSpecializationInfo*>(); - if (MSInfo) - C.Deallocate(MSInfo); - - C.Deallocate(ParamInfo); - - DeclaratorDecl::Destroy(C); -} - void FunctionDecl::getNameForDiagnostic(std::string &S, const PrintingPolicy &Policy, bool Qualified) const { @@ -1565,12 +1519,6 @@ bool FieldDecl::isAnonymousStructOrUnion() const { // TagDecl Implementation //===----------------------------------------------------------------------===// -void TagDecl::Destroy(ASTContext &C) { - if (hasExtInfo()) - C.Deallocate(getExtInfo()); - TypeDecl::Destroy(C); -} - SourceLocation TagDecl::getOuterLocStart() const { return getTemplateOrInnerLocStart(this); } @@ -1676,10 +1624,6 @@ EnumDecl *EnumDecl::Create(ASTContext &C, EmptyShell Empty) { return new (C) EnumDecl(0, SourceLocation(), 0, 0, SourceLocation()); } -void EnumDecl::Destroy(ASTContext& C) { - TagDecl::Destroy(C); -} - void EnumDecl::completeDefinition(QualType NewType, QualType NewPromotionType, unsigned NumPositiveBits, @@ -1723,10 +1667,6 @@ RecordDecl *RecordDecl::Create(ASTContext &C, EmptyShell Empty) { RecordDecl::~RecordDecl() { } -void RecordDecl::Destroy(ASTContext& C) { - TagDecl::Destroy(C); -} - bool RecordDecl::isInjectedClassName() const { return isImplicit() && getDeclName() && getDeclContext()->isRecord() && cast<RecordDecl>(getDeclContext())->getDeclName() == getDeclName(); @@ -1757,17 +1697,6 @@ ValueDecl *RecordDecl::getAnonymousStructOrUnionObject() { BlockDecl::~BlockDecl() { } -void BlockDecl::Destroy(ASTContext& C) { - if (Body) - Body->Destroy(C); - - for (param_iterator I=param_begin(), E=param_end(); I!=E; ++I) - (*I)->Destroy(C); - - C.Deallocate(ParamInfo); - Decl::Destroy(C); -} - void BlockDecl::setParams(ParmVarDecl **NewParamInfo, |