diff options
Diffstat (limited to 'lib/Sema/SemaObjCProperty.cpp')
-rw-r--r-- | lib/Sema/SemaObjCProperty.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index 9412d01600..2521441f8b 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -1,9 +1,8 @@ //===--- SemaObjCProperty.cpp - Semantic Analysis for ObjC @property ------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -1943,11 +1942,10 @@ static void DiagnoseUnimplementedAccessor( llvm::SmallPtrSet<const ObjCMethodDecl *, 8> &SMap) { // Check to see if we have a corresponding selector in SMap and with the // right method type. - auto I = std::find_if(SMap.begin(), SMap.end(), - [&](const ObjCMethodDecl *x) { - return x->getSelector() == Method && - x->isClassMethod() == Prop->isClassProperty(); - }); + auto I = llvm::find_if(SMap, [&](const ObjCMethodDecl *x) { + return x->getSelector() == Method && + x->isClassMethod() == Prop->isClassProperty(); + }); // When reporting on missing property setter/getter implementation in // categories, do not report when they are declared in primary class, // class's protocol, or one of it super classes. This is because, @@ -2281,9 +2279,18 @@ void Sema::DiagnoseMissingDesignatedInitOverrides( I = DesignatedInits.begin(), E = DesignatedInits.end(); I != E; ++I) { const ObjCMethodDecl *MD = *I; if (!InitSelSet.count(MD->getSelector())) { + // Don't emit a diagnostic if the overriding method in the subclass is + // marked as unavailable. bool Ignore = false; if (auto *IMD = IFD->getInstanceMethod(MD->getSelector())) { Ignore = IMD->isUnavailable(); + } else { + // Check the methods declared in the class extensions too. + for (auto *Ext : IFD->visible_extensions()) + if (auto *IMD = Ext->getInstanceMethod(MD->getSelector())) { + Ignore = IMD->isUnavailable(); + break; + } } if (!Ignore) { Diag(ImplD->getLocation(), |