Skip to content

Revert "Make the DWARF version configurable." #1473

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions Sources/SwiftDriver/Driver/DebugInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down
12 changes: 1 addition & 11 deletions Sources/SwiftDriver/Driver/Driver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions Sources/SwiftOptions/Options.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -929,7 +928,6 @@ extension Option {
Option.debugForbidTypecheckPrefix,
Option.debugGenericSignatures,
Option.debugInfoFormat,
Option.dwarfVersion,
Option.debugInfoStoreInvocation,
Option.debugMapping,
Option.debugMapping_,
Expand Down
13 changes: 0 additions & 13 deletions Tests/SwiftDriverTests/SwiftDriverTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")))
Expand Down