Skip to content

Commit 4330921

Browse files
committed
[Sema] Remove ImportFilterKind::SPIAccessControl
That filter wasn't needed in practice, we can remove it.
1 parent aced44a commit 4330921

File tree

10 files changed

+11
-30
lines changed

10 files changed

+11
-30
lines changed

include/swift/AST/Module.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -794,13 +794,11 @@ class ModuleDecl
794794
/// Include imports declared with `@_implementationOnly` or with an
795795
/// access-level of `package` or less.
796796
ImplementationOnly = 1 << 2,
797-
/// Include imports of SPIs declared with `@_spi`.
798-
SPIAccessControl = 1 << 3,
799797
/// Include imports declared with `@_spiOnly`.
800-
SPIOnly = 1 << 4,
798+
SPIOnly = 1 << 3,
801799
/// Include imports shadowed by a cross-import overlay. Unshadowed imports
802800
/// are included whether or not this flag is specified.
803-
ShadowedByCrossImportOverlay = 1 << 5
801+
ShadowedByCrossImportOverlay = 1 << 4
804802
};
805803
/// \sa getImportedModules
806804
using ImportFilter = OptionSet<ImportFilterKind>;

lib/AST/ASTPrinter.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5544,7 +5544,6 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
55445544
// For the current module, consider both private and public imports.
55455545
ModuleDecl::ImportFilter Filter = ModuleDecl::ImportFilterKind::Exported;
55465546
Filter |= ModuleDecl::ImportFilterKind::Default;
5547-
Filter |= ModuleDecl::ImportFilterKind::SPIAccessControl;
55485547
SmallVector<ImportedModule, 4> Imports;
55495548
Options.CurrentModule->getImportedModules(Imports, Filter);
55505549

lib/AST/ImportCache.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,7 @@ ImportSet &ImportCache::getImportSet(const DeclContext *dc) {
195195
file->getImportedModules(imports,
196196
{ModuleDecl::ImportFilterKind::Default,
197197
ModuleDecl::ImportFilterKind::ImplementationOnly,
198-
ModuleDecl::ImportFilterKind::SPIOnly,
199-
ModuleDecl::ImportFilterKind::SPIAccessControl});
198+
ModuleDecl::ImportFilterKind::SPIOnly});
200199
}
201200

202201
auto &result = getImportSet(ctx, imports);
@@ -280,8 +279,7 @@ ImportCache::getAllAccessPathsNotShadowedBy(const ModuleDecl *mod,
280279
file->getImportedModules(stack,
281280
{ModuleDecl::ImportFilterKind::Default,
282281
ModuleDecl::ImportFilterKind::ImplementationOnly,
283-
ModuleDecl::ImportFilterKind::SPIOnly,
284-
ModuleDecl::ImportFilterKind::SPIAccessControl});
282+
ModuleDecl::ImportFilterKind::SPIOnly});
285283
}
286284

287285
SmallVector<ImportPath::Access, 4> accessPaths;

lib/AST/Module.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,8 +1906,6 @@ SourceFile::getImportedModules(SmallVectorImpl<ImportedModule> &modules,
19061906
requiredFilter |= ModuleDecl::ImportFilterKind::ImplementationOnly;
19071907
else if (desc.options.contains(ImportFlags::SPIOnly))
19081908
requiredFilter |= ModuleDecl::ImportFilterKind::SPIOnly;
1909-
else if (desc.options.contains(ImportFlags::SPIAccessControl))
1910-
requiredFilter |= ModuleDecl::ImportFilterKind::SPIAccessControl;
19111909
else
19121910
requiredFilter |= ModuleDecl::ImportFilterKind::Default;
19131911

@@ -2271,8 +2269,7 @@ SourceFile::collectLinkLibraries(ModuleDecl::LinkLibraryCallback callback) const
22712269

22722270
ModuleDecl::ImportFilter filter = {
22732271
ModuleDecl::ImportFilterKind::Exported,
2274-
ModuleDecl::ImportFilterKind::Default,
2275-
ModuleDecl::ImportFilterKind::SPIAccessControl};
2272+
ModuleDecl::ImportFilterKind::Default};
22762273

22772274
auto *topLevel = getParentModule();
22782275

