Skip to content

Commit 2cedf21

Browse files
author
David Ungar
committed
De-gettify method names.
1 parent 8271b34 commit 2cedf21

File tree

3 files changed

+19
-26
lines changed

3 files changed

+19
-26
lines changed

Sources/SwiftDriver/IncrementalCompilation/ModuleDependencyGraph.swift

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,16 @@ import SwiftOptions
5454
self.creationPhase = phase
5555
}
5656

57-
@_spi(Testing) public func getRequiredSource(for input: TypedVirtualPath,
58-
function: String = #function,
59-
file: String = #file,
60-
line: Int = #line) -> DependencySource {
61-
guard let source = inputDependencySourceMap.getSourceIfKnown(for: input)
57+
@_spi(Testing) public func sourceRequired(for input: TypedVirtualPath,
58+
function: String = #function,
59+
file: String = #file,
60+
line: Int = #line) -> DependencySource {
61+
guard let source = inputDependencySourceMap.sourceIfKnown(for: input)
6262
else {
6363
fatalError("\(input.file.basename) not found in inputDependencySourceMap, \(file):\(line) in \(function)")
6464
}
6565
return source
6666
}
67-
68-
@_spi(Testing) public func getNeededInput(for source: DependencySource) -> TypedVirtualPath? {
69-
guard let input = inputDependencySourceMap.getInputIfKnown(for: source)
70-
else {
71-
info.diagnosticEngine.emit(warning: "Failed to find source file for '\(source.file.basename)', recovering with a full rebuild. Next build will be incremental.")
72-
return nil
73-
}
74-
return input
75-
}
7667
}
7768

7869
extension ModuleDependencyGraph {
@@ -141,7 +132,7 @@ extension ModuleDependencyGraph {
141132
return TransitivelyInvalidatedInputSet()
142133
}
143134
return collectInputsRequiringCompilationAfterProcessing(
144-
dependencySource: getRequiredSource(for: input))
135+
dependencySource: sourceRequired(for: input))
145136
}
146137
}
147138

@@ -161,17 +152,16 @@ extension ModuleDependencyGraph {
161152
/// speculatively scheduled in the first wave.
162153
func collectInputsInvalidatedBy(input: TypedVirtualPath
163154
) -> TransitivelyInvalidatedInputArray {
164-
let changedSource = getRequiredSource(for: input)
155+
let changedSource = sourceRequired(for: input)
165156
let allDependencySourcesToRecompile =
166157
collectSwiftDepsUsing(dependencySource: changedSource)
167158

168159
return allDependencySourcesToRecompile.compactMap {
169160
dependencySource in
170161
guard dependencySource != changedSource else {return nil}
171-
let dependentSource = inputDependencySourceMap[dependencySource]
172-
info.reporter?.report(
173-
"Found dependent of \(input.file.basename):", dependentInput)
174-
return dependentInput
162+
let inputToRecompile = inputDependencySourceMap.inputIfKnown(for: dependencySource)
163+
info.reporter?.report("Found dependent of \(input.file.basename):", inputToRecompile)
164+
return inputToRecompile
175165
}
176166
}
177167

@@ -188,7 +178,7 @@ extension ModuleDependencyGraph {
188178
/// Does the graph contain any dependency nodes for a given source-code file?
189179
func containsNodes(forSourceFile file: TypedVirtualPath) -> Bool {
190180
precondition(file.type == .swift)
191-
guard let source = inputDependencySourceMap.getSourceIfKnown(for: file) else {
181+
guard let source = inputDependencySourceMap.sourceIfKnown(for: file) else {
192182
return false
193183
}
194184
return containsNodes(forDependencySource: source)
@@ -247,7 +237,7 @@ extension ModuleDependencyGraph {
247237
func collectInputsRequiringCompilation(byCompiling input: TypedVirtualPath
248238
) -> TransitivelyInvalidatedInputSet? {
249239
precondition(input.type == .swift)
250-
let dependencySource = getRequiredSource(for: input)
240+
let dependencySource = sourceRequired(for: input)
251241
return collectInputsRequiringCompilationAfterProcessing(
252242
dependencySource: dependencySource)
253243
}
@@ -342,7 +332,10 @@ extension ModuleDependencyGraph {
342332
) -> TransitivelyInvalidatedInputSet? {
343333
var invalidatedInputs = TransitivelyInvalidatedInputSet()
344334
for invalidatedSwiftDeps in collectSwiftDepsUsingInvalidated(nodes: directlyInvalidatedNodes) {
345-
guard let invalidatedInput = input(neededFor: invalidatedSwiftDeps) else {
335+
guard let invalidatedInput = inputDependencySourceMap.inputIfKnown(for: invalidatedSwiftDeps)
336+
else {
337+
info.diagnosticEngine.emit(
338+
warning: "Failed to find source file for '\(invalidatedSwiftDeps.file.basename)', recovering with a full rebuild. Next build will be incremental.")
346339
return nil
347340
}
348341
invalidatedInputs.insert(invalidatedInput)

Sources/SwiftDriver/IncrementalCompilation/ModuleDependencyGraphParts/InputDependencySourceMap.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ import TSCBasic
3333

3434
// MARK: - Accessing
3535
extension InputDependencySourceMap {
36-
@_spi(Testing) public func getSourceIfKnown(for input: TypedVirtualPath) -> DependencySource? {
36+
@_spi(Testing) public func sourceIfKnown(for input: TypedVirtualPath) -> DependencySource? {
3737
biMap[input]
3838
}
3939

40-
@_spi(Testing) public func getInputIfKnown(for source: DependencySource) -> TypedVirtualPath? {
40+
@_spi(Testing) public func inputIfKnown(for source: DependencySource) -> TypedVirtualPath? {
4141
biMap[source]
4242
}
4343

Sources/SwiftDriver/IncrementalCompilation/ModuleDependencyGraphParts/Tracer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ extension ModuleDependencyGraph.Tracer {
121121
path.compactMap { node in
122122
node.dependencySource.map {
123123
source in
124-
graph.inputDependencySourceMap.getInputIfKnown(for: source).map {
124+
graph.inputDependencySourceMap.inputIfKnown(for: source).map {
125125
input in
126126
"\(node.key) in \(input.file.basename)"
127127
}

0 commit comments

Comments
 (0)