Skip to content

Commit b74d808

Browse files
committed
Revert "Step 1: Isolate the map to be replaced"
This reverts commit 8a3fc05.
1 parent 1b43c5c commit b74d808

File tree

2 files changed

+14
-48
lines changed

2 files changed

+14
-48
lines changed

Sources/SwiftDriver/IncrementalCompilation/ModuleDependencyGraph.swift

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,19 @@ import SwiftOptions
2424
@_spi(Testing) public var nodeFinder = NodeFinder()
2525

2626
/// Maps input files (e.g. .swift) to and from the DependencySource object.
27-
@_spi(Testing) public private(set) var inputDependencySourceMap = InputDependencySourceMap()
27+
///
28+
// FIXME: The map between swiftdeps and swift files is absolutely *not*
29+
// a bijection. In particular, more than one swiftdeps file can be encountered
30+
// in the course of deserializing priors *and* reading the output file map
31+
// *and* re-reading swiftdeps files after frontends complete
32+
// that correspond to the same swift file. These cause two problems:
33+
// - overwrites in this data structure that lose data and
34+
// - cache misses in `getInput(for:)` that cause the incremental build to
35+
// turn over when e.g. entries in the output file map change. This should be
36+
// replaced by a multi-map from swift files to dependency sources,
37+
// and a regular map from dependency sources to swift files -
38+
// since that direction really is one-to-one.
39+
@_spi(Testing) public private(set) var inputDependencySourceMap = BidirectionalMap<TypedVirtualPath, DependencySource>()
2840

2941
// The set of paths to external dependencies known to be in the graph
3042
public internal(set) var fingerprintedExternalDependencies = Set<FingerprintedExternalDependency>()
@@ -1146,7 +1158,7 @@ extension Set where Element == ModuleDependencyGraph.Node {
11461158
}
11471159
}
11481160

1149-
extension InputDependencySourceMap {
1161+
extension BidirectionalMap where T1 == TypedVirtualPath, T2 == DependencySource {
11501162
fileprivate func matches(_ other: Self) -> Bool {
11511163
self == other
11521164
}

Sources/SwiftDriver/IncrementalCompilation/ModuleDependencyGraphParts/InputDependencySourceMap.swift

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)