Skip to content

Commit da9e53f

Browse files
committed
Replace name usages with description
1 parent 8f810a5 commit da9e53f

File tree

9 files changed

+27
-27
lines changed

9 files changed

+27
-27
lines changed

Sources/SwiftDriver/Driver/OutputFileMap.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,15 @@ fileprivate struct OutputFileMapJSON: Codable {
160160
) -> Self {
161161
func convert(entry: (key: VirtualPath, value: [FileType: VirtualPath])) -> (String, Entry) {
162162
// We use a VirtualPath with an empty path for the master entry, but its name is "." and we need ""
163-
let fixedIfMaster = entry.key.name == "." ? "" : entry.key.name
163+
let fixedIfMaster = entry.key.description == "." ? "" : entry.key.description
164164
return (fixedIfMaster, convert(outputs: entry.value))
165165
}
166166
func convert(outputs: [FileType: VirtualPath]) -> Entry {
167167
Entry(
168-
dependencies: outputs[.dependencies]?.name,
169-
object: outputs[.object]?.name,
170-
swiftmodule: outputs[.swiftModule]?.name,
171-
swiftDependencies: outputs[.swiftDeps]?.name)
168+
dependencies: outputs[.dependencies]?.description,
169+
object: outputs[.object]?.description,
170+
swiftmodule: outputs[.swiftModule]?.description,
171+
swiftDependencies: outputs[.swiftDeps]?.description)
172172
}
173173
return Self(entries: Dictionary(uniqueKeysWithValues: entries.map(convert(entry:))))
174174
}

