[cfe-commits] r52051 - in /cfe/trunk/lib/AST: DeclObjC.cpp TranslationUnit.cpp
Ted Kremenek
kremenek at apple.com
Fri Jun 6 10:21:43 PDT 2008
Author: kremenek
Date: Fri Jun 6 12:21:42 2008
New Revision: 52051
URL: http://llvm.org/viewvc/llvm-project?rev=52051&view=rev
Log:
Because of a lack of a clear ownership role between ObjCInterfaceDecls and
ObjCPropertyDecls, have TranslationUnit destroy ObjCPropertyDecls. This is a
horrible hack, and must be removed eventually.
Modified:
cfe/trunk/lib/AST/DeclObjC.cpp
cfe/trunk/lib/AST/TranslationUnit.cpp
Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=52051&r1=52050&r2=52051&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Fri Jun 6 12:21:42 2008
@@ -79,13 +79,11 @@
for (classmeth_iterator I=classmeth_begin(), E=classmeth_end(); I!=E; ++I)
if (*I) (*I)->Destroy(C);
-
- // FIXME: Cannot destroy properties right now because the properties of
- // both the super class and this class are in this array. This can
- // cause double-deletions.
- //for (classprop_iterator I=classprop_begin(), E=classprop_end(); I!=E; ++I)
-// if (*I) (*I)->Destroy(C);
-//
+
+ // FIXME: Because there is no clear ownership
+ // role between ObjCInterfaceDecls and the ObjCPropertyDecls that they
+ // reference, we destroy ObjCPropertyDecls in ~TranslationUnit.
+
Decl::Destroy(C);
}
Modified: cfe/trunk/lib/AST/TranslationUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TranslationUnit.cpp?rev=52051&r1=52050&r2=52051&view=diff
==============================================================================
--- cfe/trunk/lib/AST/TranslationUnit.cpp (original)
+++ cfe/trunk/lib/AST/TranslationUnit.cpp Fri Jun 6 12:21:42 2008
@@ -37,6 +37,20 @@
if (Killed.count(*I)) continue;
Killed.insert(*I);
+
+ // FIXME: This is a horrible hack. Because there is no clear ownership
+ // role between ObjCInterfaceDecls and the ObjCPropertyDecls that they
+ // reference, we need to destroy ObjCPropertyDecls here. This will
+ // eventually be fixed when the ownership of ObjCPropertyDecls gets
+ // cleaned up.
+ if (ObjCInterfaceDecl* IDecl = dyn_cast<ObjCInterfaceDecl>(*I))
+ for (ObjCInterfaceDecl::classprop_iterator ID=IDecl->classprop_begin(),
+ ED=IDecl->classprop_end(); ID!=ED; ++ID) {
+ if (Killed.count(*ID)) continue;
+ Killed.insert(*ID);
+ (*ID)->Destroy(*Context);
+ }
+
(*I)->Destroy(*Context);
}
}
More information about the cfe-commits
mailing list