@@ -2985,7 +2982,6 @@ bool ModuleDecl::isImportedImplementationOnly(const ModuleDecl *module) const {
29852982
ModuleDecl::ImportFilter filter = {
29862983
ModuleDecl::ImportFilterKind::Exported,
29872984
ModuleDecl::ImportFilterKind::Default,
2988-
ModuleDecl::ImportFilterKind::SPIAccessControl,
29892985
ModuleDecl::ImportFilterKind::ShadowedByCrossImportOverlay};
29902986
SmallVector<ImportedModule, 4> results;
29912987
getImportedModules(results, filter);
@@ -3011,8 +3007,7 @@ canBeUsedForCrossModuleOptimization(DeclContext *ctxt) const {
30113007
// @_implementationOnly or @_spi.
30123008
ModuleDecl::ImportFilter filter = {
30133009
ModuleDecl::ImportFilterKind::ImplementationOnly,
3014-
ModuleDecl::ImportFilterKind::SPIOnly,
3015-
ModuleDecl::ImportFilterKind::SPIAccessControl
3010+
ModuleDecl::ImportFilterKind::SPIOnly
30163011
};
30173012
SmallVector<ImportedModule, 4> results;
30183013
getImportedModules(results, filter);

lib/Frontend/ModuleInterfaceSupport.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ static void printToolVersionAndFlagsComment(raw_ostream &out,
7070
moduleName << "=" << moduleName;
7171

7272
ModuleDecl::ImportFilter filter = {ModuleDecl::ImportFilterKind::Default,
73-
ModuleDecl::ImportFilterKind::Exported,
74-
ModuleDecl::ImportFilterKind::SPIAccessControl};
73+
ModuleDecl::ImportFilterKind::Exported};
7574
if (Opts.PrintPrivateInterfaceContent)
7675
filter |= ModuleDecl::ImportFilterKind::SPIOnly;
7776

@@ -228,8 +227,7 @@ static void printImports(raw_ostream &out,
228227
// it's not obvious what higher-level optimization would be factored out here.
229228
ModuleDecl::ImportFilter allImportFilter = {
230229
ModuleDecl::ImportFilterKind::Exported,
231-
ModuleDecl::ImportFilterKind::Default,
232-
ModuleDecl::ImportFilterKind::SPIAccessControl};
230+
ModuleDecl::ImportFilterKind::Default};
233231

234232
// With -experimental-spi-imports:
235233
// When printing the private swiftinterface file, print implementation-only

lib/FrontendTool/ImportedModules.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ bool swift::emitImportedModules(ModuleDecl *mainModule,
8585
clangImporter->getImportedHeaderModule()->getImportedModules(
8686
imported, {ModuleDecl::ImportFilterKind::Exported,
8787
ModuleDecl::ImportFilterKind::Default,
88-
ModuleDecl::ImportFilterKind::ImplementationOnly,
89-
ModuleDecl::ImportFilterKind::SPIAccessControl});
88+
ModuleDecl::ImportFilterKind::ImplementationOnly});
9089

9190
for (auto IM : imported) {
9291
if (auto clangModule = IM.importedModule->findUnderlyingClangModule())

lib/FrontendTool/LoadedModuleTrace.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ static void getImmediateImports(
113113
ModuleDecl::ImportFilterKind::Exported,
114114
ModuleDecl::ImportFilterKind::Default,
115115
ModuleDecl::ImportFilterKind::ImplementationOnly,
116-
ModuleDecl::ImportFilterKind::SPIAccessControl,
117116
ModuleDecl::ImportFilterKind::ShadowedByCrossImportOverlay}) {
118117
SmallVector<ImportedModule, 8> importList;
119118
module->getImportedModules(importList, importFilter);

lib/IDE/CodeCompletion.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1388,7 +1388,6 @@ void swift::ide::deliverCompletionResults(
13881388
ModuleDecl::ImportFilterKind::Exported,
13891389
ModuleDecl::ImportFilterKind::Default,
13901390
ModuleDecl::ImportFilterKind::ImplementationOnly,
1391-
ModuleDecl::ImportFilterKind::SPIAccessControl,
13921391
});
13931392

13941393
for (auto Imported : Imports) {

lib/Sema/TypeCheckAccess.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1810,7 +1810,6 @@ swift::getDisallowedOriginKind(const Decl *decl,
18101810
auto filter = ModuleDecl::ImportFilter(
18111811
{ModuleDecl::ImportFilterKind::Exported,
18121812
ModuleDecl::ImportFilterKind::Default,
1813-
ModuleDecl::ImportFilterKind::SPIAccessControl,
18141813
ModuleDecl::ImportFilterKind::ShadowedByCrossImportOverlay});
18151814
SmallVector<ImportedModule, 4> sfImportedModules;
18161815
SF->getImportedModules(sfImportedModules, filter);

lib/Serialization/Serialization.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,8 +1214,7 @@ void Serializer::writeInputBlock(const SerializationOptions &options) {
12141214
M->getImportedModules(allImports,
12151215
{ModuleDecl::ImportFilterKind::Exported,
12161216
ModuleDecl::ImportFilterKind::Default,
1217-
ModuleDecl::ImportFilterKind::ImplementationOnly,
1218-
ModuleDecl::ImportFilterKind::SPIAccessControl});
1217+
ModuleDecl::ImportFilterKind::ImplementationOnly});
12191218
ImportedModule::removeDuplicates(allImports);
12201219

12211220
// Collect the public and private imports as a subset so that we can
@@ -1224,8 +1223,6 @@ void Serializer::writeInputBlock(const SerializationOptions &options) {
12241223
getImportsAsSet(M, ModuleDecl::ImportFilterKind::Exported);
12251224
ImportSet privateImportSet =
12261225
getImportsAsSet(M, ModuleDecl::ImportFilterKind::Default);
1227-
ImportSet spiImportSet =
1228-
getImportsAsSet(M, ModuleDecl::ImportFilterKind::SPIAccessControl);
12291226

12301227
auto clangImporter =
12311228
static_cast<ClangImporter *>(M->getASTContext().getClangModuleLoader());
@@ -1271,7 +1268,7 @@ void Serializer::writeInputBlock(const SerializationOptions &options) {
12711268
// form here.
12721269
if (publicImportSet.count(import))
12731270
stableImportControl = ImportControl::Exported;
1274-
else if (privateImportSet.count(import) || spiImportSet.count(import))
1271+
else if (privateImportSet.count(import))
12751272
stableImportControl = ImportControl::Normal;
12761273
else
12771274
stableImportControl = ImportControl::ImplementationOnly;

0 commit comments

Comments
 (0)