mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Revert "[NFC] Clarify semantics of getImportedModules."
This reverts commit 4b5d885114.
This commit is contained in:
@@ -95,7 +95,7 @@ void BuiltinUnit::LookupCache::lookupValue(
|
||||
SmallVectorImpl<ValueDecl*> &Result) {
|
||||
// Only qualified lookup ever finds anything in the builtin module.
|
||||
if (LookupKind != NLKind::QualifiedLookup) return;
|
||||
|
||||
|
||||
ValueDecl *&Entry = Cache[Name];
|
||||
ASTContext &Ctx = M.getParentModule()->getASTContext();
|
||||
if (!Entry) {
|
||||
@@ -175,7 +175,7 @@ public:
|
||||
|
||||
/// Throw away as much memory as possible.
|
||||
void invalidate();
|
||||
|
||||
|
||||
void lookupValue(DeclName Name, NLKind LookupKind,
|
||||
SmallVectorImpl<ValueDecl*> &Result);
|
||||
|
||||
@@ -203,13 +203,13 @@ public:
|
||||
void lookupVisibleDecls(ImportPath::Access AccessPath,
|
||||
VisibleDeclConsumer &Consumer,
|
||||
NLKind LookupKind);
|
||||
|
||||
|
||||
void populateMemberCache(const SourceFile &SF);
|
||||
void populateMemberCache(const ModuleDecl &Mod);
|
||||
|
||||
void lookupClassMembers(ImportPath::Access AccessPath,
|
||||
VisibleDeclConsumer &consumer);
|
||||
|
||||
|
||||
void lookupClassMember(ImportPath::Access accessPath,
|
||||
DeclName name,
|
||||
SmallVectorImpl<ValueDecl*> &results);
|
||||
@@ -331,7 +331,7 @@ void SourceLookupCache::lookupValue(DeclName Name, NLKind LookupKind,
|
||||
SmallVectorImpl<ValueDecl*> &Result) {
|
||||
auto I = TopLevelValues.find(Name);
|
||||
if (I == TopLevelValues.end()) return;
|
||||
|
||||
|
||||
Result.reserve(I->second.size());
|
||||
for (ValueDecl *Elt : I->second)
|
||||
Result.push_back(Elt);
|
||||
@@ -398,7 +398,7 @@ void SourceLookupCache::lookupVisibleDecls(ImportPath::Access AccessPath,
|
||||
void SourceLookupCache::lookupClassMembers(ImportPath::Access accessPath,
|
||||
VisibleDeclConsumer &consumer) {
|
||||
assert(accessPath.size() <= 1 && "can only refer to top-level decls");
|
||||
|
||||
|
||||
if (!accessPath.empty()) {
|
||||
for (auto &member : ClassMembers) {
|
||||
// Non-simple names are also stored under their simple name, so make
|
||||
@@ -432,11 +432,11 @@ void SourceLookupCache::lookupClassMember(ImportPath::Access accessPath,
|
||||
DeclName name,
|
||||
SmallVectorImpl<ValueDecl*> &results) {
|
||||
assert(accessPath.size() <= 1 && "can only refer to top-level decls");
|
||||
|
||||
|
||||
auto iter = ClassMembers.find(name);
|
||||
if (iter == ClassMembers.end())
|
||||
return;
|
||||
|
||||
|
||||
if (!accessPath.empty()) {
|
||||
for (ValueDecl *vd : iter->second) {
|
||||
auto *nominal = vd->getDeclContext()->getSelfNominalTypeDecl();
|
||||
@@ -1163,13 +1163,6 @@ void SourceFile::lookupPrecedenceGroupDirect(
|
||||
|
||||
void ModuleDecl::getImportedModules(SmallVectorImpl<ImportedModule> &modules,
|
||||
ModuleDecl::ImportFilter filter) const {
|
||||
assert(filter.containsAny(ImportFilter({
|
||||
ModuleDecl::ImportFilterKind::Exported,
|
||||
ModuleDecl::ImportFilterKind::Default,
|
||||
ModuleDecl::ImportFilterKind::ImplementationOnly}))
|
||||
&& "filter should have at least one of Exported|Private|ImplementationOnly"
|
||||
);
|
||||
|
||||
FORWARD(getImportedModules, (modules, filter));
|
||||
}
|
||||
|
||||
@@ -1194,12 +1187,11 @@ SourceFile::getImportedModules(SmallVectorImpl<ImportedModule> &modules,
|
||||
requiredFilter |= ModuleDecl::ImportFilterKind::Exported;
|
||||
else if (desc.options.contains(ImportFlags::ImplementationOnly))
|
||||
requiredFilter |= ModuleDecl::ImportFilterKind::ImplementationOnly;
|
||||
else if (desc.options.contains(ImportFlags::SPIAccessControl))
|
||||
requiredFilter |= ModuleDecl::ImportFilterKind::SPIAccessControl;
|
||||
else
|
||||
requiredFilter |= ModuleDecl::ImportFilterKind::Default;
|
||||
|
||||
if (desc.options.contains(ImportFlags::SPIAccessControl))
|
||||
requiredFilter |= ModuleDecl::ImportFilterKind::SPIAccessControl;
|
||||
|
||||
if (!separatelyImportedOverlays.lookup(desc.module.importedModule).empty())
|
||||
requiredFilter |= ModuleDecl::ImportFilterKind::ShadowedByCrossImportOverlay;
|
||||
|
||||
@@ -2374,7 +2366,7 @@ bool FileUnit::walk(ASTWalker &walker) {
|
||||
#ifndef NDEBUG
|
||||
PrettyStackTraceDecl debugStack("walking into decl", D);
|
||||
#endif
|
||||
|
||||
|
||||
if (D->walk(walker))
|
||||
return true;
|
||||
|
||||
@@ -2513,7 +2505,7 @@ SourceFile::lookupOpaqueResultType(StringRef MangledName) {
|
||||
auto found = ValidatedOpaqueReturnTypes.find(MangledName);
|
||||
if (found != ValidatedOpaqueReturnTypes.end())
|
||||
return found->second;
|
||||
|
||||
|
||||
// If there are unvalidated decls with opaque types, go through and validate
|
||||
// them now.
|
||||
(void) getOpaqueReturnTypeDecls();
|
||||
@@ -2521,7 +2513,7 @@ SourceFile::lookupOpaqueResultType(StringRef MangledName) {
|
||||
found = ValidatedOpaqueReturnTypes.find(MangledName);
|
||||
if (found != ValidatedOpaqueReturnTypes.end())
|
||||
return found->second;
|
||||
|
||||
|
||||
// Otherwise, we don't have a matching opaque decl.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user