Skip to content

Commit e0aac58

Browse files
committed
[cxx-interop] Pull changes from swift-6 compat mode into swift-5.9
This gives projects using C++ interop compat mode 5.9 access to the new features such as virtual methods and move-only types. rdar://126485814 (cherry picked from commit b330376)
1 parent 37e8d26 commit e0aac58

26 files changed

+66
-75
lines changed

include/swift/AST/DiagnosticsClangImporter.def

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,6 @@ ERROR(conforms_to_ambiguous,none,
247247
ERROR(conforms_to_not_protocol,none,
248248
"%0 %1 referenced in protocol conformance '%2' is not a protocol", (DescriptiveDeclKind, ValueDecl *, StringRef))
249249

250-
ERROR(move_only_requires_move_only,none,
251-
"use of noncopyable C++ type '%0' requires -enable-experimental-move-only",
252-
(StringRef))
253-
254250
ERROR(failed_base_method_call_synthesis,none,
255251
"failed to synthesize call to the base method %0 of type %0",
256252
(ValueDecl *, ValueDecl *))

lib/ClangImporter/ImportDecl.cpp

Lines changed: 39 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2192,22 +2192,12 @@ namespace {
21922192
Impl.ImportedDecls[{decl->getCanonicalDecl(), getVersion()}] = result;
21932193

21942194
if (recordHasMoveOnlySemantics(decl)) {
2195-
if (Impl.isCxxInteropCompatVersionAtLeast(6)) {
2196-
if (decl->isInStdNamespace() && decl->getName() == "promise") {
2197-
// Do not import std::promise.
2198-
return nullptr;
2199-
}
2200-
result->getAttrs().add(new (Impl.SwiftContext)
2201-
MoveOnlyAttr(/*Implicit=*/true));
2202-
} else {
2203-
Impl.addImportDiagnostic(
2204-
decl,
2205-
Diagnostic(
2206-
diag::move_only_requires_move_only,
2207-
Impl.SwiftContext.AllocateCopy(decl->getNameAsString())),
2208-
decl->getLocation());
2195+
if (decl->isInStdNamespace() && decl->getName() == "promise") {
2196+
// Do not import std::promise.
22092197
return nullptr;
22102198
}
2199+
result->getAttrs().add(new (Impl.SwiftContext)
2200+
MoveOnlyAttr(/*Implicit=*/true));
22112201
}
22122202

22132203
// FIXME: Figure out what to do with superclasses in C++. One possible
@@ -2658,8 +2648,7 @@ namespace {
26582648
// SemaLookup.cpp).
26592649
if (!decl->isBeingDefined() && !decl->isDependentContext() &&
26602650
areRecordFieldsComplete(decl)) {
2661-
if (decl->hasInheritedConstructor() &&
2662-
Impl.isCxxInteropCompatVersionAtLeast(6)) {
2651+
if (decl->hasInheritedConstructor()) {
26632652
for (auto member : decl->decls()) {
26642653
if (auto usingDecl = dyn_cast<clang::UsingDecl>(member)) {
26652654
for (auto usingShadowDecl : usingDecl->shadows()) {
@@ -2830,14 +2819,12 @@ namespace {
28302819
void
28312820
addExplicitProtocolConformances(NominalTypeDecl *decl,
28322821
const clang::CXXRecordDecl *clangDecl) {
2833-
if (Impl.isCxxInteropCompatVersionAtLeast(6)) {
2834-
// Propagate conforms_to attribute from public base classes.
2835-
for (auto base : clangDecl->bases()) {
2836-
if (base.getAccessSpecifier() != clang::AccessSpecifier::AS_public)
2837-
continue;
2838-
if (auto *baseClangDecl = base.getType()->getAsCXXRecordDecl())
2839-
addExplicitProtocolConformances(decl, baseClangDecl);
2840-
}
2822+
// Propagate conforms_to attribute from public base classes.
2823+
for (auto base : clangDecl->bases()) {
2824+
if (base.getAccessSpecifier() != clang::AccessSpecifier::AS_public)
2825+
continue;
2826+
if (auto *baseClangDecl = base.getType()->getAsCXXRecordDecl())
2827+
addExplicitProtocolConformances(decl, baseClangDecl);
28412828
}
28422829

28432830
if (!clangDecl->hasAttrs())
@@ -3755,39 +3742,34 @@ namespace {
37553742

37563743
if (decl->isVirtual()) {
37573744
if (auto funcDecl = dyn_cast_or_null<FuncDecl>(method)) {
3758-
if (Impl.isCxxInteropCompatVersionAtLeast(6)) {
3759-
if (auto structDecl =
3760-
dyn_cast_or_null<StructDecl>(method->getDeclContext())) {
3761-
// If this is a method of a Swift struct, any possible override of
3762-
// this method would get sliced away, and an invocation would get
3763-
// dispatched statically. This is fine because it matches the C++
3764-
// behavior.
3765-
if (decl->isPure()) {
3766-
// If this is a pure virtual method, we won't have any
3767-
// implementation of it to invoke.
3768-
Impl.markUnavailable(
3769-
funcDecl, "virtual function is not available in Swift "
3770-
"because it is pure");
3771-
}
3772-
} else if (auto classDecl = dyn_cast_or_null<ClassDecl>(
3773-
funcDecl->getDeclContext())) {
3774-
// This is a foreign reference type. Since `class T` on the Swift
3775-
// side is mapped from `T*` on the C++ side, an invocation of a
3776-
// virtual method `t->method()` should get dispatched dynamically.
3777-
// Create a thunk that will perform dynamic dispatch.
3778-
// TODO: we don't have to import the actual `method` in this case,
3779-
// we can just synthesize a thunk and import that instead.
3780-
auto result = synthesizer.makeVirtualMethod(decl);
3781-
if (result) {
3782-
return result;
3783-
} else {
3784-
Impl.markUnavailable(
3785-
funcDecl, "virtual function is not available in Swift");
3786-
}
3745+
if (auto structDecl =
3746+
dyn_cast_or_null<StructDecl>(method->getDeclContext())) {
3747+
// If this is a method of a Swift struct, any possible override of
3748+
// this method would get sliced away, and an invocation would get
3749+
// dispatched statically. This is fine because it matches the C++
3750+
// behavior.
3751+
if (decl->isPure()) {
3752+
// If this is a pure virtual method, we won't have any
3753+
// implementation of it to invoke.
3754+
Impl.markUnavailable(funcDecl,
3755+
"virtual function is not available in Swift "
3756+
"because it is pure");
3757+
}
3758+
} else if (auto classDecl = dyn_cast_or_null<ClassDecl>(
3759+
funcDecl->getDeclContext())) {
3760+
// This is a foreign reference type. Since `class T` on the Swift
3761+
// side is mapped from `T*` on the C++ side, an invocation of a
3762+
// virtual method `t->method()` should get dispatched dynamically.
3763+
// Create a thunk that will perform dynamic dispatch.
3764+
// TODO: we don't have to import the actual `method` in this case,
3765+
// we can just synthesize a thunk and import that instead.
3766+
auto result = synthesizer.makeVirtualMethod(decl);
3767+
if (result) {
3768+
return result;
3769+
} else {
3770+
Impl.markUnavailable(
3771+
funcDecl, "virtual function is not available in Swift");
37873772
}
3788-
} else {
3789-
Impl.markUnavailable(
3790-
funcDecl, "virtual functions are not yet available in Swift");
37913773
}
37923774
}
37933775
}
@@ -4045,8 +4027,7 @@ namespace {
40454027
// 1. Types
40464028
// 2. C++ methods from privately inherited base classes
40474029
if (!isa<clang::TypeDecl>(decl->getTargetDecl()) &&
4048-
!(isa<clang::CXXMethodDecl>(decl->getTargetDecl()) &&
4049-
Impl.isCxxInteropCompatVersionAtLeast(6)))
4030+
!isa<clang::CXXMethodDecl>(decl->getTargetDecl()))
40504031
return nullptr;
40514032
// Constructors (e.g. `using BaseClass::BaseClass`) are handled in
40524033
// VisitCXXRecordDecl, since we need them to determine whether a struct

lib/ClangImporter/ImportType.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2623,7 +2623,6 @@ static ParamDecl *getParameterInfo(ClangImporter::Implementation *impl,
26232623
// (https://github.com/apple/swift/issues/70124)
26242624
if (param->hasDefaultArg() && !isInOut &&
26252625
!isa<clang::CXXConstructorDecl>(param->getDeclContext()) &&
2626-
impl->isCxxInteropCompatVersionAtLeast(6) &&
26272626
impl->isDefaultArgSafeToImport(param)) {
26282627
SwiftDeclSynthesizer synthesizer(*impl);
26292628
if (CallExpr *defaultArgExpr = synthesizer.makeDefaultArgument(

test/Interop/Cxx/class/conforms-to.swift

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
// RUN: %target-swift-frontend %S/Inputs/conforms-to-imported.swift -module-name ImportedModule -emit-module -emit-module-path %t/ImportedModule.swiftmodule
33

44
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -I %t -I %S/Inputs -module-name SwiftTest -enable-experimental-cxx-interop
5-
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -I %t -I %S/Inputs -module-name SwiftTest -cxx-interoperability-mode=swift-6 -D UPCOMING_SWIFT
6-
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -I %t -I %S/Inputs -module-name SwiftTest -cxx-interoperability-mode=upcoming-swift -D UPCOMING_SWIFT
5+
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -I %t -I %S/Inputs -module-name SwiftTest -cxx-interoperability-mode=swift-5.9
6+
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -I %t -I %S/Inputs -module-name SwiftTest -cxx-interoperability-mode=swift-6
7+
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -I %t -I %S/Inputs -module-name SwiftTest -cxx-interoperability-mode=upcoming-swift
78

89
import ConformsTo
910
import ImportedModule
@@ -23,11 +24,9 @@ func callee(_ _: Testable) {
2324
func caller(_ x: HasTest) {
2425
callee(x)
2526
}
26-
#if UPCOMING_SWIFT
2727
func caller(_ x: DerivedFromHasTest) { callee(x) }
2828
func caller(_ x: DerivedFromDerivedFromHasTest) { callee(x) }
2929
func caller(_ x: DerivedFromDerivedFromHasTestWithDuplicateArg) { callee(x) }
30-
#endif
3130

3231
func callee(_ _: Playable) {
3332

@@ -36,7 +35,6 @@ func callee(_ _: Playable) {
3635
func caller(_ x: Playable) {
3736
callee(x)
3837
}
39-
#if UPCOMING_SWIFT
4038
func caller(_ x: DerivedFromHasPlay) { callee(x) }
4139
func caller(_ x: DerivedFromDerivedFromHasPlay) { callee(x) }
4240

@@ -48,15 +46,12 @@ func caller(_ x: DerivedFromHasTestAndPlay) {
4846
callee(x as Testable)
4947
callee(x as Playable)
5048
}
51-
#endif
5249

5350
func callee(_ _: ProtocolFromImportedModule) {
5451
}
5552

5653
func caller(_ x: HasImportedConf) {
5754
callee(x)
5855
}
59-
#if UPCOMING_SWIFT
6056
func caller(_ x: DerivedFromHasImportedConf) { callee(x) }
6157
func caller(_ x: DerivedFromDerivedFromHasImportedConf) { callee(x) }
62-
#endif

test/Interop/Cxx/class/inheritance/using-base-members-typechecker.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -I %S/Inputs -cxx-interoperability-mode=swift-5.9
12
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -I %S/Inputs -cxx-interoperability-mode=swift-6
23
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -I %S/Inputs -cxx-interoperability-mode=upcoming-swift
34

test/Interop/Cxx/class/inheritance/using-base-members.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// RUN: %target-run-simple-swift(-I %S/Inputs/ -Xfrontend -cxx-interoperability-mode=swift-5.9)
12
// RUN: %target-run-simple-swift(-I %S/Inputs/ -Xfrontend -cxx-interoperability-mode=swift-6)
23
// RUN: %target-run-simple-swift(-I %S/Inputs/ -Xfrontend -cxx-interoperability-mode=upcoming-swift)
34
//

test/Interop/Cxx/class/inheritance/virtual-methods-irgen.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %target-swift-emit-ir -I %S/Inputs -cxx-interoperability-mode=upcoming-swift %s -validate-tbd-against-ir=none -Xcc -fignore-exceptions | %FileCheck %s
2+
// RUN: %target-swift-emit-ir -I %S/Inputs -cxx-interoperability-mode=swift-5.9 %s -validate-tbd-against-ir=none -Xcc -fignore-exceptions | %FileCheck %s
23
// RUN: %target-swift-emit-ir -I %S/Inputs -cxx-interoperability-mode=swift-6 %s -validate-tbd-against-ir=none -Xcc -fignore-exceptions | %FileCheck %s
34

45
import VirtualMethods

test/Interop/Cxx/class/inheritance/virtual-methods-module-interface.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// RUN: %target-swift-ide-test -print-module -cxx-interoperability-mode=swift-5.9 -print-implicit-attrs -module-to-print=VirtualMethods -I %S/Inputs -source-filename=x | %FileCheck %s
12
// RUN: %target-swift-ide-test -print-module -cxx-interoperability-mode=swift-6 -print-implicit-attrs -module-to-print=VirtualMethods -I %S/Inputs -source-filename=x | %FileCheck %s
23
// RUN: %target-swift-ide-test -print-module -cxx-interoperability-mode=upcoming-swift -print-implicit-attrs -module-to-print=VirtualMethods -I %S/Inputs -source-filename=x | %FileCheck %s
34

test/Interop/Cxx/class/inheritance/virtual-methods-typechecker.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -I %S/Inputs -cxx-interoperability-mode=upcoming-swift
2+
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -I %S/Inputs -cxx-interoperability-mode=swift-5.9
23
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -I %S/Inputs -cxx-interoperability-mode=swift-6
34

45
import VirtualMethods

test/Interop/Cxx/class/inheritance/virtual-methods.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=swift-5.9)
12
// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=swift-6)
23
// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=upcoming-swift)
34

test/Interop/Cxx/class/move-only/move-only-cxx-value-type.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %target-run-simple-swift(-I %S/Inputs/ -cxx-interoperability-mode=upcoming-swift)
22
// RUN: %target-run-simple-swift(-I %S/Inputs/ -cxx-interoperability-mode=upcoming-swift -enable-experimental-feature NoncopyableGenerics -D HAS_NONCOPYABLE_GENERICS)
3+
// RUN: %target-run-simple-swift(-I %S/Inputs/ -cxx-interoperability-mode=swift-5.9 -O)
34
// RUN: %target-run-simple-swift(-I %S/Inputs/ -cxx-interoperability-mode=swift-6 -O)
45
// RUN: %target-run-simple-swift(-I %S/Inputs/ -cxx-interoperability-mode=swift-6 -O -enable-experimental-feature NoncopyableGenerics -D HAS_NONCOPYABLE_GENERICS)
56

test/Interop/Cxx/class/protocol-conformance-typechecker.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Tests that a C++ class can conform to a Swift protocol.
22

33
// RUN: %target-typecheck-verify-swift -I %S/Inputs -enable-experimental-cxx-interop
4+
// RUN: %target-typecheck-verify-swift -I %S/Inputs -D VIRTUAL_METHODS -cxx-interoperability-mode=swift-5.9
45
// RUN: %target-typecheck-verify-swift -I %S/Inputs -D VIRTUAL_METHODS -cxx-interoperability-mode=swift-6
56
// RUN: %target-typecheck-verify-swift -I %S/Inputs -D VIRTUAL_METHODS -cxx-interoperability-mode=upcoming-swift
67

test/Interop/Cxx/class/type-classification-module-interface.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// RUN: %target-swift-ide-test -print-module -module-to-print=TypeClassification -I %S/Inputs -source-filename=x -cxx-interoperability-mode=swift-5.9 | %FileCheck %s
12
// RUN: %target-swift-ide-test -print-module -module-to-print=TypeClassification -I %S/Inputs -source-filename=x -cxx-interoperability-mode=swift-6 | %FileCheck %s
23
// RUN: %target-swift-ide-test -print-module -module-to-print=TypeClassification -I %S/Inputs -source-filename=x -cxx-interoperability-mode=upcoming-swift | %FileCheck %s
34
// RUN: %target-swift-ide-test -print-module -skip-unsafe-cxx-methods -module-to-print=TypeClassification -I %S/Inputs -source-filename=x -cxx-interoperability-mode=swift-6 | %FileCheck %s -check-prefix=CHECK-SKIP-UNSAFE

test/Interop/Cxx/class/type-classification-typechecker.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// RUN: %target-typecheck-verify-swift -I %S/Inputs -cxx-interoperability-mode=swift-5.9
12
// RUN: %target-typecheck-verify-swift -I %S/Inputs -cxx-interoperability-mode=swift-6
23
// RUN: %target-typecheck-verify-swift -I %S/Inputs -cxx-interoperability-mode=upcoming-swift
34

test/Interop/Cxx/function/default-arguments-irgen.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// RUN: %target-swift-emit-irgen -I %S/Inputs -cxx-interoperability-mode=swift-5.9 %s | %FileCheck %s
12
// RUN: %target-swift-emit-irgen -I %S/Inputs -cxx-interoperability-mode=swift-6 %s | %FileCheck %s
23
// RUN: %target-swift-emit-irgen -I %S/Inputs -cxx-interoperability-mode=upcoming-swift %s | %FileCheck %s
34

test/Interop/Cxx/function/default-arguments-module-interface.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// RUN: %target-swift-ide-test -print-module -module-to-print=DefaultArguments -I %S/Inputs -source-filename=x -cxx-interoperability-mode=swift-5.9 | %FileCheck %s
12
// RUN: %target-swift-ide-test -print-module -module-to-print=DefaultArguments -I %S/Inputs -source-filename=x -cxx-interoperability-mode=swift-6 | %FileCheck %s
23
// RUN: %target-swift-ide-test -print-module -module-to-print=DefaultArguments -I %S/Inputs -source-filename=x -cxx-interoperability-mode=upcoming-swift | %FileCheck %s
34

test/Interop/Cxx/function/default-arguments-typechecker.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -I %S/Inputs -cxx-interoperability-mode=swift-5.9
12
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -I %S/Inputs -cxx-interoperability-mode=swift-6
23
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -I %S/Inputs -cxx-interoperability-mode=upcoming-swift
34

test/Interop/Cxx/operators/member-inline-module-interface.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// RUN: %target-swift-ide-test -print-module -module-to-print=MemberInline -I %S/Inputs -source-filename=x -cxx-interoperability-mode=swift-5.9 | %FileCheck %s
12
// RUN: %target-swift-ide-test -print-module -module-to-print=MemberInline -I %S/Inputs -source-filename=x -cxx-interoperability-mode=swift-6 | %FileCheck %s
23
// RUN: %target-swift-ide-test -print-module -module-to-print=MemberInline -I %S/Inputs -source-filename=x -cxx-interoperability-mode=upcoming-swift | %FileCheck %s
34

test/Interop/Cxx/operators/member-inline-typechecker.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// RUN: %target-typecheck-verify-swift -I %S/Inputs -cxx-interoperability-mode=swift-5.9
12
// RUN: %target-typecheck-verify-swift -I %S/Inputs -cxx-interoperability-mode=swift-6
23
// RUN: %target-typecheck-verify-swift -I %S/Inputs -cxx-interoperability-mode=upcoming-swift
34

test/Interop/Cxx/operators/member-inline.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -cxx-interoperability-mode=swift-5.9)
12
// RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -cxx-interoperability-mode=swift-6)
23
// RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -cxx-interoperability-mode=upcoming-swift)
34
//

test/Interop/Cxx/operators/move-only/move-only-synthesized-properties.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
// RUN: %target-run-simple-swift(-I %S/Inputs/ -cxx-interoperability-mode=swift-5.9)
12
// RUN: %target-run-simple-swift(-I %S/Inputs/ -cxx-interoperability-mode=swift-6)
23
// RUN: %target-run-simple-swift(-I %S/Inputs/ -cxx-interoperability-mode=upcoming-swift)
34
// RUN: %target-run-simple-swift(-I %S/Inputs/ -cxx-interoperability-mode=upcoming-swift -enable-experimental-feature NoncopyableGenerics -D HAS_NONCOPYABLE_GENERICS)
5+
// RUN: %target-run-simple-swift(-I %S/Inputs/ -cxx-interoperability-mode=swift-5.9 -O)
46
// RUN: %target-run-simple-swift(-I %S/Inputs/ -cxx-interoperability-mode=swift-6 -O)
57
// RUN: %target-run-simple-swift(-I %S/Inputs/ -cxx-interoperability-mode=upcoming-swift -O)
68
// RUN: %target-run-simple-swift(-I %S/Inputs/ -cxx-interoperability-mode=upcoming-swift -O -enable-experimental-feature NoncopyableGenerics -D HAS_NONCOPYABLE_GENERICS)

test/Interop/Cxx/operators/move-only/move-only-synthesized-property-typecheck.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// RUN: %target-typecheck-verify-swift -I %S/Inputs -cxx-interoperability-mode=swift-5.9 -DNO_CONSUME
12
// RUN: %target-typecheck-verify-swift -I %S/Inputs -cxx-interoperability-mode=swift-6 -DNO_CONSUME
23
// RUN: %target-typecheck-verify-swift -I %S/Inputs -cxx-interoperability-mode=upcoming-swift -DNO_CONSUME
34

test/Interop/Cxx/stdlib/use-std-chrono.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=swift-5.9)
12
// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=swift-6)
23
// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=upcoming-swift)
34

test/Interop/Cxx/stdlib/use-std-optional.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -cxx-interoperability-mode=swift-5.9 -Xcc -std=c++17)
12
// RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -cxx-interoperability-mode=swift-6 -Xcc -std=c++17)
23
// RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -cxx-interoperability-mode=upcoming-swift -Xcc -std=c++17)
34
//

test/Interop/Cxx/stdlib/use-std-string.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -enable-experimental-cxx-interop)
22
// RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -enable-experimental-cxx-interop -D USE_CUSTOM_STRING_API)
3-
// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=swift-6 -D SUPPORTS_DEFAULT_ARGUMENTS -D USE_CUSTOM_STRING_API)
4-
// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=upcoming-swift -D SUPPORTS_DEFAULT_ARGUMENTS -D USE_CUSTOM_STRING_API)
3+
// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=swift-6 -D USE_CUSTOM_STRING_API)
4+
// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=upcoming-swift -D USE_CUSTOM_STRING_API)
55
//
66
// REQUIRES: executable_test
77

@@ -412,7 +412,6 @@ StdStringTestSuite.test("pass as an argument") {
412412
expectEqual(res[0], 97)
413413
}
414414

415-
#if SUPPORTS_DEFAULT_ARGUMENTS
416415
StdStringTestSuite.test("pass as a default argument") {
417416
let res = takesStringWithDefaultArg()
418417
expectEqual(res.size(), 3)
@@ -421,6 +420,5 @@ StdStringTestSuite.test("pass as a default argument") {
421420
expectEqual(res[2], 99)
422421
}
423422
#endif
424-
#endif
425423

426424
runAllTests()

test/Interop/Cxx/stdlib/use-std-unique-ptr.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=swift-5.9)
12
// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=swift-6)
23
// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=upcoming-swift)
34
//

0 commit comments

Comments
 (0)