Index: clang/lib/Sema/SemaDeclObjC.cpp =================================================================== --- clang/lib/Sema/SemaDeclObjC.cpp +++ clang/lib/Sema/SemaDeclObjC.cpp @@ -1270,16 +1270,16 @@ return ActOnObjCContainerStartDefinition(PDecl); } -static bool NestedProtocolHasNoDefinition(ObjCProtocolDecl *PDecl, - ObjCProtocolDecl *&UndefinedProtocol) { - if (!PDecl->hasDefinition() || - !PDecl->getDefinition()->isUnconditionallyVisible()) { +static bool +NestedProtocolHasNoDefinition(Sema &SemaRef, ObjCProtocolDecl *PDecl, + ObjCProtocolDecl *&UndefinedProtocol) { + if (!PDecl->hasDefinition() || !SemaRef.isVisible(PDecl->getDefinition())) { UndefinedProtocol = PDecl; return true; } for (auto *PI : PDecl->protocols()) - if (NestedProtocolHasNoDefinition(PI, UndefinedProtocol)) { + if (NestedProtocolHasNoDefinition(SemaRef, PI, UndefinedProtocol)) { UndefinedProtocol = PI; return true; } @@ -1325,7 +1325,7 @@ ObjCProtocolDecl *UndefinedProtocol; if (WarnOnDeclarations && - NestedProtocolHasNoDefinition(PDecl, UndefinedProtocol)) { + NestedProtocolHasNoDefinition(*this, PDecl, UndefinedProtocol)) { Diag(Pair.second, diag::warn_undef_protocolref) << Pair.first; Diag(UndefinedProtocol->getLocation(), diag::note_protocol_decl_undefined) << UndefinedProtocol; @@ -1461,7 +1461,7 @@ // FIXME: Recover nicely in the hidden case. ObjCProtocolDecl *forwardDecl = nullptr; if (warnOnIncompleteProtocols && - NestedProtocolHasNoDefinition(proto, forwardDecl)) { + NestedProtocolHasNoDefinition(*this, proto, forwardDecl)) { Diag(identifierLocs[i], diag::warn_undef_protocolref) << proto->getDeclName(); Diag(forwardDecl->getLocation(), diag::note_protocol_decl_undefined) @@ -3236,7 +3236,7 @@ return false; // If either is hidden, it is not considered to match. - if (!left->isUnconditionallyVisible() || !right->isUnconditionallyVisible()) + if (!isVisible(left) || !isVisible(right)) return false; if (left->isDirectMethod() != right->isDirectMethod()) @@ -3495,7 +3495,7 @@ ObjCMethodList &MethList = InstanceFirst ? Pos->second.first : Pos->second.second; for (ObjCMethodList *M = &MethList; M; M = M->getNext()) - if (M->getMethod() && M->getMethod()->isUnconditionallyVisible()) { + if (M->getMethod() && isVisible(M->getMethod())) { if (FilterMethodsByTypeBound(M->getMethod(), TypeBound)) Methods.push_back(M->getMethod()); } @@ -3511,7 +3511,7 @@ ObjCMethodList &MethList2 = InstanceFirst ? Pos->second.second : Pos->second.first; for (ObjCMethodList *M = &MethList2; M; M = M->getNext()) - if (M->getMethod() && M->getMethod()->isUnconditionallyVisible()) { + if (M->getMethod() && isVisible(M->getMethod())) { if (FilterMethodsByTypeBound(M->getMethod(), TypeBound)) Methods.push_back(M->getMethod()); } @@ -3558,7 +3558,7 @@ ObjCMethodList &MethList = instance ? Pos->second.first : Pos->second.second; SmallVector Methods; for (ObjCMethodList *M = &MethList; M; M = M->getNext()) { - if (M->getMethod() && M->getMethod()->isUnconditionallyVisible()) + if (M->getMethod() && isVisible(M->getMethod())) return M->getMethod(); } return nullptr;