mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[cxx-interop] Allow compiling with libc++ on Linux
This makes sure that Swift respects `-Xcc -stdlib=libc++` flags. Clang already has existing logic to discover the system-wide libc++ installation on Linux. We rely on that logic here. Importing a Swift module that was built with a different C++ stdlib is not supported and emits an error. The Cxx module can be imported when compiling with any C++ stdlib. The synthesized conformances, e.g. to CxxRandomAccessCollection also work. However, CxxStdlib currently cannot be imported when compiling with libc++, since on Linux it refers to symbols from libstdc++ which have different mangled names in libc++. rdar://118357548 / https://github.com/swiftlang/swift/issues/69825
This commit is contained in:
@@ -58,7 +58,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
|
||||
/// describe what change you made. The content of this comment isn't important;
|
||||
/// it just ensures a conflict if two people change the module format.
|
||||
/// Don't worry about adhering to the 80-column limit for this line.
|
||||
const uint16_t SWIFTMODULE_VERSION_MINOR = 881; // Changes to LifetimeDependence
|
||||
const uint16_t SWIFTMODULE_VERSION_MINOR = 882; // CXXStdlibKind
|
||||
|
||||
/// A standard hash seed used for all string hashes in a serialized module.
|
||||
///
|
||||
@@ -949,6 +949,7 @@ namespace options_block {
|
||||
HAS_CXX_INTEROPERABILITY_ENABLED,
|
||||
ALLOW_NON_RESILIENT_ACCESS,
|
||||
SERIALIZE_PACKAGE_ENABLED,
|
||||
CXX_STDLIB_KIND,
|
||||
};
|
||||
|
||||
using SDKPathLayout = BCRecordLayout<
|
||||
@@ -1032,6 +1033,11 @@ namespace options_block {
|
||||
HAS_CXX_INTEROPERABILITY_ENABLED
|
||||
>;
|
||||
|
||||
using CXXStdlibKindLayout = BCRecordLayout<
|
||||
CXX_STDLIB_KIND,
|
||||
BCFixed<2>
|
||||
>;
|
||||
|
||||
using AllowNonResilientAccess = BCRecordLayout<
|
||||
ALLOW_NON_RESILIENT_ACCESS
|
||||
>;
|
||||
|
||||
Reference in New Issue
Block a user