Skip to content

Commit 62d5606

Browse files
committed
[cxx-interop] Disable test with an older runtime
848fad0 introduced support for printing foreign reference types. It changes both the compiler and the runtime, and having the runtime change applied is required for the test to pass. Let's not try to run it with an old runtime. This change also splits up a test for printing of value types from a test for printing of foreign reference types, since we don't have any runtime restrictions for value types. rdar://153205860
1 parent b8f5a36 commit 62d5606

File tree

5 files changed

+82
-68
lines changed

5 files changed

+82
-68
lines changed

test/Interop/Cxx/class/Inputs/simple-structs.h

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -52,38 +52,4 @@ struct Outer {
5252
Outer() : privStruct(1, 2, 3, 4, 5, 6), publStruct(7, 8, 9, 10, 11, 12) {}
5353
};
5454

55-
struct ImmortalFRT {
56-
private:
57-
int priv = 1;
58-
59-
public:
60-
int publ = 2;
61-
} __attribute__((swift_attr("import_reference")))
62-
__attribute__((swift_attr("retain:immortal")))
63-
__attribute__((swift_attr("release:immortal")));
64-
65-
struct FRTCustomStringConvertible {
66-
public:
67-
private:
68-
int priv = 1;
69-
70-
public:
71-
int publ = 2;
72-
} __attribute__((swift_attr("import_reference")))
73-
__attribute__((swift_attr("retain:immortal")))
74-
__attribute__((swift_attr("release:immortal")));
75-
76-
struct FRType {
77-
private:
78-
int priv = 1;
79-
80-
public:
81-
int publ = 2;
82-
} __attribute__((swift_attr("import_reference")))
83-
__attribute__((swift_attr("retain:retain")))
84-
__attribute__((swift_attr("release:release")));
85-
86-
void retain(FRType *v) {};
87-
void release(FRType *v) {};
88-
8955
#endif
Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
// RUN: %target-run-simple-swift(-cxx-interoperability-mode=default -Xfrontend -disable-availability-checking -I %S/Inputs) | %FileCheck %s
1+
// RUN: %target-run-simple-swift(-cxx-interoperability-mode=default -I %S/Inputs) | %FileCheck %s
22

33
// REQUIRES: executable_test
4-
// Metadata for foreign reference types is not supported on Windows.
5-
// UNSUPPORTED: OS=windows-msvc
64

75
import SimpleStructs
86

@@ -26,28 +24,6 @@ func printCxxStructNested() {
2624
print(s)
2725
}
2826

29-
func printCxxImmortalFRT() {
30-
let s = ImmortalFRT()
31-
print(s)
32-
}
33-
34-
extension FRTCustomStringConvertible : CustomStringConvertible {
35-
public var description: String {
36-
return "FRTCustomStringConvertible(publ: \(publ))"
37-
}
38-
}
39-
40-
func printCxxFRTCustomStringConvertible() {
41-
let s = FRTCustomStringConvertible()
42-
print(s)
43-
}
44-
45-
func printCxxFRType() {
46-
let s = FRType()
47-
print(s)
48-
}
49-
50-
5127
printCxxStructPrivateFields()
5228
// CHECK: HasPrivateFieldsOnly()
5329

@@ -59,12 +35,3 @@ printCxxStructPrivatePublicProtectedFields()
5935

6036
printCxxStructNested()
6137
// CHECK: Outer(publStruct: {{.*}}.HasPrivatePublicProtectedFields(publ1: 8, publ2: 12))
62-
63-
printCxxImmortalFRT()
64-
// CHECK: ImmortalFRT()
65-
66-
printCxxFRTCustomStringConvertible()
67-
// CHECK: FRTCustomStringConvertible(publ: 2)
68-
69-
printCxxFRType()
70-
// CHECK: FRType()

test/Interop/Cxx/foreign-reference/Inputs/module.modulemap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,8 @@ module FunctionsAndMethodsReturningFRT {
6363
header "cxx-functions-and-methods-returning-frt.h"
6464
requires cplusplus
6565
}
66+
67+
module Printed {
68+
header "printed.h"
69+
requires cplusplus
70+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
struct ImmortalFRT {
2+
private:
3+
int priv = 1;
4+
5+
public:
6+
int publ = 2;
7+
} __attribute__((swift_attr("import_reference")))
8+
__attribute__((swift_attr("retain:immortal")))
9+
__attribute__((swift_attr("release:immortal")));
10+
11+
struct FRTCustomStringConvertible {
12+
public:
13+
private:
14+
int priv = 1;
15+
16+
public:
17+
int publ = 2;
18+
} __attribute__((swift_attr("import_reference")))
19+
__attribute__((swift_attr("retain:immortal")))
20+
__attribute__((swift_attr("release:immortal")));
21+
22+
struct FRType {
23+
private:
24+
int priv = 1;
25+
26+
public:
27+
int publ = 2;
28+
} __attribute__((swift_attr("import_reference")))
29+
__attribute__((swift_attr("retain:retain")))
30+
__attribute__((swift_attr("release:release")));
31+
32+
void retain(FRType *v) {};
33+
void release(FRType *v) {};
34+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// RUN: %target-run-simple-swift(-cxx-interoperability-mode=default -Xfrontend -disable-availability-checking -I %S/Inputs) | %FileCheck %s
2+
3+
// REQUIRES: executable_test
4+
5+
// Metadata for foreign reference types is not supported on Windows.
6+
// UNSUPPORTED: OS=windows-msvc
7+
8+
// Temporarily disable when running with an older runtime (rdar://153205860)
9+
// UNSUPPORTED: use_os_stdlib
10+
// UNSUPPORTED: back_deployment_runtime
11+
12+
import Printed
13+
14+
func printCxxImmortalFRT() {
15+
let s = ImmortalFRT()
16+
print(s)
17+
}
18+
19+
extension FRTCustomStringConvertible : CustomStringConvertible {
20+
public var description: String {
21+
return "FRTCustomStringConvertible(publ: \(publ))"
22+
}
23+
}
24+
25+
func printCxxFRTCustomStringConvertible() {
26+
let s = FRTCustomStringConvertible()
27+
print(s)
28+
}
29+
30+
func printCxxFRType() {
31+
let s = FRType()
32+
print(s)
33+
}
34+
35+
printCxxImmortalFRT()
36+
// CHECK: ImmortalFRT()
37+
38+
printCxxFRTCustomStringConvertible()
39+
// CHECK: FRTCustomStringConvertible(publ: 2)
40+
41+
printCxxFRType()
42+
// CHECK: FRType()

0 commit comments

Comments
 (0)