diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-07-25 18:17:45 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-07-25 18:17:45 +0000 |
commit | ff331c15729f7d4439d253c97f4d60f2a7ffd0c6 (patch) | |
tree | b0ab8d1988b70c1e7717a67a83992b4f4e8319c7 /lib/AST/DeclObjC.cpp | |
parent | 63fe86bee66fc145942c56b2cc564ea0b9b9ea12 (diff) |
Remove the vast majority of the Destroy methods from the AST library,
since we aren't going to be calling them ever.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109377 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclObjC.cpp')
-rw-r--r-- | lib/AST/DeclObjC.cpp | 71 |
1 files changed, 1 insertions, 70 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp index c682cf18bf..32f9433d9a 100644 --- a/lib/AST/DeclObjC.cpp +++ b/lib/AST/DeclObjC.cpp @@ -21,14 +21,8 @@ using namespace clang; // ObjCListBase //===----------------------------------------------------------------------===// -void ObjCListBase::Destroy(ASTContext &Ctx) { - Ctx.Deallocate(List); - NumElts = 0; - List = 0; -} - void ObjCListBase::set(void *const* InList, unsigned Elts, ASTContext &Ctx) { - assert(List == 0 && "Elements already set!"); + List = 0; if (Elts == 0) return; // Setting to an empty list is a noop. @@ -47,12 +41,6 @@ void ObjCProtocolList::set(ObjCProtocolDecl* const* InList, unsigned Elts, set(InList, Elts, Ctx); } -void ObjCProtocolList::Destroy(ASTContext &Ctx) { - Ctx.Deallocate(Locations); - Locations = 0; - ObjCList<ObjCProtocolDecl>::Destroy(Ctx); -} - //===----------------------------------------------------------------------===// // ObjCInterfaceDecl //===----------------------------------------------------------------------===// @@ -218,7 +206,6 @@ void ObjCInterfaceDecl::mergeClassExtensionProtocolList( ProtocolRefs.push_back(*p); ProtocolLocs.push_back(*pl); } - ReferencedProtocols.Destroy(C); unsigned NumProtoRefs = ProtocolRefs.size(); setProtocolList(ProtocolRefs.data(), NumProtoRefs, ProtocolLocs.data(), C); } @@ -350,18 +337,6 @@ ObjCMethodDecl *ObjCMethodDecl::Create(ASTContext &C, numSelectorArgs); } -void ObjCMethodDecl::Destroy(ASTContext &C) { - if (Body) Body->Destroy(C); - if (SelfDecl) SelfDecl->Destroy(C); - - for (param_iterator I=param_begin(), E=param_end(); I!=E; ++I) - if (*I) (*I)->Destroy(C); - - ParamInfo.Destroy(C); - - Decl::Destroy(C); -} - /// \brief A definition will return its interface declaration. /// An interface declaration will return its definition. /// Otherwise it will return itself. @@ -471,18 +446,6 @@ ObjCInterfaceDecl(DeclContext *DC, SourceLocation atLoc, IdentifierInfo *Id, ClassLoc(CLoc) { } -void ObjCInterfaceDecl::Destroy(ASTContext &C) { - for (ivar_iterator I = ivar_begin(), E = ivar_end(); I != E; ++I) - if (*I) (*I)->Destroy(C); - - // FIXME: CategoryList? - - // FIXME: Because there is no clear ownership - // role between ObjCInterfaceDecls and the ObjCPropertyDecls that they - // reference, we destroy ObjCPropertyDecls in ~TranslationUnit. - Decl::Destroy(C); -} - ObjCImplementationDecl *ObjCInterfaceDecl::getImplementation() const { return getASTContext().getObjCImplementation( const_cast<ObjCInterfaceDecl*>(this)); @@ -633,11 +596,6 @@ ObjCAtDefsFieldDecl return new (C) ObjCAtDefsFieldDecl(DC, L, Id, T, BW); } -void ObjCAtDefsFieldDecl::Destroy(ASTContext& C) { - this->~ObjCAtDefsFieldDecl(); - C.Deallocate((void *)this); -} - //===----------------------------------------------------------------------===// // ObjCProtocolDecl //===----------------------------------------------------------------------===// @@ -648,11 +606,6 @@ ObjCProtocolDecl *ObjCProtocolDecl::Create(ASTContext &C, DeclContext *DC, return new (C) ObjCProtocolDecl(DC, L, Id); } -void ObjCProtocolDecl::Destroy(ASTContext &C) { - ReferencedProtocols.Destroy(C); - ObjCContainerDecl::Destroy(C); -} - ObjCProtocolDecl *ObjCProtocolDecl::lookupProtocolNamed(IdentifierInfo *Name) { ObjCProtocolDecl *PDecl = this; @@ -712,23 +665,6 @@ ObjCClassDecl *ObjCClassDecl::Create(ASTContext &C, DeclContext *DC, return new (C) ObjCClassDecl(DC, L, Elts, Locs, nElts, C); } -void ObjCClassDecl::Destroy(ASTContext &C) { - // ObjCInterfaceDecls registered with a DeclContext will get destroyed - // when the DeclContext is destroyed. For those created only by a forward - // declaration, the first @class that created the ObjCInterfaceDecl gets - // to destroy it. - // FIXME: Note that this ownership role is very brittle; a better - // polict is surely need in the future. - for (iterator I = begin(), E = end(); I !=E ; ++I) { - ObjCInterfaceDecl *ID = I->getInterface(); - if (ID->isForwardDecl() && ID->getLocStart() == getLocStart()) - ID->Destroy(C); - } - - C.Deallocate(ForwardDecls); - Decl::Destroy(C); -} - SourceRange ObjCClassDecl::getSourceRange() const { // FIXME: We should include the semicolon assert(NumDecls); @@ -757,11 +693,6 @@ ObjCForwardProtocolDecl::Create(ASTContext &C, DeclContext *DC, return new (C) ObjCForwardProtocolDecl(DC, L, Elts, NumElts, Locs, C); } -void ObjCForwardProtocolDecl::Destroy(ASTContext &C) { - ReferencedProtocols.Destroy(C); - Decl::Destroy(C); -} - //===----------------------------------------------------------------------===// // ObjCCategoryDecl //===----------------------------------------------------------------------===// |