Skip to content
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
3 changes: 2 additions & 1 deletion Sources/Diagnose/MergeSwiftFiles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ extension RequestInfo {

progressUpdate(0, "Merging all .swift files into a single file")

let compilerArgs = compilerArgs.filter { $0 != "-primary-file" && !$0.hasSuffix(".swift") } + ["$FILE"]
let mergedRequestInfo = RequestInfo(
requestTemplate: requestTemplate,
offset: offset,
compilerArgs: compilerArgs.filter { !$0.hasSuffix(".swift") } + ["$FILE"],
compilerArgs: compilerArgs,
fileContents: mergedFile
)

Expand Down
7 changes: 4 additions & 3 deletions Sources/Diagnose/ReduceFrontendCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,18 @@ public struct ReduceFrontendCommand: AsyncParsableCommand {
reproducerPredicate: nsPredicate
)

defer {
progressBar.complete(success: true)
}
let reducedRequestInfo = try await reduceFrontendIssue(
frontendArgs: frontendArgs,
using: executor
) { progress, message in
progressBar.update(step: Int(progress * 100), total: 100, text: message)
}

progressBar.complete(success: true)

print("Reduced compiler arguments:")
print(reducedRequestInfo.compilerArgs)
print(reducedRequestInfo.compilerArgs.joined(separator: " "))

print("")
print("Reduced file contents:")
Expand Down
6 changes: 4 additions & 2 deletions Sources/Diagnose/RequestInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,12 @@ public struct RequestInfo: Sendable {

// Inline the file list so we can reduce the compiler arguments by removing individual source files.
// A couple `output-filelist`-related compiler arguments don't work with the file list inlined. Remove them as they
// are unlikely to be responsible for the swift-frontend cache
// are unlikely to be responsible for the swift-frontend cache.
// `-index-system-modules` is invalid when no output file lists are specified.
while let frontendArg = iterator.next() {
switch frontendArg {
case "-supplementary-output-file-map", "-output-filelist", "-index-unit-output-path-filelist":
case "-supplementary-output-file-map", "-output-filelist", "-index-unit-output-path-filelist",
"-index-system-modules":
_ = iterator.next()
case "-filelist":
guard let fileList = iterator.next() else {
Expand Down