diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2012-09-07 23:46:23 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2012-09-07 23:46:23 +0000 |
commit | 841011373b345cf79d0da4b7242dcf2869a43502 (patch) | |
tree | 3fbcdca9e5e0bbcef3e0300c8bafadc5803b1aa2 /lib/Sema/SemaExprObjC.cpp | |
parent | f9fdcc0531ca53651c1d7d0877290e232cb5468d (diff) |
objective-C: introduce __attribute((objc_requires_super)) on method
in classes. Use it to flag those method implementations which don't
contain call to 'super' if they have 'super' class and it has the method
with this attribute set. This is wip. // rdar://6386358
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163434 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprObjC.cpp')
-rw-r--r-- | lib/Sema/SemaExprObjC.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index 17850bb2d7..58e28a9404 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -1780,6 +1780,14 @@ ExprResult Sema::ActOnSuperMessage(Scope *S, 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; |