mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-02 14:56:08 +00:00
Fix crasher due to use-after-release: DeclContext now owns all ObjCMethodDecls, and shouldn't be released elsewhere.
llvm-svn: 62113
This commit is contained in:
parent
c6f58fe266
commit
6ae6513ce2
@ -602,10 +602,6 @@ class ObjCProtocolDecl : public ObjCContainerDecl {
|
||||
virtual ~ObjCProtocolDecl();
|
||||
|
||||
public:
|
||||
|
||||
/// Destroy - Call destructors and release memory.
|
||||
virtual void Destroy(ASTContext& C);
|
||||
|
||||
static ObjCProtocolDecl *Create(ASTContext &C, DeclContext *DC,
|
||||
SourceLocation L, IdentifierInfo *Id);
|
||||
|
||||
|
@ -73,13 +73,9 @@ void ObjCInterfaceDecl::Destroy(ASTContext& C) {
|
||||
for (ivar_iterator I=ivar_begin(), E=ivar_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
|
||||
// reference, we destroy ObjCPropertyDecls in ~TranslationUnit.
|
||||
|
||||
Decl::Destroy(C);
|
||||
}
|
||||
|
||||
@ -115,20 +111,6 @@ ObjCProtocolDecl::~ObjCProtocolDecl() {
|
||||
delete [] PropertyDecl;
|
||||
}
|
||||
|
||||
void ObjCProtocolDecl::Destroy(ASTContext& C) {
|
||||
|
||||
// Referenced Protocols are not owned, so don't Destroy them.
|
||||
|
||||
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
|
||||
// reference, we destroy ObjCPropertyDecls in ~TranslationUnit.
|
||||
|
||||
Decl::Destroy(C);
|
||||
}
|
||||
|
||||
|
||||
ObjCClassDecl *ObjCClassDecl::Create(ASTContext &C, DeclContext *DC,
|
||||
SourceLocation L,
|
||||
|
Loading…
x
Reference in New Issue
Block a user