diff options
author | John McCall <rjmccall@apple.com> | 2011-07-13 18:26:47 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-07-13 18:26:47 +0000 |
commit | 799d34e9505a833549c71f2ac5f842da157ea031 (patch) | |
tree | 8b13154849d261d746ca7e8c923ec870df6dd680 /lib/CodeGen/CGObjC.cpp | |
parent | 48218c60d6b53b7880917d1366ee716dec2145ca (diff) |
Don't crash if defining -dealloc in a category.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135054 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjC.cpp')
-rw-r--r-- | lib/CodeGen/CGObjC.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp index f64ff9766f..426cca0014 100644 --- a/lib/CodeGen/CGObjC.cpp +++ b/lib/CodeGen/CGObjC.cpp @@ -220,11 +220,13 @@ namespace { struct FinishARCDealloc : EHScopeStack::Cleanup { void Emit(CodeGenFunction &CGF, Flags flags) { const ObjCMethodDecl *method = cast<ObjCMethodDecl>(CGF.CurCodeDecl); - const ObjCImplementationDecl *impl - = cast<ObjCImplementationDecl>(method->getDeclContext()); + + const ObjCImplDecl *impl = cast<ObjCImplDecl>(method->getDeclContext()); const ObjCInterfaceDecl *iface = impl->getClassInterface(); if (!iface->getSuperClass()) return; + bool isCategory = isa<ObjCCategoryImplDecl>(impl); + // Call [super dealloc] if we have a superclass. llvm::Value *self = CGF.LoadObjCSelf(); @@ -233,7 +235,7 @@ struct FinishARCDealloc : EHScopeStack::Cleanup { CGF.getContext().VoidTy, method->getSelector(), iface, - /*is category*/ false, + isCategory, self, /*is class msg*/ false, args, |