Skip to content

Commit 746ab48

Browse files
committed
run the move-checker if lexical lifetimes are enabled
this pulls just the move checking passes out from behind the experimental flag.
1 parent 1a66365 commit 746ab48

8 files changed

+14
-6
lines changed

include/swift/AST/ASTContext.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,9 @@ class ASTContext final {
695695
FuncDecl *getMakeInvocationEncoderOnDistributedActorSystem(
696696
AbstractFunctionDecl *thunk) const;
697697

698+
/// Indicates whether move-only / noncopyable types are supported.
699+
bool supportsMoveOnlyTypes() const;
700+
698701
// Retrieve the declaration of
699702
// DistributedInvocationEncoder.recordGenericSubstitution(_:).
700703
//

lib/AST/ASTContext.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6352,3 +6352,8 @@ ASTContext::lookupExecutablePluginByModuleName(Identifier moduleName) {
63526352

63536353
return plugin.get();
63546354
}
6355+
6356+
bool ASTContext::supportsMoveOnlyTypes() const {
6357+
// currently the only thing holding back whether the types can appear is this.
6358+
return SILOpts.LexicalLifetimes == LexicalLifetimesOption::On;
6359+
}

lib/SILOptimizer/Mandatory/ConsumeOperatorCopyableAddressesChecker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2400,7 +2400,7 @@ class ConsumeOperatorCopyableAddressesCheckerPass
24002400
auto &astContext = fn->getASTContext();
24012401

24022402
// Only run this pass if the move only language feature is enabled.
2403-
if (!astContext.LangOpts.Features.contains(Feature::MoveOnly))
2403+
if (!astContext.supportsMoveOnlyTypes())
24042404
return;
24052405

24062406
// Don't rerun diagnostics on deserialized functions.

lib/SILOptimizer/Mandatory/ConsumeOperatorCopyableValuesChecker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ class ConsumeOperatorCopyableValuesCheckerPass : public SILFunctionTransform {
527527
auto *fn = getFunction();
528528

529529
// Only run this pass if the move only language feature is enabled.
530-
if (!fn->getASTContext().LangOpts.Features.contains(Feature::MoveOnly))
530+
if (!fn->getASTContext().supportsMoveOnlyTypes())
531531
return;
532532

533533
// Don't rerun diagnostics on deserialized functions.

lib/SILOptimizer/Mandatory/MoveOnlyAddressCheckerTester.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class MoveOnlyAddressCheckerTesterPass : public SILFunctionTransform {
7979
auto *fn = getFunction();
8080

8181
// Only run this pass if the move only language feature is enabled.
82-
if (!fn->getASTContext().LangOpts.Features.contains(Feature::MoveOnly))
82+
if (!fn->getASTContext().supportsMoveOnlyTypes())
8383
return;
8484

8585
// Don't rerun diagnostics on deserialized functions.

lib/SILOptimizer/Mandatory/MoveOnlyBorrowToDestructureTester.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class MoveOnlyBorrowToDestructureTransformPass : public SILFunctionTransform {
7272
auto *fn = getFunction();
7373

7474
// Only run this pass if the move only language feature is enabled.
75-
if (!fn->getASTContext().LangOpts.Features.contains(Feature::MoveOnly))
75+
if (!fn->getASTContext().supportsMoveOnlyTypes())
7676
return;
7777

7878
// Don't rerun diagnostics on deserialized functions.

lib/SILOptimizer/Mandatory/MoveOnlyChecker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class MoveOnlyCheckerPass : public SILFunctionTransform {
147147
auto *fn = getFunction();
148148

149149
// Only run this pass if the move only language feature is enabled.
150-
if (!fn->getASTContext().LangOpts.Features.contains(Feature::MoveOnly))
150+
if (!fn->getASTContext().supportsMoveOnlyTypes())
151151
return;
152152

153153
// Don't rerun diagnostics on deserialized functions.

lib/SILOptimizer/Mandatory/MoveOnlyObjectCheckerTester.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class MoveOnlyObjectCheckerTesterPass : public SILFunctionTransform {
7676
auto *fn = getFunction();
7777

7878
// Only run this pass if the move only language feature is enabled.
79-
if (!fn->getASTContext().LangOpts.Features.contains(Feature::MoveOnly))
79+
if (!fn->getASTContext().supportsMoveOnlyTypes())
8080
return;
8181

8282
// Don't rerun diagnostics on deserialized functions.

0 commit comments

Comments
 (0)