@@ -2422,8 +2422,11 @@ bool swift::diagnoseUnintendedObjCMethodOverrides(SourceFile &sf) {
2422
2422
// / Retrieve the source file for the given Objective-C member conflict.
2423
2423
static TinyPtrVector<AbstractFunctionDecl *>
2424
2424
getObjCMethodConflictDecls (const SourceFile::ObjCMethodConflict &conflict) {
2425
- return conflict.typeDecl ->lookupDirect (conflict.selector ,
2426
- conflict.isInstanceMethod );
2425
+ NominalTypeDecl *typeDecl = std::get<0 >(conflict);
2426
+ ObjCSelector selector = std::get<1 >(conflict);
2427
+ bool isInstanceMethod = std::get<2 >(conflict);
2428
+
2429
+ return typeDecl->lookupDirect (selector, isInstanceMethod);
2427
2430
}
2428
2431
2429
2432
static ObjCAttr *getObjCAttrIfFromAccessNote (ValueDecl *VD) {
@@ -2449,8 +2452,7 @@ bool swift::diagnoseObjCMethodConflicts(SourceFile &sf) {
2449
2452
// Sort the set of conflicts so we get a deterministic order for
2450
2453
// diagnostics. We use the first conflicting declaration in each set to
2451
2454
// perform the sort.
2452
- llvm::SmallVector<SourceFile::ObjCMethodConflict, 4 > localConflicts;
2453
- llvm::copy (sf.ObjCMethodConflicts , std::back_inserter (localConflicts));
2455
+ auto localConflicts = sf.ObjCMethodConflicts ;
2454
2456
std::sort (localConflicts.begin (), localConflicts.end (),
2455
2457
[&](const SourceFile::ObjCMethodConflict &lhs,
2456
2458
const SourceFile::ObjCMethodConflict &rhs) {
@@ -2461,6 +2463,9 @@ bool swift::diagnoseObjCMethodConflicts(SourceFile &sf) {
2461
2463
// Diagnose each conflict.
2462
2464
bool anyConflicts = false ;
2463
2465
for (const auto &conflict : localConflicts) {
2466
+ NominalTypeDecl *tyDecl = std::get<0 >(conflict);
2467
+ ObjCSelector selector = std::get<1 >(conflict);
2468
+
2464
2469
auto methods = getObjCMethodConflictDecls (conflict);
2465
2470
2466
2471
// Erase any invalid or stub declarations. We don't want to complain about
@@ -2540,10 +2545,10 @@ bool swift::diagnoseObjCMethodConflicts(SourceFile &sf) {
2540
2545
: diag::objc_redecl,
2541
2546
diagInfo.first , diagInfo.second ,
2542
2547
origDiagInfo.first , origDiagInfo.second ,
2543
- conflict. selector );
2548
+ selector);
2544
2549
2545
2550
// Protocols weren't checked for selector conflicts in 5.0.
2546
- diag.warnUntilSwiftVersionIf (!isa<ClassDecl>(conflict. typeDecl ), 6 );
2551
+ diag.warnUntilSwiftVersionIf (!isa<ClassDecl>(tyDecl ), 6 );
2547
2552
2548
2553
auto objcAttr = getObjCAttrIfFromAccessNote (conflictingDecl);
2549
2554
swift::softenIfAccessNote (conflictingDecl, objcAttr, diag);
0 commit comments