Skip to content

Commit e432971

Browse files
committed
Revert "Sema: Infer '@_usableFromInline' imports by looking at references from inlinable functions (#16326)"
This reverts commit ee6e190. It's not sufficient to solve the problem, and the choices were to do something more complicated, or just take a simple brute force approach. We're going with the latter.
1 parent 06c24dd commit e432971

File tree

5 files changed

+3
-59
lines changed

5 files changed

+3
-59
lines changed

include/swift/AST/Module.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ class SourceFile final : public FileUnit {
791791
/// This is the list of modules that are imported by this module.
792792
///
793793
/// This is filled in by the Name Binding phase.
794-
MutableArrayRef<std::pair<ModuleDecl::ImportedModule, ImportOptions>> Imports;
794+
ArrayRef<std::pair<ModuleDecl::ImportedModule, ImportOptions>> Imports;
795795

796796
/// A unique identifier representing this file; used to mark private decls
797797
/// within the file to keep them from conflicting with other files in the
@@ -897,8 +897,6 @@ class SourceFile final : public FileUnit {
897897

898898
bool hasTestableImport(const ModuleDecl *module) const;
899899

900-
void markUsableFromInlineImport(const ModuleDecl *module);
901-
902900
void clearLookupCache();
903901

904902
void cacheVisibleDecls(SmallVectorImpl<ValueDecl *> &&globals) const;

lib/AST/Module.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,14 +1287,6 @@ bool SourceFile::hasTestableImport(const swift::ModuleDecl *module) const {
12871287
});
12881288
}
12891289

1290-
void SourceFile::markUsableFromInlineImport(const ModuleDecl *module) {
1291-
for (auto &Import : Imports) {
1292-
if (Import.first.second == module) {
1293-
Import.second |= ImportFlags::UsableFromInline;
1294-
}
1295-
}
1296-
}
1297-
12981290
void SourceFile::clearLookupCache() {
12991291
if (!Cache)
13001292
return;

lib/Sema/TypeCheckAvailability.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2509,19 +2509,12 @@ bool AvailabilityWalker::diagAvailability(const ValueDecl *D, SourceRange R,
25092509
return true;
25102510
}
25112511

2512-
if (FragileKind) {
2513-
if (R.isValid()) {
2512+
if (FragileKind)
2513+
if (R.isValid())
25142514
if (TC.diagnoseInlinableDeclRef(R.Start, D, DC, *FragileKind,
25152515
TreatUsableFromInlineAsPublic))
25162516
return true;
25172517

2518-
auto *SF = cast<SourceFile>(DC->getModuleScopeContext());
2519-
auto *M = D->getDeclContext()->getParentModule();
2520-
if (SF->getParentModule() != M)
2521-
SF->markUsableFromInlineImport(M);
2522-
}
2523-
}
2524-
25252518
if (TC.diagnoseExplicitUnavailability(D, R, DC, call))
25262519
return true;
25272520

test/Serialization/Inputs/autolinking_module_inferred.swift

Lines changed: 0 additions & 7 deletions
This file was deleted.

test/Serialization/autolinking-inlinable-inferred.swift

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)