|
1 | 1 | // RUN: %empty-directory(%t)
|
2 |
| -// RUN: %target-swift-frontend -I %S/Inputs/CTypes -enable-experimental-feature LayoutStringValueWitnesses -enable-layout-string-value-witnesses -parse-stdlib -emit-module -emit-module-path=%t/layout_string_witnesses_types.swiftmodule %S/Inputs/layout_string_witnesses_types.swift |
| 2 | +// RUN: %target-swift-frontend -O -I %S/Inputs/CTypes -enable-experimental-feature LayoutStringValueWitnesses -enable-layout-string-value-witnesses -parse-stdlib -emit-module -emit-module-path=%t/layout_string_witnesses_types.swiftmodule %S/Inputs/layout_string_witnesses_types.swift |
3 | 3 |
|
4 | 4 | // NOTE: We have to build this as dylib to turn private external symbols into local symbols, so we can observe potential issues with linkage
|
5 |
| -// RUN: %target-build-swift-dylib(%t/%target-library-name(layout_string_witnesses_types)) -I %S/Inputs/CTypes -Xfrontend -enable-experimental-feature -Xfrontend LayoutStringValueWitnesses -Xfrontend -enable-layout-string-value-witnesses -Xfrontend -parse-stdlib -parse-as-library %S/Inputs/layout_string_witnesses_types.swift |
| 5 | +// RUN: %target-build-swift-dylib(%t/%target-library-name(layout_string_witnesses_types)) -O -I %S/Inputs/CTypes -Xfrontend -enable-experimental-feature -Xfrontend LayoutStringValueWitnesses -Xfrontend -enable-layout-string-value-witnesses -Xfrontend -parse-stdlib -parse-as-library %S/Inputs/layout_string_witnesses_types.swift |
6 | 6 | // RUN: %target-codesign %t/%target-library-name(layout_string_witnesses_types)
|
7 |
| -// RUN: %target-swift-frontend -enable-experimental-feature LayoutStringValueWitnesses -enable-layout-string-value-witnesses -enable-library-evolution -emit-module -emit-module-path=%t/layout_string_witnesses_types_resilient.swiftmodule %S/Inputs/layout_string_witnesses_types_resilient.swift |
8 |
| -// RUN: %target-build-swift -g -Xfrontend -enable-experimental-feature -Xfrontend LayoutStringValueWitnesses -Xfrontend -enable-layout-string-value-witnesses -Xfrontend -enable-library-evolution -c -parse-as-library -o %t/layout_string_witnesses_types_resilient.o %S/Inputs/layout_string_witnesses_types_resilient.swift |
9 |
| -// RUN: %target-build-swift -g -Xfrontend -enable-experimental-feature -Xfrontend LayoutStringValueWitnesses -Xfrontend -enable-layout-string-value-witnesses -Xfrontend -enable-type-layout -Xfrontend -parse-stdlib -module-name layout_string_witnesses_static -llayout_string_witnesses_types -L%t %t/layout_string_witnesses_types_resilient.o -I %t -o %t/main %s %target-rpath(%t) |
| 7 | +// RUN: %target-swift-frontend -O -enable-experimental-feature LayoutStringValueWitnesses -enable-layout-string-value-witnesses -enable-library-evolution -emit-module -emit-module-path=%t/layout_string_witnesses_types_resilient.swiftmodule %S/Inputs/layout_string_witnesses_types_resilient.swift |
| 8 | +// RUN: %target-build-swift -O -g -Xfrontend -enable-experimental-feature -Xfrontend LayoutStringValueWitnesses -Xfrontend -enable-layout-string-value-witnesses -Xfrontend -enable-library-evolution -c -parse-as-library -o %t/layout_string_witnesses_types_resilient.o %S/Inputs/layout_string_witnesses_types_resilient.swift |
| 9 | +// RUN: %target-build-swift -O -g -Xfrontend -enable-experimental-feature -Xfrontend LayoutStringValueWitnesses -Xfrontend -enable-layout-string-value-witnesses -Xfrontend -enable-type-layout -Xfrontend -parse-stdlib -module-name layout_string_witnesses_static -llayout_string_witnesses_types -L%t %t/layout_string_witnesses_types_resilient.o -I %t -o %t/main %s %target-rpath(%t) |
10 | 10 | // RUN: %target-codesign %t/main
|
11 | 11 | // RUN: %target-run %t/main %t/%target-library-name(layout_string_witnesses_types) | %FileCheck %s --check-prefix=CHECK -check-prefix=CHECK-%target-os
|
12 | 12 |
|
@@ -1290,6 +1290,35 @@ func testCTypeUnderAligned() {
|
1290 | 1290 |
|
1291 | 1291 | testCTypeUnderAligned()
|
1292 | 1292 |
|
| 1293 | +func testNestedTwoPayload() { |
| 1294 | + let ptr = UnsafeMutablePointer<TwoPayloadOuter>.allocate(capacity: 1) |
| 1295 | + |
| 1296 | + do { |
| 1297 | + let x = TwoPayloadOuter.y(TwoPayloadInner.x(SimpleClass(x: 23))) |
| 1298 | + testInit(ptr, to: x) |
| 1299 | + } |
| 1300 | + |
| 1301 | + do { |
| 1302 | + let y = TwoPayloadOuter.y(TwoPayloadInner.x(SimpleClass(x: 1))) |
| 1303 | + |
| 1304 | + // CHECK: Before deinit |
| 1305 | + print("Before deinit") |
| 1306 | + |
| 1307 | + // CHECK-NEXT: SimpleClass deinitialized! |
| 1308 | + testAssign(ptr, from: y) |
| 1309 | + } |
| 1310 | + |
| 1311 | + // CHECK-NEXT: Before deinit |
| 1312 | + print("Before deinit") |
| 1313 | + |
| 1314 | + // CHECK-NEXT: SimpleClass deinitialized! |
| 1315 | + testDestroy(ptr) |
| 1316 | + |
| 1317 | + ptr.deallocate() |
| 1318 | +} |
| 1319 | + |
| 1320 | +testNestedTwoPayload() |
| 1321 | + |
1293 | 1322 | #if os(macOS)
|
1294 | 1323 | func testObjc() {
|
1295 | 1324 | let ptr = UnsafeMutablePointer<ObjcWrapper>.allocate(capacity: 1)
|
|
0 commit comments