From d87b791f96c18fb7bedd89969b32fc4cf6e47c89 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Wed, 25 Oct 2023 13:29:20 -0700 Subject: [PATCH] Revert "Make the DWARF version configurable." --- Sources/SwiftDriver/Driver/DebugInfo.swift | 5 +---- Sources/SwiftDriver/Driver/Driver.swift | 12 +----------- Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift | 1 - Sources/SwiftOptions/Options.swift | 2 -- Tests/SwiftDriverTests/SwiftDriverTests.swift | 13 ------------- 5 files changed, 2 insertions(+), 31 deletions(-) diff --git a/Sources/SwiftDriver/Driver/DebugInfo.swift b/Sources/SwiftDriver/Driver/DebugInfo.swift index 2f8bdd859..92c131501 100644 --- a/Sources/SwiftDriver/Driver/DebugInfo.swift +++ b/Sources/SwiftDriver/Driver/DebugInfo.swift @@ -41,12 +41,9 @@ } } - /// The format of debug information. + // The format of debug information. public let format: Format - /// The DWARF standard version to be produced. - public let dwarfVersion: UInt8 - /// The level of debug information. public let level: Level? diff --git a/Sources/SwiftDriver/Driver/Driver.swift b/Sources/SwiftDriver/Driver/Driver.swift index 45ca4f6bf..642910ab5 100644 --- a/Sources/SwiftDriver/Driver/Driver.swift +++ b/Sources/SwiftDriver/Driver/Driver.swift @@ -2308,17 +2308,7 @@ extension Driver { diagnosticsEngine.emit(.error_argument_not_allowed_with(arg: fullNotAllowedOption, other: levelOption.spelling)) } - // Determine the DWARF version. - var dwarfVersion: UInt8 = 4 - if let versionArg = parsedOptions.getLastArgument(.dwarfVersion) { - if let parsedVersion = UInt8(versionArg.asSingle), parsedVersion >= 2 && parsedVersion <= 5 { - dwarfVersion = parsedVersion - } else { - diagnosticsEngine.emit(.error_invalid_arg_value(arg: .dwarfVersion, value: versionArg.asSingle)) - } - } - - return DebugInfo(format: format, dwarfVersion: dwarfVersion, level: level, shouldVerify: shouldVerify) + return DebugInfo(format: format, level: level, shouldVerify: shouldVerify) } /// Parses the set of `-sanitize={sanitizer}` arguments and returns all the diff --git a/Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift b/Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift index 25d8f5112..9050e3f49 100644 --- a/Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift +++ b/Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift @@ -193,7 +193,6 @@ extension Driver { try commandLine.appendLast(.enablePrivateImports, from: &parsedOptions) try commandLine.appendLast(in: .g, from: &parsedOptions) try commandLine.appendLast(.debugInfoFormat, from: &parsedOptions) - try commandLine.appendLast(.dwarfVersion, from: &parsedOptions) try commandLine.appendLast(.importUnderlyingModule, from: &parsedOptions) try commandLine.appendLast(.moduleCachePath, from: &parsedOptions) try commandLine.appendLast(.moduleLinkName, from: &parsedOptions) diff --git a/Sources/SwiftOptions/Options.swift b/Sources/SwiftOptions/Options.swift index 9e8a5b269..5622ecda2 100644 --- a/Sources/SwiftOptions/Options.swift +++ b/Sources/SwiftOptions/Options.swift @@ -111,7 +111,6 @@ extension Option { public static let debugForbidTypecheckPrefix: Option = Option("-debug-forbid-typecheck-prefix", .separate, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Triggers llvm fatal_error if typechecker tries to typecheck a decl with the provided prefix name") public static let debugGenericSignatures: Option = Option("-debug-generic-signatures", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Debug generic signatures") public static let debugInfoFormat: Option = Option("-debug-info-format=", .joined, attributes: [.frontend], helpText: "Specify the debug info format type to either 'dwarf' or 'codeview'") - public static let dwarfVersion: Option = Option("-dwarf-version=", .joined, attributes: [.frontend], helpText: "DWARF debug info version to produce if requested") public static let debugInfoStoreInvocation: Option = Option("-debug-info-store-invocation", .flag, attributes: [.frontend], helpText: "Emit the compiler invocation in the debug info.") public static let debugMapping: Option = Option("-debug-mapping", .flag, attributes: [.noDriver], helpText: "Dumping information for debug purposes") public static let debugMapping_: Option = Option("--debug-mapping", .flag, alias: Option.debugMapping, attributes: [.noDriver], helpText: "Dumping information for debug purposes") @@ -929,7 +928,6 @@ extension Option { Option.debugForbidTypecheckPrefix, Option.debugGenericSignatures, Option.debugInfoFormat, - Option.dwarfVersion, Option.debugInfoStoreInvocation, Option.debugMapping, Option.debugMapping_, diff --git a/Tests/SwiftDriverTests/SwiftDriverTests.swift b/Tests/SwiftDriverTests/SwiftDriverTests.swift index 000ef6b26..a5af8471d 100644 --- a/Tests/SwiftDriverTests/SwiftDriverTests.swift +++ b/Tests/SwiftDriverTests/SwiftDriverTests.swift @@ -574,19 +574,6 @@ final class SwiftDriverTests: XCTestCase { $1.expect(.error("argument '-debug-info-format=codeview' is not allowed with '-gdwarf-types'")) } - try assertDriverDiagnostics(args: "swiftc", "foo.swift", "-emit-module", "-dwarf-version=0") { - $1.expect(.error("invalid value '0' in '-dwarf-version=")) - } - - try assertDriverDiagnostics(args: "swiftc", "foo.swift", "-emit-module", "-dwarf-version=6") { - $1.expect(.error("invalid value '6' in '-dwarf-version=")) - } - - try assertNoDriverDiagnostics(args: "swiftc", "foo.swift", "-emit-module", "-g", "-debug-info-format=dwarf", "-dwarf-version=4") { driver in - let jobs = try driver.planBuild() - XCTAssertTrue(jobs[0].commandLine.contains(.flag("-dwarf-version=4"))) - } - try assertNoDriverDiagnostics(args: "swiftc", "foo.swift", "-g", "-c", "-file-compilation-dir", ".") { driver in let jobs = try driver.planBuild() XCTAssertTrue(jobs[0].commandLine.contains(.flag("-file-compilation-dir")))