@@ -4511,9 +4511,7 @@ namespace {
4511
4511
// / methods become class methods on NSObject).
4512
4512
void importMirroredProtocolMembers (const clang::ObjCContainerDecl *decl,
4513
4513
DeclContext *dc,
4514
- ArrayRef<ProtocolDecl *> protocols,
4515
- SmallVectorImpl<Decl *> &members,
4516
- ASTContext &Ctx);
4514
+ SmallVectorImpl<Decl *> &members);
4517
4515
4518
4516
void importNonOverriddenMirroredMethods (DeclContext *dc,
4519
4517
MutableArrayRef<MirroredMethodEntry> entries,
@@ -6861,30 +6859,11 @@ void SwiftDeclConverter::addObjCProtocolConformances(
6861
6859
6862
6860
Impl.recordImportedProtocols (decl, protocols);
6863
6861
6864
- // Synthesize trivial conformances for each of the protocols.
6865
- SmallVector<ProtocolConformance *, 4 > conformances;
6866
-
6867
- auto dc = decl->getInnermostDeclContext ();
6868
- auto &ctx = Impl.SwiftContext ;
6869
- for (unsigned i = 0 , n = protocols.size (); i != n; ++i) {
6870
- // FIXME: Build a superclass conformance if the superclass
6871
- // conforms.
6872
- auto conformance = ctx.getConformance (dc->getDeclaredInterfaceType (),
6873
- protocols[i], SourceLoc (), dc,
6874
- ProtocolConformanceState::Incomplete);
6875
- conformance->setLazyLoader (&Impl, /* context*/ 0 );
6876
- conformance->setState (ProtocolConformanceState::Complete);
6877
- conformances.push_back (conformance);
6878
- }
6879
-
6880
- // Set the conformances.
6881
- // FIXME: This could be lazier.
6882
- unsigned id = Impl.allocateDelayedConformance (std::move (conformances));
6883
6862
if (auto nominal = dyn_cast<NominalTypeDecl>(decl)) {
6884
- nominal->setConformanceLoader (&Impl, id );
6863
+ nominal->setConformanceLoader (&Impl, 0 );
6885
6864
} else {
6886
6865
auto ext = cast<ExtensionDecl>(decl);
6887
- ext->setConformanceLoader (&Impl, id );
6866
+ ext->setConformanceLoader (&Impl, 0 );
6888
6867
}
6889
6868
}
6890
6869
@@ -6950,13 +6929,14 @@ Optional<GenericParamList *> SwiftDeclConverter::importObjCGenericParams(
6950
6929
6951
6930
void SwiftDeclConverter::importMirroredProtocolMembers (
6952
6931
const clang::ObjCContainerDecl *decl, DeclContext *dc,
6953
- ArrayRef<ProtocolDecl *> protocols, SmallVectorImpl<Decl *> &members,
6954
- ASTContext &Ctx) {
6932
+ SmallVectorImpl<Decl *> &members) {
6955
6933
assert (dc);
6956
6934
const clang::ObjCInterfaceDecl *interfaceDecl = nullptr ;
6957
6935
const ClangModuleUnit *declModule;
6958
6936
const ClangModuleUnit *interfaceModule;
6959
6937
6938
+ auto protocols = Impl.getImportedProtocols (dc->getAsDecl ());
6939
+
6960
6940
// 'protocols' is, for some reason, the full recursive expansion of
6961
6941
// the protocol hierarchy, so there's no need to recursively descend
6962
6942
// into inherited protocols.
@@ -8696,7 +8676,6 @@ void ClangImporter::Implementation::collectMembersToAdd(
8696
8676
insertMembersAndAlternates (nd, members);
8697
8677
}
8698
8678
8699
- SmallVector<ProtocolDecl *, 4 > protos = takeImportedProtocols (D);
8700
8679
if (auto clangClass = dyn_cast<clang::ObjCInterfaceDecl>(objcContainer)) {
8701
8680
importInheritedConstructors (cast<ClassDecl>(D), members);
8702
8681
@@ -8710,14 +8689,26 @@ void ClangImporter::Implementation::collectMembersToAdd(
8710
8689
// or extension conforms.
8711
8690
// FIXME: This is supposed to be a short-term hack.
8712
8691
SwiftDeclConverter converter (*this , CurrentVersion);
8713
- converter.importMirroredProtocolMembers (objcContainer, DC,
8714
- protos, members, SwiftContext);
8692
+ converter.importMirroredProtocolMembers (objcContainer, DC, members);
8715
8693
}
8716
8694
8717
8695
void ClangImporter::Implementation::loadAllConformances (
8718
- const Decl *D , uint64_t contextData,
8696
+ const Decl *decl , uint64_t contextData,
8719
8697
SmallVectorImpl<ProtocolConformance *> &Conformances) {
8720
- Conformances = takeDelayedConformance (contextData);
8698
+ auto dc = decl->getInnermostDeclContext ();
8699
+
8700
+ // Synthesize trivial conformances for each of the protocols.
8701
+ for (auto *protocol : getImportedProtocols (decl)) {
8702
+ // FIXME: Build a superclass conformance if the superclass
8703
+ // conforms.
8704
+ auto conformance = SwiftContext.getConformance (
8705
+ dc->getDeclaredInterfaceType (),
8706
+ protocol, SourceLoc (), dc,
8707
+ ProtocolConformanceState::Incomplete);
8708
+ conformance->setLazyLoader (this , /* context*/ 0 );
8709
+ conformance->setState (ProtocolConformanceState::Complete);
8710
+ Conformances.push_back (conformance);
8711
+ }
8721
8712
}
8722
8713
8723
8714
Optional<MappedTypeNameKind>
0 commit comments