]> granicus.if.org Git - clang/commitdiff
Fix ObjCInterfaceDecl::Destroy and ObjCProtocolDecl::Destroy to iterate and destroy...
authorTed Kremenek <kremenek@apple.com>
Thu, 8 Jan 2009 20:49:27 +0000 (20:49 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 8 Jan 2009 20:49:27 +0000 (20:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61943 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/DeclObjC.cpp

index 2263af7d906f952bbac5ed470a225854680f802e..b7c0cf79b94ceade9c80484a2d9c3059efaa9759 100644 (file)
@@ -73,11 +73,8 @@ void ObjCInterfaceDecl::Destroy(ASTContext& C) {
   for (ivar_iterator I=ivar_begin(), E=ivar_end(); I!=E; ++I)
     if (*I) (*I)->Destroy(C);
   
-  for (instmeth_iterator I=instmeth_begin(), E=instmeth_end(); I!=E; ++I)
-    if (*I) (*I)->Destroy(C);
-  
-  for (classmeth_iterator I=classmeth_begin(), E=classmeth_end(); I!=E; ++I)
-    if (*I) (*I)->Destroy(C);
+  for (method_iterator I=meth_begin(), E=meth_end(); I!=E; ++I)
+    if (*I) const_cast<ObjCMethodDecl*>((*I))->Destroy(C);
 
   // FIXME: Because there is no clear ownership
   //  role between ObjCInterfaceDecls and the ObjCPropertyDecls that they
@@ -122,11 +119,8 @@ void ObjCProtocolDecl::Destroy(ASTContext& C) {
   
   // Referenced Protocols are not owned, so don't Destroy them.
   
-  for (instmeth_iterator I=instmeth_begin(), E=instmeth_end(); I!=E; ++I)
-    if (*I) (*I)->Destroy(C);
-  
-  for (classmeth_iterator I=classmeth_begin(), E=classmeth_end(); I!=E; ++I)
-    if (*I) (*I)->Destroy(C);
+  for (method_iterator I=meth_begin(), E=meth_end(); I!=E; ++I)
+    if (*I) const_cast<ObjCMethodDecl*>((*I))->Destroy(C);
   
   // FIXME: Because there is no clear ownership
   //  role between ObjCProtocolDecls and the ObjCPropertyDecls that they