diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-01-12 22:49:54 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-01-12 22:49:54 +0000 |
commit | 6ae6513ce20fe32ff86ace27b657cf793835c64f (patch) | |
tree | a444cbbe141a0183c2c4babf9b467b263c4ac431 /clang/lib/AST/DeclObjC.cpp | |
parent | c6f58fe266948394b952ae6336412eb20443d6dd (diff) | |
download | bcm5719-llvm-6ae6513ce20fe32ff86ace27b657cf793835c64f.tar.gz bcm5719-llvm-6ae6513ce20fe32ff86ace27b657cf793835c64f.zip |
Fix crasher due to use-after-release: DeclContext now owns all ObjCMethodDecls, and shouldn't be released elsewhere.
llvm-svn: 62113
Diffstat (limited to 'clang/lib/AST/DeclObjC.cpp')
-rw-r--r-- | clang/lib/AST/DeclObjC.cpp | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index 9fc0f763bbd..ea7a047780c 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/lib/AST/DeclObjC.cpp @@ -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, |