summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@apple.com>2019-03-01 06:43:20 +0000
committerAkira Hatanaka <ahatanaka@apple.com>2019-03-01 06:43:20 +0000
commit78be8b6d53221eef49603ed64dd0670ff5a65727 (patch)
treeb54be737a801b009ee6cf91e2cceb6d14518c779 /clang/lib/Sema
parentf4b25f700a4c555711a746befe7ca3a6e93e621d (diff)
downloadbcm5719-llvm-78be8b6d53221eef49603ed64dd0670ff5a65727.tar.gz
bcm5719-llvm-78be8b6d53221eef49603ed64dd0670ff5a65727.zip
[Sema][ObjC] Allow silencing -Wobjc-designated-initializers warnings by
declaring an unavailable method in the subclass's extension that overrides the designated initializer in the base class. r243676 made changes to allow declaring the unavailable method in the subclass interface to silence the warning. This commit additionally allows declaring the unavailable method in the class extension. rdar://problem/42731306 llvm-svn: 355175
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaObjCProperty.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp
index 82e8def14ac..cea362fb425 100644
--- a/clang/lib/Sema/SemaObjCProperty.cpp
+++ b/clang/lib/Sema/SemaObjCProperty.cpp
@@ -2280,9 +2280,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(),
OpenPOWER on IntegriCloud