@@ -2082,37 +2082,6 @@ getObjCMethodConflictDecls(const SourceFile::ObjCMethodConflict &conflict) {
2082
2082
return classDecl->lookupDirect (selector, isInstanceMethod);
2083
2083
}
2084
2084
2085
- // / Given a set of conflicting Objective-C methods, remove any methods
2086
- // / that are legitimately overridden in Objective-C, i.e., because
2087
- // / they occur in different modules, one is defined in the class, and
2088
- // / the other is defined in an extension (category) thereof.
2089
- static void removeValidObjCConflictingMethods (
2090
- MutableArrayRef<AbstractFunctionDecl *> &methods) {
2091
- // Erase any invalid or stub declarations. We don't want to complain about
2092
- // them, because we might already have complained about
2093
- // redeclarations based on Swift matching.
2094
- auto newEnd = std::remove_if (methods.begin (), methods.end (),
2095
- [&](AbstractFunctionDecl *method) {
2096
- if (method->isInvalid ())
2097
- return true ;
2098
-
2099
- if (auto ad = dyn_cast<AccessorDecl>(method)) {
2100
- return ad->getStorage ()->isInvalid ();
2101
- }
2102
-
2103
- if (auto ctor
2104
- = dyn_cast<ConstructorDecl>(method)) {
2105
- if (ctor->hasStubImplementation ())
2106
- return true ;
2107
-
2108
- return false ;
2109
- }
2110
-
2111
- return false ;
2112
- });
2113
- methods = methods.slice (0 , newEnd - methods.begin ());
2114
- }
2115
-
2116
2085
bool swift::diagnoseObjCMethodConflicts (SourceFile &sf) {
2117
2086
// If there were no conflicts, we're done.
2118
2087
if (sf.ObjCMethodConflicts .empty ())
@@ -2140,8 +2109,23 @@ bool swift::diagnoseObjCMethodConflicts(SourceFile &sf) {
2140
2109
2141
2110
auto methods = getObjCMethodConflictDecls (conflict);
2142
2111
2143
- // Prune out cases where it is acceptable to have a conflict.
2144
- removeValidObjCConflictingMethods (methods);
2112
+ // Erase any invalid or stub declarations. We don't want to complain about
2113
+ // them, because we might already have complained about redeclarations
2114
+ // based on Swift matching.
2115
+ llvm::erase_if (methods, [](AbstractFunctionDecl *afd) -> bool {
2116
+ if (afd->isInvalid ())
2117
+ return true ;
2118
+
2119
+ if (auto ad = dyn_cast<AccessorDecl>(afd))
2120
+ return ad->getStorage ()->isInvalid ();
2121
+
2122
+ if (auto *ctor = dyn_cast<ConstructorDecl>(afd)) {
2123
+ if (ctor->hasStubImplementation ())
2124
+ return true ;
2125
+ }
2126
+ return false ;
2127
+ });
2128
+
2145
2129
if (methods.size () < 2 )
2146
2130
continue ;
2147
2131
0 commit comments