diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 87dfe103630..bbdf853fc8a 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -406,7 +406,9 @@ void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) { if (Context.getLangOpts().getGC() != LangOptions::NonGC) getCurFunction()->ObjCShouldCallSuper = true; - } else { + } else if (MDecl->hasAttr<ObjCRequiresSuperAttr>()) + getCurFunction()->ObjCShouldCallSuper = true; + else { const ObjCMethodDecl *SuperMethod = SuperClass->lookupMethod(MDecl->getSelector(), MDecl->isInstanceMethod()); @@ -3200,6 +3202,12 @@ Decl *Sema::ActOnMethodDeclaration( if (ObjCInterfaceDecl *IDecl = ImpDecl->getClassInterface()) IMD = IDecl->lookupMethod(ObjCMethod->getSelector(), ObjCMethod->isInstanceMethod()); + if (IMD && IMD->hasAttr<ObjCRequiresSuperAttr>() && + !ObjCMethod->hasAttr<ObjCRequiresSuperAttr>()) { + // merge the attribute into implementation. + ObjCMethod->addAttr( + new (Context) ObjCRequiresSuperAttr(ObjCMethod->getLocation(), Context)); + } if (ObjCMethod->hasAttrs() && containsInvalidMethodImplAttribute(IMD, ObjCMethod->getAttrs())) { SourceLocation MethodLoc = IMD->getLocation(); |