Sources/SwiftDriver/Driver/ToolExecutionDelegate.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ public struct ToolExecutionDelegate: JobExecutorDelegate {
3232

3333
// Compute the outputs for the message.
3434
let outputs: [BeganMessage.Output] = job.outputs.map {
35-
.init(path: $0.file.name, type: $0.type.rawValue)
35+
.init(path: $0.file.description, type: $0.type.rawValue)
3636
}
3737

3838
let beganMessage = BeganMessage(
3939
pid: pid,
40-
inputs: job.displayInputs.map{ $0.file.name },
40+
inputs: job.displayInputs.map{ $0.file.description },
4141
outputs: outputs,
4242
commandExecutable: arguments[0],
4343
commandArguments: arguments[1...].map{ String($0) }

Sources/SwiftDriver/Execution/JobExecutor.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public struct ArgsResolver {
4141
case .path(let path):
4242
// Return the path from the temporary directory if this is a temporary file.
4343
if path.isTemporary {
44-
let actualPath = temporaryDirectory.appending(component: path.name)
44+
let actualPath = temporaryDirectory.appending(component: path.description)
4545
return actualPath.pathString
4646
}
4747

@@ -51,7 +51,7 @@ public struct ArgsResolver {
5151
}
5252

5353
// Otherwise, return the path.
54-
return path.name
54+
return path.description
5555
}
5656
}
5757

Sources/SwiftDriver/Incremental Compilation/InputIInfoMap.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public extension InputInfoMap {
162162
let missingInputs = Set(self.inputInfos.keys).subtracting(inputFiles.map {$0.file})
163163
guard missingInputs.isEmpty else {
164164
return "the following inputs were used in the previous compilation but not in this one: "
165-
+ missingInputs.map {$0.name} .joined(separator: ", ")
165+
+ missingInputs.map {$0.description} .joined(separator: ", ")
166166
}
167167
return nil
168168
}

Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ extension GenericUnixToolchain {
160160
let inputFiles: [Job.ArgTemplate] = inputs.map { input in
161161
// Autolink inputs are handled specially
162162
if input.type == .autolink {
163-
return .flag("@\(input.file.name)")
163+
return .flag("@\(input.file.description)")
164164
}
165165
return .path(input.file)
166166
}

Sources/SwiftDriver/Jobs/Job.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ public struct Job: Codable, Equatable {
6767

6868
extension Job: CustomStringConvertible {
6969
public var description: String {
70-
var result: String = tool.name
70+
var result: String = tool.description
7171

7272
for arg in commandLine {
7373
result += " "
7474
switch arg {
7575
case .flag(let string):
7676
result += string.spm_shellEscaped()
7777
case .path(let path):
78-
result += path.name.spm_shellEscaped()
78+
result += path.description.spm_shellEscaped()
7979
}
8080
}
8181

Sources/SwiftDriver/Jobs/Planning.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ extension Driver {
137137

138138
extension Diagnostic.Message {
139139
static func error_unexpected_input_file(_ file: VirtualPath) -> Diagnostic.Message {
140-
.error("unexpected input file: \(file.name)")
140+
.error("unexpected input file: \(file.description)")
141141
}
142142
}
143143

Sources/SwiftDriver/Utilities/DOTJobGraphSerializer.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ public struct DOTJobGraphSerializer {
5656
stream.write(" \(jobName) [style=bold];\n")
5757
}
5858
for input in job.inputs {
59-
let inputName = quoteName(input.file.name)
59+
let inputName = quoteName(input.file.description)
6060
if hasEmittedStyling.insert(inputName).inserted {
6161
stream.write(" \(inputName) [fontsize=12];\n")
6262
}
6363
stream.write(" \(inputName) -> \(jobName) [color=blue];\n")
6464
}
6565
for output in job.outputs {
66-
let outputName = quoteName(output.file.name)
66+
let outputName = quoteName(output.file.description)
6767
if hasEmittedStyling.insert(outputName).inserted {
6868
stream.write(" \(outputName) [fontsize=12];\n")
6969
}

Tests/SwiftDriverTests/SwiftDriverTests.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ final class SwiftDriverTests: XCTestCase {
230230
XCTAssertEqual(plannedJobs[0].outputs.first!.file, VirtualPath.temporary(RelativePath("foo.o")))
231231
XCTAssertEqual(plannedJobs[1].outputs.count, 1)
232232
XCTAssertEqual(plannedJobs[1].outputs.first!.file, VirtualPath.temporary(RelativePath("bar.o")))
233-
XCTAssertTrue(plannedJobs[2].tool.name.contains("ld"))
233+
XCTAssertTrue(plannedJobs[2].tool.description.contains("ld"))
234234
XCTAssertEqual(plannedJobs[2].outputs.count, 1)
235235
XCTAssertEqual(plannedJobs[2].outputs.first!.file, VirtualPath.relative(RelativePath("Test")))
236236

@@ -274,10 +274,10 @@ final class SwiftDriverTests: XCTestCase {
274274
let outputFileMap = try OutputFileMap.load(file: file.path, diagnosticEngine: diags)
275275

276276
let object = try outputFileMap.getOutput(inputFile: .init(path: "/tmp/foo/Sources/foo/foo.swift"), outputType: .object)
277-
XCTAssertEqual(object.name, "/tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.swift.o")
277+
XCTAssertEqual(object.description, "/tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.swift.o")
278278

279279
let masterDeps = try outputFileMap.getOutput(inputFile: .init(path: ""), outputType: .swiftDeps)
280-
XCTAssertEqual(masterDeps.name, "/tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/master.swiftdeps")
280+
XCTAssertEqual(masterDeps.description, "/tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/master.swiftdeps")
281281
}
282282
}
283283
}
@@ -530,7 +530,7 @@ final class SwiftDriverTests: XCTestCase {
530530
let linkCmd = linkJob.commandLine
531531
XCTAssertTrue(linkCmd.contains {
532532
if case .path(let path) = $0 {
533-
return path.name.contains("darwin/libclang_rt.asan_osx_dynamic.dylib")
533+
return path.description.contains("darwin/libclang_rt.asan_osx_dynamic.dylib")
534534
}
535535
return false
536536
})
@@ -551,7 +551,7 @@ final class SwiftDriverTests: XCTestCase {
551551
let linkCmd = linkJob.commandLine
552552
XCTAssertTrue(linkCmd.contains {
553553
if case .path(let path) = $0 {
554-
return path.name.contains("darwin/libclang_rt.tsan_osx_dynamic.dylib")
554+
return path.description.contains("darwin/libclang_rt.tsan_osx_dynamic.dylib")
555555
}
556556
return false
557557
})
@@ -572,7 +572,7 @@ final class SwiftDriverTests: XCTestCase {
572572
let linkCmd = linkJob.commandLine
573573
XCTAssertTrue(linkCmd.contains {
574574
if case .path(let path) = $0 {
575-
return path.name.contains("darwin/libclang_rt.ubsan_osx_dynamic.dylib")
575+
return path.description.contains("darwin/libclang_rt.ubsan_osx_dynamic.dylib")
576576
}
577577
return false
578578
})
@@ -618,7 +618,7 @@ final class SwiftDriverTests: XCTestCase {
618618
XCTAssertEqual(plannedJobs[1].outputs.first!.file, VirtualPath.temporary(RelativePath("foo3.o")))
619619
XCTAssertEqual(plannedJobs[2].outputs.count, 3)
620620
XCTAssertEqual(plannedJobs[2].outputs.first!.file, VirtualPath.temporary(RelativePath("foo5.o")))
621-
XCTAssertTrue(plannedJobs[3].tool.name.contains("ld"))
621+
XCTAssertTrue(plannedJobs[3].tool.description.contains("ld"))
622622
XCTAssertEqual(plannedJobs[3].outputs.count, 1)
623623
XCTAssertEqual(plannedJobs[3].outputs.first!.file, VirtualPath.relative(RelativePath("Test")))
624624
}
@@ -640,7 +640,7 @@ final class SwiftDriverTests: XCTestCase {
640640
XCTAssertEqual(plannedJobs[1].outputs[2].file, .temporary(RelativePath("bar.d")))
641641
XCTAssert(plannedJobs[1].commandLine.contains(.flag("-import-objc-header")))
642642

643-
XCTAssertTrue(plannedJobs[2].tool.name.contains("swift"))
643+
XCTAssertTrue(plannedJobs[2].tool.description.contains("swift"))
644644
XCTAssertEqual(plannedJobs[2].outputs.count, 2)
645645
XCTAssertEqual(plannedJobs[2].outputs[0].file, .relative(RelativePath("Test.swiftmodule")))
646646
XCTAssertEqual(plannedJobs[2].outputs[1].file, .absolute(AbsolutePath("/foo/bar/Test.swiftdoc")))
@@ -651,7 +651,7 @@ final class SwiftDriverTests: XCTestCase {
651651
var driver = try Driver(args: ["swiftc", "foo.swift", "bar.swift", "-module-name", "Test", "-emit-module-path", "/foo/bar/Test.swiftmodule" ])
652652
let plannedJobs = try driver.planBuild()
653653
XCTAssertEqual(plannedJobs.count, 3)
654-
XCTAssertTrue(plannedJobs[2].tool.name.contains("swift"))
654+
XCTAssertTrue(plannedJobs[2].tool.description.contains("swift"))
655655
XCTAssertEqual(plannedJobs[2].outputs.count, 2)
656656
XCTAssertEqual(plannedJobs[2].outputs[0].file, VirtualPath.absolute(AbsolutePath("/foo/bar/Test.swiftmodule")))
657657
XCTAssertEqual(plannedJobs[2].outputs[1].file, .absolute(AbsolutePath("/foo/bar/Test.swiftdoc")))
@@ -662,7 +662,7 @@ final class SwiftDriverTests: XCTestCase {
662662
var driver = try Driver(args: ["swiftc", "foo.swift", "bar.swift", "-module-name", "Test", "-emit-module-path", "Test.swiftmodule" ])
663663
let plannedJobs = try driver.planBuild()
664664
XCTAssertEqual(plannedJobs.count, 3)
665-
XCTAssertTrue(plannedJobs[2].tool.name.contains("swift"))
665+
XCTAssertTrue(plannedJobs[2].tool.description.contains("swift"))
666666
XCTAssertEqual(plannedJobs[2].outputs.count, 2)
667667
XCTAssertEqual(plannedJobs[2].outputs[0].file, .relative(RelativePath("Test.swiftmodule")))
668668
XCTAssertEqual(plannedJobs[2].outputs[1].file, .relative(RelativePath("Test.swiftdoc")))
@@ -673,7 +673,7 @@ final class SwiftDriverTests: XCTestCase {
673673
var driver = try Driver(args: ["swiftc", "foo.swift", "bar.swift", "-module-name", "Test", "-emit-module-doc", "-emit-module"])
674674
let plannedJobs = try driver.planBuild()
675675
XCTAssertEqual(plannedJobs.count, 3)
676-
XCTAssertTrue(plannedJobs[2].tool.name.contains("swift"))
676+
XCTAssertTrue(plannedJobs[2].tool.description.contains("swift"))
677677
XCTAssertEqual(plannedJobs[2].outputs.count, 2)
678678
XCTAssertEqual(plannedJobs[2].outputs[0].file, .relative(RelativePath("Test.swiftmodule")))
679679
XCTAssertEqual(plannedJobs[2].outputs[1].file, .relative(RelativePath("Test.swiftdoc")))

0 commit comments

Comments
 (0)