Skip to content
Open
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
6 changes: 6 additions & 0 deletions Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ extension Driver {
jobNeedPathRemap = false
}

if isPlanJobForExplicitModule && kind == .compile,
let explicitModulePlanner {
let mainModule = explicitModulePlanner.dependencyGraph.mainModule
try addPathOption(option: .debugModulePath, path: VirtualPath.lookup(mainModule.modulePath.path), to: &commandLine, remap: jobNeedPathRemap)
}

// Check if dependency scanner has put the job into direct clang cc1 mode.
// If dependency scanner put us into direct cc1 mode, avoid adding `-Xcc` options, since
// dependency scanner already adds needed flags and -Xcc options known by swift-driver are
Expand Down
4 changes: 4 additions & 0 deletions Sources/SwiftOptions/Options.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ extension Option {
public static let debugInverseRequirements: Option = Option("-debug-inverse-requirements", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Print real requirements in -debug-generic-signatures output")
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")
public static let debugModulePathEQ: Option = Option("-debug-module-path=", .joined, alias: Option.debugModulePathEQ, attributes: [.frontend])
public static let debugModulePath: Option = Option("-debug-module-path", .separate, attributes: [.frontend], helpText: "Path to this module's binary swiftmodule artifact (required by debug info)")
public static let debugPrefixMap: Option = Option("-debug-prefix-map", .separate, attributes: [.frontend], metaVar: "<prefix=replacement>", helpText: "Remap source paths in debug info")
public static let debugRequirementMachine: Option = Option("-debug-requirement-machine=", .joined, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Fine-grained debug output from the generics implementation")
public static let debugTimeExpressionTypeChecking: Option = Option("-debug-time-expression-type-checking", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Dumps the time it takes to type-check each expression")
Expand Down Expand Up @@ -1554,6 +1556,8 @@ extension Option {
Option.explicitAutoLinking,
Option.explicitDependencyGraphFormat,
Option.explicitInterfaceModuleBuild,
Option.debugModulePathEQ,
Option.debugModulePath,
Option.driverExplicitModuleBuild,
Option.explicitSwiftModuleMap,
Option.exportAs,
Expand Down
4 changes: 4 additions & 0 deletions Tests/SwiftDriverTests/ExplicitModuleBuildTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,10 @@ final class ExplicitModuleBuildTests: XCTestCase {
for job in jobs {
XCTAssertEqual(job.outputs.count, 1)
let outputFilePath = job.outputs[0].file
if job.kind == .compile {
XCTAssertTrue(job.commandLine.contains(subsequence: ["-debug-module-path", try toPathOption("testExplicitModuleBuildJobs.swiftmodule")]))

}

// Swift dependencies
if outputFilePath.extension != nil,
Expand Down