move some objc decl destruction out of dtors into Destroy method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65111 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index 506d3e4..95ba2e0 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -35,17 +35,16 @@
isVariadic, isSynthesized, impControl);
}
-ObjCMethodDecl::~ObjCMethodDecl() {
- delete [] ParamInfo;
-}
-
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);
-
+
+ delete [] ParamInfo;
+ ParamInfo = 0;
+
Decl::Destroy(C);
}
@@ -102,11 +101,15 @@
return new (C) ObjCProtocolDecl(DC, L, Id);
}
-ObjCProtocolDecl::~ObjCProtocolDecl() {
+void ObjCProtocolDecl::Destroy(ASTContext &C) {
delete [] PropertyDecl;
+ PropertyDecl = 0;
+ ObjCContainerDecl::Destroy(C);
}
+
+
ObjCClassDecl *ObjCClassDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation L,
ObjCInterfaceDecl **Elts, unsigned nElts) {