@@ -3730,27 +3730,6 @@ void ClangImporter::Implementation::lookupAllObjCMembers(
3730
3730
}
3731
3731
}
3732
3732
3733
- // Force the members of the entire inheritance hierarchy to be loaded and
3734
- // deserialized before loading the named member of this class. This allows the
3735
- // decl members table to be warmed up and enables the correct identification of
3736
- // overrides.
3737
- //
3738
- // FIXME: Very low hanging fruit: Loading everything is extremely wasteful. We
3739
- // should be able to just load the name lazy member loading is asking for.
3740
- static void ensureSuperclassMembersAreLoaded (const ClassDecl *CD) {
3741
- if (!CD)
3742
- return ;
3743
-
3744
- CD = CD->getSuperclassDecl ();
3745
- if (!CD || !CD->hasClangNode ())
3746
- return ;
3747
-
3748
- CD->loadAllMembers ();
3749
-
3750
- for (auto *ED : const_cast <ClassDecl *>(CD)->getExtensions ())
3751
- ED->loadAllMembers ();
3752
- }
3753
-
3754
3733
Optional<TinyPtrVector<ValueDecl *>>
3755
3734
ClangImporter::Implementation::loadNamedMembers (
3756
3735
const IterableDeclContext *IDC, DeclBaseName N, uint64_t contextData) {
@@ -3799,7 +3778,16 @@ ClangImporter::Implementation::loadNamedMembers(
3799
3778
3800
3779
assert (isa<clang::ObjCContainerDecl>(CD) || isa<clang::NamespaceDecl>(CD));
3801
3780
3802
- ensureSuperclassMembersAreLoaded (dyn_cast<ClassDecl>(D));
3781
+ // Force the members of the entire inheritance hierarchy to be loaded and
3782
+ // deserialized before loading the named member of a class. This warms up
3783
+ // ClangImporter::Implementation::MembersForNominal, used for computing
3784
+ // property overrides.
3785
+ //
3786
+ // FIXME: If getOverriddenDecl() kicked off a request for imported decls,
3787
+ // we could postpone this until overrides are actually requested.
3788
+ if (auto *classDecl = dyn_cast<ClassDecl>(D))
3789
+ if (auto *superclassDecl = classDecl->getSuperclassDecl ())
3790
+ (void ) const_cast <ClassDecl *>(superclassDecl)->lookupDirect (N);
3803
3791
3804
3792
TinyPtrVector<ValueDecl *> Members;
3805
3793
for (auto entry : table->lookup (SerializedSwiftName (N),
@@ -3829,7 +3817,7 @@ ClangImporter::Implementation::loadNamedMembers(
3829
3817
auto member = entry.get <clang::NamedDecl *>();
3830
3818
if (!isVisibleClangEntry (member)) continue ;
3831
3819
3832
- // Skip Decls from different clang::DeclContexts
3820
+ // Skip Decls from different clang::DeclContexts
3833
3821
if (member->getDeclContext () != CDC) continue ;
3834
3822
3835
3823
SmallVector<Decl*, 4 > tmp;
0 commit comments