Skip to content

Commit e548e86

Browse files
committed
[cxx-interop] Remove -experimental-cxx-stdlib flag
This change is a counterpart of swiftlang/swift#76280.
1 parent 088ac1d commit e548e86

File tree

5 files changed

+0
-39
lines changed

5 files changed

+0
-39
lines changed

Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,6 @@ extension Driver {
136136
// Add flags for C++ interop
137137
try commandLine.appendLast(.enableExperimentalCxxInterop, from: &parsedOptions)
138138
try commandLine.appendLast(.cxxInteroperabilityMode, from: &parsedOptions)
139-
if let stdlibVariant = parsedOptions.getLastArgument(.experimentalCxxStdlib)?.asSingle {
140-
appendXccFlag("-stdlib=\(stdlibVariant)")
141-
}
142139

143140
if isEmbeddedEnabled && parsedOptions.hasArgument(.enableLibraryEvolution) {
144141
diagnosticEngine.emit(.error_no_library_evolution_embedded)

Sources/SwiftDriver/Jobs/WindowsToolchain+LinkerSupport.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,6 @@ extension WindowsToolchain {
202202
commandLine.appendPath(VirtualPath.lookup(sdkPath))
203203
}
204204

205-
if let stdlib = parsedOptions.getLastArgument(.experimentalCxxStdlib) {
206-
commandLine.appendFlag("-stdlib=\(stdlib.asSingle)")
207-
}
208-
209205
// Pass down an optimization level
210206
if let optArg = mapOptimizationLevelToClangArg(from: &parsedOptions) {
211207
commandLine.appendFlag(optArg)

Sources/SwiftDriver/Toolchains/DarwinToolchain.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ public final class DarwinToolchain: Toolchain {
165165
case argumentNotSupported(String)
166166
case invalidDeploymentTargetForIR(platform: DarwinPlatform, version: Triple.Version, archName: String)
167167
case unsupportedTargetVariant(variant: Triple)
168-
case darwinOnlySupportsLibCxx
169168

170169
public var description: String {
171170
switch self {
@@ -177,8 +176,6 @@ public final class DarwinToolchain: Toolchain {
177176
return "unsupported '\(variant.isiOS ? "-target-variant" : "-target")' value '\(variant.triple)'; use 'ios-macabi' instead"
178177
case .argumentNotSupported(let argument):
179178
return "\(argument) is no longer supported for Apple platforms"
180-
case .darwinOnlySupportsLibCxx:
181-
return "The only C++ standard library supported on Apple platforms is libc++"
182179
}
183180
}
184181
}
@@ -211,12 +208,6 @@ public final class DarwinToolchain: Toolchain {
211208
if parsedOptions.hasArgument(.staticExecutable) {
212209
throw ToolchainValidationError.argumentNotSupported("-static-executable")
213210
}
214-
// If a C++ standard library is specified, it has to be libc++.
215-
if let cxxLib = parsedOptions.getLastArgument(.experimentalCxxStdlib) {
216-
if cxxLib.asSingle != "libc++" {
217-
throw ToolchainValidationError.darwinOnlySupportsLibCxx
218-
}
219-
}
220211
}
221212

222213
public func getDefaultDwarfVersion(targetTriple: Triple) -> UInt8 {

Sources/SwiftOptions/Options.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,6 @@ extension Option {
478478
public static let experimentalAllowedReexportedModules: Option = Option("-experimental-allowed-reexported-modules=", .commaJoined, attributes: [.noDriver], helpText: "Allow reexporting symbols from the provided modules if they are themselves exported from the main module. This is a comma separated list of module names.")
479479
public static let experimentalCForeignReferenceTypes: Option = Option("-experimental-c-foreign-reference-types", .flag, attributes: [.helpHidden, .frontend, .moduleInterface], helpText: "Enable experimental C foreign references types (with reference counting).")
480480
public static let experimentalClangImporterDirectCc1Scan: Option = Option("-experimental-clang-importer-direct-cc1-scan", .flag, attributes: [.helpHidden, .frontend], helpText: "Enables swift driver to construct swift-frontend invocations using -direct-clang-cc1-module-build")
481-
public static let experimentalCxxStdlib: Option = Option("-experimental-cxx-stdlib", .separate, attributes: [.helpHidden], helpText: "C++ standard library to use; forwarded to Clang's -stdlib flag")
482481
public static let emitModuleSeparately: Option = Option("-experimental-emit-module-separately", .flag, attributes: [.helpHidden], helpText: "Emit module files as a distinct job")
483482
public static let driverExperimentalExplicitModuleBuild: Option = Option("-experimental-explicit-module-build", .flag, alias: Option.driverExplicitModuleBuild, attributes: [.helpHidden], helpText: "Prebuild module dependencies to make them explicit")
484483
public static let forceWorkaroundBrokenModules: Option = Option("-experimental-force-workaround-broken-modules", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Attempt unsafe recovery for imported modules with broken modularization")
@@ -1351,7 +1350,6 @@ extension Option {
13511350
Option.experimentalAllowedReexportedModules,
13521351
Option.experimentalCForeignReferenceTypes,
13531352
Option.experimentalClangImporterDirectCc1Scan,
1354-
Option.experimentalCxxStdlib,
13551353
Option.emitModuleSeparately,
13561354
Option.driverExperimentalExplicitModuleBuild,
13571355
Option.forceWorkaroundBrokenModules,

Tests/SwiftDriverTests/SwiftDriverTests.swift

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4281,14 +4281,6 @@ final class SwiftDriverTests: XCTestCase {
42814281
}
42824282
}
42834283

4284-
XCTAssertThrowsError(try Driver(args: ["swiftc", "-c", "-target", "x86_64-apple-macosx10.14", "-experimental-cxx-stdlib", "libstdc++",
4285-
"foo.swift"])) { error in
4286-
guard case DarwinToolchain.ToolchainValidationError.darwinOnlySupportsLibCxx = error else {
4287-
XCTFail("Unexpected error: \(error)")
4288-
return
4289-
}
4290-
}
4291-
42924284
// Not actually a valid arch for tvOS, but we shouldn't fall into the iOS case by mistake and emit a message about iOS >= 11 not supporting armv7.
42934285
XCTAssertNoThrow(try Driver(args: ["swiftc", "-c", "-target", "armv7-apple-tvos9.0", "foo.swift"]))
42944286

@@ -6826,19 +6818,6 @@ final class SwiftDriverTests: XCTestCase {
68266818
XCTAssertTrue(linkJob.commandLine.contains(.flag("-lc++")))
68276819
}
68286820
}
6829-
do {
6830-
var driver = try Driver(args: ["swiftc", "-cxx-interoperability-mode=swift-5.9",
6831-
"-experimental-cxx-stdlib", "libc++", "foo.swift"])
6832-
let plannedJobs = try driver.planBuild().removingAutolinkExtractJobs()
6833-
XCTAssertEqual(plannedJobs.count, 2)
6834-
let compileJob = plannedJobs[0]
6835-
let linkJob = plannedJobs[1]
6836-
XCTAssertTrue(compileJob.commandLine.contains(.flag("-cxx-interoperability-mode=swift-5.9")))
6837-
XCTAssertTrue(compileJob.commandLine.contains(.flag("-stdlib=libc++")))
6838-
if driver.targetTriple.isDarwin {
6839-
XCTAssertTrue(linkJob.commandLine.contains(.flag("-lc++")))
6840-
}
6841-
}
68426821
}
68436822

68446823
func testEmbeddedSwiftOptions() throws {

0 commit comments

Comments
 (0)