forked from OSchip/llvm-project
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. llvm-svn: 52051
This commit is contained in:
parent
09a0d04ea0
commit
5144fe2287
|
@ -79,13 +79,11 @@ void ObjCInterfaceDecl::Destroy(ASTContext& C) {
|
||||||
|
|
||||||
for (classmeth_iterator I=classmeth_begin(), E=classmeth_end(); I!=E; ++I)
|
for (classmeth_iterator I=classmeth_begin(), E=classmeth_end(); I!=E; ++I)
|
||||||
if (*I) (*I)->Destroy(C);
|
if (*I) (*I)->Destroy(C);
|
||||||
|
|
||||||
// FIXME: Cannot destroy properties right now because the properties of
|
// FIXME: Because there is no clear ownership
|
||||||
// both the super class and this class are in this array. This can
|
// role between ObjCInterfaceDecls and the ObjCPropertyDecls that they
|
||||||
// cause double-deletions.
|
// reference, we destroy ObjCPropertyDecls in ~TranslationUnit.
|
||||||
//for (classprop_iterator I=classprop_begin(), E=classprop_end(); I!=E; ++I)
|
|
||||||
// if (*I) (*I)->Destroy(C);
|
|
||||||
//
|
|
||||||
Decl::Destroy(C);
|
Decl::Destroy(C);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,20 @@ TranslationUnit::~TranslationUnit() {
|
||||||
if (Killed.count(*I)) continue;
|
if (Killed.count(*I)) continue;
|
||||||
|
|
||||||
Killed.insert(*I);
|
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);
|
(*I)->Destroy(*Context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue