diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-07-09 22:02:20 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-07-09 22:02:20 +0000 |
commit | db4fc281457dd9a06757f7f97360dabcf4ae1123 (patch) | |
tree | 02de9ef8372e8fdbec4879d5f3c5e5602d44e727 /clang/lib | |
parent | a80fed7e581517d69f46815644585bdcedcdf726 (diff) | |
download | bcm5719-llvm-db4fc281457dd9a06757f7f97360dabcf4ae1123.tar.gz bcm5719-llvm-db4fc281457dd9a06757f7f97360dabcf4ae1123.zip |
Objective-C: merge objc_requires_super attribute of
method declaration into its implementation to
prevent a bogus warning about mismatched attributes.
then make sure the warning about missing call to super comes out
of the method implementation. // rdar://14251387
llvm-svn: 185974
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(); |