@@ -3360,13 +3360,13 @@ namespace {
3360
3360
// declaration.
3361
3361
if (auto imported = VisitObjCMethodDecl (decl, dc,
3362
3362
/* forceClassMethod=*/ true ))
3363
- Impl.setAlternateDecl (result, cast<ValueDecl>(imported));
3363
+ Impl.addAlternateDecl (result, cast<ValueDecl>(imported));
3364
3364
} else if (auto factory = importFactoryMethodAsConstructor (
3365
3365
result, decl, selector, dc)) {
3366
3366
// We imported the factory method as an initializer, so
3367
3367
// record it as an alternate declaration.
3368
3368
if (*factory)
3369
- Impl.setAlternateDecl (result, *factory);
3369
+ Impl.addAlternateDecl (result, *factory);
3370
3370
}
3371
3371
3372
3372
}
@@ -4971,7 +4971,7 @@ SwiftDeclConverter::getImplicitProperty(ImportedName importedName,
4971
4971
SourceLoc ());
4972
4972
4973
4973
// Make the property the alternate declaration for the getter.
4974
- Impl.setAlternateDecl (swiftGetter, property);
4974
+ Impl.addAlternateDecl (swiftGetter, property);
4975
4975
4976
4976
return property;
4977
4977
}
@@ -5021,7 +5021,7 @@ SwiftDeclConverter::importFactoryMethodAsConstructor(
5021
5021
// / Record the initializer as an alternative declaration for the
5022
5022
// / member.
5023
5023
if (result) {
5024
- Impl.setAlternateDecl (member, result);
5024
+ Impl.addAlternateDecl (member, result);
5025
5025
5026
5026
if (swift3Name)
5027
5027
markAsSwift2Variant (result, *swift3Name);
@@ -5736,7 +5736,7 @@ SwiftDeclConverter::importSubscript(Decl *decl,
5736
5736
TypeLoc::withoutLoc (elementContextTy), dc);
5737
5737
5738
5738
// / Record the subscript as an alternative declaration.
5739
- Impl.setAlternateDecl (associateWithSetter ? setter : getter, subscript);
5739
+ Impl.addAlternateDecl (associateWithSetter ? setter : getter, subscript);
5740
5740
5741
5741
subscript->makeComputed (SourceLoc (), getterThunk, setterThunk, nullptr ,
5742
5742
SourceLoc ());
@@ -5934,8 +5934,8 @@ void SwiftDeclConverter::importObjCMembers(
5934
5934
continue ;
5935
5935
5936
5936
if (auto objcMethod = dyn_cast<clang::ObjCMethodDecl>(nd)) {
5937
- // If there is an alternate declaration for this member, add it.
5938
- if (auto alternate = Impl.getAlternateDecl (member)) {
5937
+ // If there is are alternate declarations for this member, add it.
5938
+ for (auto alternate : Impl.getAlternateDecls (member)) {
5939
5939
if (alternate->getDeclContext () == member->getDeclContext () &&
5940
5940
knownMembers.insert (alternate).second )
5941
5941
members.push_back (alternate);
@@ -6063,7 +6063,7 @@ void SwiftDeclConverter::importMirroredProtocolMembers(
6063
6063
Impl.importMirroredDecl (objcMethod, dc, useSwift2Name, proto)) {
6064
6064
members.push_back (imported);
6065
6065
6066
- if (auto alternate = Impl.getAlternateDecl (imported))
6066
+ for (auto alternate : Impl.getAlternateDecls (imported))
6067
6067
if (imported->getDeclContext () == alternate->getDeclContext ())
6068
6068
members.push_back (alternate);
6069
6069
}
@@ -6542,7 +6542,7 @@ ClangImporter::Implementation::importDeclImpl(const clang::NamedDecl *ClangDecl,
6542
6542
if (Result) {
6543
6543
finalizeDecl (Result);
6544
6544
6545
- if (auto alternate = getAlternateDecl (Result))
6545
+ for (auto alternate : getAlternateDecls (Result))
6546
6546
finalizeDecl (alternate);
6547
6547
}
6548
6548
@@ -6793,7 +6793,7 @@ ClangImporter::Implementation::importMirroredDecl(const clang::NamedDecl *decl,
6793
6793
updateMirroredDecl (result);
6794
6794
6795
6795
// Update the alternate declaration as well.
6796
- if (auto alternate = getAlternateDecl (result))
6796
+ for (auto alternate : getAlternateDecls (result))
6797
6797
updateMirroredDecl (alternate);
6798
6798
}
6799
6799
if (result || !converter.hadForwardDeclaration ())
@@ -7193,7 +7193,7 @@ ClangImporter::Implementation::loadAllMembers(Decl *D, uint64_t extra) {
7193
7193
// Add the member.
7194
7194
ext->addMember (member);
7195
7195
7196
- if (auto alternate = getAlternateDecl (member)) {
7196
+ for (auto alternate : getAlternateDecls (member)) {
7197
7197
ext->addMember (alternate);
7198
7198
}
7199
7199
0 commit comments