|
101 | 101 | // INFERRED_NAMED_DARWIN tests above: 'libLINKER.dylib'.
|
102 | 102 | // RUN: %swiftc_driver -sdk "" -driver-print-jobs -target x86_64-apple-macosx10.9 -emit-library %s -o libLINKER.dylib | %FileCheck -check-prefix INFERRED_NAME_DARWIN %s
|
103 | 103 |
|
| 104 | +// On Darwin, when C++ interop is turned on, we link against libc++ explicitly |
| 105 | +// regardless of whether -experimental-cxx-stdlib is specified or not. So also |
| 106 | +// run a test where C++ interop is turned off to make sure we don't link |
| 107 | +// against libc++ in this case. |
| 108 | +// RUN: %swiftc_driver -sdk "" -driver-print-jobs -target x86_64-apple-ios7.1 %s 2>&1 | %FileCheck -check-prefix IOS-no-cxx-interop %s |
| 109 | +// RUN: %swiftc_driver -sdk "" -driver-print-jobs -target x86_64-apple-ios7.1 -enable-experimental-cxx-interop %s 2>&1 | %FileCheck -check-prefix IOS-cxx-interop-libcxx %s |
| 110 | +// RUN: %swiftc_driver -sdk "" -driver-print-jobs -target x86_64-apple-ios7.1 -enable-experimental-cxx-interop -experimental-cxx-stdlib libc++ %s 2>&1 | %FileCheck -check-prefix IOS-cxx-interop-libcxx %s |
| 111 | +// RUN: not %swiftc_driver -sdk "" -driver-print-jobs -target x86_64-apple-ios7.1 -enable-experimental-cxx-interop -experimental-cxx-stdlib libstdc++ %s 2>&1 | %FileCheck -check-prefix IOS-cxx-interop-libstdcxx %s |
| 112 | + |
| 113 | +// RUN: %swiftc_driver -sdk "" -driver-print-jobs -target x86_64-unknown-linux-gnu -enable-experimental-cxx-interop %s 2>&1 | %FileCheck -check-prefix LINUX-cxx-interop %s |
| 114 | +// RUN: %swiftc_driver -sdk "" -driver-print-jobs -target x86_64-unknown-linux-gnu -enable-experimental-cxx-interop -experimental-cxx-stdlib libc++ %s 2>&1 | %FileCheck -check-prefix LINUX-cxx-interop-libcxx %s |
| 115 | + |
| 116 | +// RUN: %swiftc_driver -sdk "" -driver-print-jobs -target x86_64-unknown-windows-msvc -enable-experimental-cxx-interop %s 2>&1 | %FileCheck -check-prefix WINDOWS-cxx-interop %s |
| 117 | +// RUN: %swiftc_driver -sdk "" -driver-print-jobs -target x86_64-unknown-windows-msvc -enable-experimental-cxx-interop -experimental-cxx-stdlib libc++ %s 2>&1 | %FileCheck -check-prefix WINDOWS-cxx-interop-libcxx %s |
| 118 | + |
104 | 119 | // Check reading the SDKSettings.json from an SDK
|
105 | 120 | // RUN: %swiftc_driver -sdk "" -driver-print-jobs -target x86_64-apple-macosx10.9 -sdk %S/Inputs/MacOSX10.15.versioned.sdk %s 2>&1 | %FileCheck -check-prefix MACOS_10_15 %s
|
106 | 121 | // RUN: %swiftc_driver -sdk "" -driver-print-jobs -target x86_64-apple-macosx10.9 -sdk %S/Inputs/MacOSX10.15.4.versioned.sdk %s 2>&1 | %FileCheck -check-prefix MACOS_10_15_4 %s
|
|
424 | 439 | // INFERRED_NAME_WINDOWS: -o LINKER.dll
|
425 | 440 | // INFERRED_NAME_WASI: -o libLINKER.so
|
426 | 441 |
|
| 442 | +// Instead of a single "NOT" check for this run, we would really want to check |
| 443 | +// for all of the driver arguments that we _do_ expect, and then use an |
| 444 | +// --implicit-check-not to check that -lc++ doesn't occur. |
| 445 | +// However, --implicit-check-not has a bug where it fails to flag the |
| 446 | +// unexpected text when it occurs after text matched by a CHECK-DAG; see |
| 447 | +// https://bugs.llvm.org/show_bug.cgi?id=45629 |
| 448 | +// For this reason, we use a single "NOT" check for the time being here. |
| 449 | +// The same consideration applies to the Linux and Windows cases below. |
| 450 | +// IOS-no-cxx-interop-NOT: -lc++ |
| 451 | + |
| 452 | +// IOS-cxx-interop-libcxx: swift |
| 453 | +// IOS-cxx-interop-libcxx-DAG: -enable-cxx-interop |
| 454 | +// IOS-cxx-interop-libcxx-DAG: -o [[OBJECTFILE:.*]] |
| 455 | + |
| 456 | +// IOS-cxx-interop-libcxx: {{(bin/)?}}ld{{"? }} |
| 457 | +// IOS-cxx-interop-libcxx-DAG: [[OBJECTFILE]] |
| 458 | +// IOS-cxx-interop-libcxx-DAG: -lc++ |
| 459 | +// IOS-cxx-interop-libcxx: -o linker |
| 460 | + |
| 461 | +// IOS-cxx-interop-libstdcxx: error: The only C++ standard library supported on Apple platforms is libc++ |
| 462 | + |
| 463 | +// LINUX-cxx-interop-NOT: -stdlib |
| 464 | + |
| 465 | +// LINUX-cxx-interop-libcxx: swift |
| 466 | +// LINUX-cxx-interop-libcxx-DAG: -enable-cxx-interop |
| 467 | +// LINUX-cxx-interop-libcxx-DAG: -o [[OBJECTFILE:.*]] |
| 468 | + |
| 469 | +// LINUX-cxx-interop-libcxx: clang++{{(\.exe)?"? }} |
| 470 | +// LINUX-cxx-interop-libcxx-DAG: [[OBJECTFILE]] |
| 471 | +// LINUX-cxx-interop-libcxx-DAG: -stdlib=libc++ |
| 472 | +// LINUX-cxx-interop-libcxx: -o linker |
| 473 | + |
| 474 | +// WINDOWS-cxx-interop-NOT: -stdlib |
| 475 | + |
| 476 | +// WINDOWS-cxx-interop-libcxx: swift |
| 477 | +// WINDOWS-cxx-interop-libcxx-DAG: -enable-cxx-interop |
| 478 | +// WINDOWS-cxx-interop-libcxx-DAG: -o [[OBJECTFILE:.*]] |
| 479 | + |
| 480 | +// WINDOWS-cxx-interop-libcxx: clang++{{(\.exe)?"? }} |
| 481 | +// WINDOWS-cxx-interop-libcxx-DAG: [[OBJECTFILE]] |
| 482 | +// WINDOWS-cxx-interop-libcxx-DAG: -stdlib=libc++ |
| 483 | +// WINDOWS-cxx-interop-libcxx: -o linker |
| 484 | + |
427 | 485 | // Test ld detection. We use hard links to make sure
|
428 | 486 | // the Swift driver really thinks it's been moved.
|
429 | 487 |
|
|
0 commit comments