Skip to content

Commit 471142c

Browse files
authored
Merge pull request #60493 from gottesmm/pr-5090c953a85817f4f92399698c8d97134ff8cae4
[move-keyword] Put the move keyword behind the experimental move only flag for now.
2 parents a59fa46 + f3081d0 commit 471142c

File tree

7 files changed

+16
-9
lines changed

7 files changed

+16
-9
lines changed

lib/Sema/MiscDiagnostics.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,13 @@ static void diagSyntacticUseRestrictions(const Expr *E, const DeclContext *DC,
368368
}
369369

370370
void checkMoveExpr(MoveExpr *moveExpr) {
371+
// Make sure the MoveOnly feature is set. If not, error.
372+
if (!Ctx.LangOpts.hasFeature(Feature::MoveOnly)) {
373+
auto error =
374+
diag::experimental_moveonly_feature_can_only_be_used_when_enabled;
375+
Ctx.Diags.diagnose(moveExpr->getLoc(), error);
376+
}
377+
371378
if (!isa<DeclRefExpr>(moveExpr->getSubExpr())) {
372379
Ctx.Diags.diagnose(moveExpr->getLoc(),
373380
diag::move_expression_not_passed_lvalue);

test/DebugInfo/move_function_dbginfo.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend -parse-as-library -g -emit-ir -o - %s | %FileCheck %s
3-
// RUN: %target-swift-frontend -parse-as-library -g -c %s -o %t/out.o
2+
// RUN: %target-swift-frontend -enable-experimental-move-only -parse-as-library -g -emit-ir -o - %s | %FileCheck %s
3+
// RUN: %target-swift-frontend -enable-experimental-move-only -parse-as-library -g -c %s -o %t/out.o
44
// RUN: %llvm-dwarfdump --show-children %t/out.o | %FileCheck -check-prefix=DWARF %s
55

66
// This test checks that:

test/DebugInfo/move_function_dbginfo_async.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend -parse-as-library -disable-availability-checking -g -emit-sil -o - %s | %FileCheck -check-prefix=SIL %s
3-
// RUN: %target-swift-frontend -parse-as-library -disable-availability-checking -g -emit-ir -o - %s | %FileCheck %s
4-
// RUN: %target-swift-frontend -parse-as-library -disable-availability-checking -g -c %s -o %t/out.o
2+
// RUN: %target-swift-frontend -parse-as-library -enable-experimental-move-only -disable-availability-checking -g -emit-sil -o - %s | %FileCheck -check-prefix=SIL %s
3+
// RUN: %target-swift-frontend -parse-as-library -enable-experimental-move-only -disable-availability-checking -g -emit-ir -o - %s | %FileCheck %s
4+
// RUN: %target-swift-frontend -parse-as-library -enable-experimental-move-only -disable-availability-checking -g -c %s -o %t/out.o
55
// RUN: %llvm-dwarfdump --show-children %t/out.o | %FileCheck -check-prefix=DWARF %s
66

77
// This test checks that:

test/Parse/move_expr.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -disable-availability-checking
1+
// RUN: %target-typecheck-verify-swift -disable-availability-checking -enable-experimental-move-only
22

33
var global: Int = 5
44
func testGlobal() {

test/Sema/move_expr.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -disable-availability-checking
1+
// RUN: %target-typecheck-verify-swift -disable-availability-checking -enable-experimental-move-only
22

33
class Klass {
44
var k: Klass? = nil

test/stdlib/LifetimeManagement.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift
1+
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-move-only)
22

33
// REQUIRES: executable_test
44

test/stdlib/move_function.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-stdlib-swift(-Xllvm -sil-disable-pass=DestroyHoisting)
1+
// RUN: %target-run-stdlib-swift(-Xllvm -sil-disable-pass=DestroyHoisting -Xfrontend -enable-experimental-move-only)
22
//
33
// NOTE ON ABOVE: I am disabling destroy hoisting on this test since we are
44
// going to move it out of the mandatory pipeline eventually and it causes the

0 commit comments

Comments
 (0)