Skip to content

Commit 415ede4

Browse files
committed
Assert that makeDeclUsableFromInline is not called in Package CMO mode.
Removes a workaround previously added to handle types that were overlooked during a serializability detection pass. Now that the pass has been refactored with instruction visitor, we can replace it with assert. Resolves rdar://137711038
1 parent 23a049c commit 415ede4

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)