Skip to content

Commit ed23412

Browse files
committed
[Parsable Output] Code-review feedback: Display identical batch-mode command line for all constituent messages
This will make it easier to debug the compiler by taking build command line commands from the build log.
1 parent 8717d78 commit ed23412

File tree

2 files changed

+1
-62
lines changed

2 files changed

+1
-62
lines changed

Sources/SwiftDriver/Driver/ToolExecutionDelegate.swift

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,7 @@ private extension ToolExecutionDelegate {
199199
result.append(
200200
constructSingleBeganMessage(inputs: [input],
201201
outputs: outputPaths,
202-
arguments: Self.filterPrimaryArguments(in: arguments,
203-
input: input,
204-
outputs: outputPaths),
202+
arguments: arguments,
205203
pid: quasiPID,
206204
realPid: pid))
207205
// Save the quasiPID of this job/input combination in order to generate the correct
@@ -300,44 +298,6 @@ private extension ToolExecutionDelegate {
300298
return SignalledMessage(pid: pid, realPid: realPid, output: output,
301299
errorMessage: error, signal: Int(signal))
302300
}
303-
304-
/// Best-effort attempt to "fix-up" the individual swift-frontend invocation command line, to pretend
305-
/// it is an individual single-primary compile job, rather than a batch mode compile with multiple primaries
306-
static func filterPrimaryArguments(in arguments: [String],
307-
input: TypedVirtualPath,
308-
outputs: [TypedVirtualPath]) -> [String] {
309-
// We must have only one `-primary-file` option specified, the one that corresponds
310-
// to the primary file whose job this message is faking.
311-
var result = arguments.enumerated().compactMap() { index, element -> String? in
312-
if element == "-primary-file" {
313-
assert(arguments.count > index + 1)
314-
return arguments[index + 1].hasSuffix(input.file.basename) ? element : nil
315-
}
316-
return element
317-
}
318-
319-
// We must have only one `-o` option specified, the one that corresponds
320-
// to the primary output file for the current input, whose job this message is faking.
321-
let outputPathStrings = outputs.map { $0.file.description }
322-
var pathsToRemove : [String] = []
323-
result = result.enumerated().compactMap() { index, element -> String? in
324-
if element == "-o" {
325-
assert(result.count > index + 1)
326-
if outputPathStrings.contains(result[index + 1]) {
327-
return element
328-
} else {
329-
pathsToRemove.append(result[index + 1])
330-
return nil
331-
}
332-
}
333-
if pathsToRemove.contains(element) {
334-
return nil
335-
}
336-
return element
337-
}
338-
339-
return result
340-
}
341301
}
342302

343303
fileprivate extension Diagnostic.Message {

Tests/SwiftDriverTests/ParsableMessageTests.swift

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,6 @@ final class ParsableMessageTests: XCTestCase {
150150

151151
/// One per primary
152152
XCTAssertTrue(errorOutput.contains(
153-
"""
154-
\"-primary-file\",
155-
\"\\/WorkDir\\/main.swift\",
156-
\"\\/WorkDir\\/test1.swift\",
157-
\"\\/WorkDir\\/test2.swift\",
158-
"""))
159-
XCTAssertTrue(errorOutput.contains(
160153
"""
161154
"pid" : -1000,
162155
"""))
@@ -167,13 +160,6 @@ final class ParsableMessageTests: XCTestCase {
167160
],
168161
"""))
169162
XCTAssertTrue(errorOutput.contains(
170-
"""
171-
\"\\/WorkDir\\/main.swift\",
172-
\"-primary-file\",
173-
\"\\/WorkDir\\/test1.swift\",
174-
\"\\/WorkDir\\/test2.swift\",
175-
"""))
176-
XCTAssertTrue(errorOutput.contains(
177163
"""
178164
"pid" : -1001,
179165
"""))
@@ -184,13 +170,6 @@ final class ParsableMessageTests: XCTestCase {
184170
],
185171
"""))
186172
XCTAssertTrue(errorOutput.contains(
187-
"""
188-
\"\\/WorkDir\\/main.swift\",
189-
\"\\/WorkDir\\/test1.swift\",
190-
\"-primary-file\",
191-
\"\\/WorkDir\\/test2.swift\",
192-
"""))
193-
XCTAssertTrue(errorOutput.contains(
194173
"""
195174
"pid" : -1002,
196175
"""))

0 commit comments

Comments
 (0)