diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-10-19 16:05:26 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-10-19 16:05:26 +0000 |
commit | 535a5d001b2035a7aa68ee368fbe44ec90e33740 (patch) | |
tree | aa05cd59a0b4fe30d1e672ec9cca4af97c63febf /lib/Sema/SemaExprObjC.cpp | |
parent | 266dba3661928d26f043560b169bea87578aa917 (diff) |
Allow objc_requires_super to be used to check class methods as well.
Also, unify ObjCShouldCallSuperDealloc and ObjCShouldCallSuperFinalize.
The two have identical behavior and will never be active at the same time.
There's one last simplification now, which is that if we see a call to
[super foo] and we are currently in a method named 'foo', we will
/unconditionally/ clear the ObjCShouldCallSuper flag, rather than check
first to see if we're in a method where calling super is required. There's
no reason to pay the extra lookup price here.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166285 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprObjC.cpp')
-rw-r--r-- | lib/Sema/SemaExprObjC.cpp | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index 3f9c14c685..e43b6bff55 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -1772,20 +1772,10 @@ ExprResult Sema::ActOnSuperMessage(Scope *S, // We are in a method whose class has a superclass, so 'super' // is acting as a keyword. - if (Method->isInstanceMethod()) { - if (Sel.getMethodFamily() == OMF_dealloc) - getCurFunction()->ObjCShouldCallSuperDealloc = false; - else if (const ObjCMethodDecl *IMD = - Class->lookupMethod(Method->getSelector(), - Method->isInstanceMethod())) - // Must check for name of message since the method could - // be another method with objc_requires_super attribute set. - if (IMD->hasAttr<ObjCRequiresSuperAttr>() && - Sel == IMD->getSelector()) - getCurFunction()->ObjCShouldCallSuperDealloc = false; - if (Sel.getMethodFamily() == OMF_finalize) - getCurFunction()->ObjCShouldCallSuperFinalize = false; + if (Method->getSelector() == Sel) + getCurFunction()->ObjCShouldCallSuper = false; + if (Method->isInstanceMethod()) { // Since we are in an instance method, this is an instance // message to the superclass instance. QualType SuperTy = Context.getObjCInterfaceType(Super); |