Skip to content

Commit a6458c7

Browse files
authored
Merge pull request #76968 from swiftlang/elsh/pcmo-remove-workaround
[Package CMO] Replace workaround with assert in makeDeclUsableFromInline
2 parents 333a1eb + 415ede4 commit a6458c7

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

lib/SILOptimizer/IPO/CrossModuleOptimization.cpp

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -995,25 +995,13 @@ void CrossModuleOptimization::makeFunctionUsableFromInline(SILFunction *function
995995
}
996996
}
997997

998-
/// Make a nominal type, including it's context, usable from inline.
998+
/// Make a nominal type, including its context, usable from inline.
999999
void CrossModuleOptimization::makeDeclUsableFromInline(ValueDecl *decl) {
10001000
if (decl->getEffectiveAccess() >= AccessLevel::Package)
1001-
return;
1001+
return;
10021002

1003-
// FIXME: rdar://130456707
1004-
// Currently not all types are visited in canSerialize* calls, sometimes
1005-
// resulting in an internal type getting @usableFromInline, which is
1006-
// incorrect.
1007-
// For example, for `let q = P() as? Q`, where Q is an internal class
1008-
// inherting a public class P, Q is not visited in the canSerialize*
1009-
// checks, thus resulting in `@usableFromInline class Q`; this is not
1010-
// the intended behavior in the conservative mode as it modifies AST.
1011-
//
1012-
// To properly fix, instruction visitor needs to be refactored to do
1013-
// both the "canSerialize" check (that visits all types) and serialize
1014-
// or update visibility (modify AST in non-conservative modes).
1015-
if (isPackageCMOEnabled(M.getSwiftModule()))
1016-
return;
1003+
// This function should not be called in Package CMO mode.
1004+
assert(!isPackageCMOEnabled(M.getSwiftModule()));
10171005

10181006
// We must not modify decls which are defined in other modules.
10191007
if (M.getSwiftModule() != decl->getDeclContext()->getParentModule())

0 commit comments

Comments
 (0)