mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This change adds a module map for libstdc++, which allows it to be properly imported into Swift as a module. The module map is installed into `usr/lib/swift/linux/{arch}` similarly to `glibc.modulemap`, and is passed to Clang as `-fmodule-map-file`.
That means it is now possible to import std directly from Swift on Linux, when C++ interop is enabled.
The module map currently declares a single `std` module without splitting the headers into submodules. This is going to change in the near future.
rdar://87654514
32 lines
1.8 KiB
Swift
32 lines
1.8 KiB
Swift
// RUN: %target-swift-ide-test -print-module -module-to-print=std -source-filename=x -enable-experimental-cxx-interop -tools-directory=%llvm_obj_root/bin -module-cache-path %t | %FileCheck %s -check-prefix=CHECK-STD
|
|
// RUN: %target-swift-ide-test -print-module -module-to-print=std.iosfwd -source-filename=x -enable-experimental-cxx-interop -tools-directory=%llvm_obj_root/bin -module-cache-path %t | %FileCheck %s -check-prefix=CHECK-IOSFWD
|
|
// RUN: %target-swift-ide-test -print-module -module-to-print=std.string -source-filename=x -enable-experimental-cxx-interop -tools-directory=%llvm_obj_root/bin -module-cache-path %t | %FileCheck %s -check-prefix=CHECK-STRING
|
|
|
|
// This test is specific to libc++ and therefore only runs on Darwin platforms.
|
|
// REQUIRES: OS=macosx || OS=ios
|
|
|
|
// REQUIRES: rdar84036022
|
|
|
|
// CHECK-STD: import std.iosfwd
|
|
// CHECK-STD: import std.string
|
|
|
|
// CHECK-IOSFWD: extension std.__1 {
|
|
// CHECK-IOSFWD: struct __CxxTemplateInstNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE {
|
|
// CHECK-IOSFWD: typealias value_type = CChar
|
|
// CHECK-IOSFWD: }
|
|
// CHECK-IOSFWD: struct __CxxTemplateInstNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEE {
|
|
// CHECK-IOSFWD: typealias value_type = CWideChar
|
|
// CHECK-IOSFWD: }
|
|
// CHECK-IOSFWD: typealias string = std.__1.__CxxTemplateInstNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
|
|
// CHECK-IOSFWD: typealias wstring = std.__1.__CxxTemplateInstNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEE
|
|
// CHECK-IOSFWD: }
|
|
|
|
// CHECK-STRING: extension std.__1 {
|
|
// CHECK-STRING: static func to_string(_ __val: Int32) -> std.__1.string
|
|
// CHECK-STRING: static func to_wstring(_ __val: Int32) -> std.__1.wstring
|
|
// CHECK-STRING: }
|
|
|
|
// CHECK-IOSFWD-NOT: static func to_string
|
|
// CHECK-STRING-NOT: typealias string
|
|
// CHECK-STD-NOT: extension std
|