File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed
Sources/SwiftDriver/Incremental Compilation
ModuleDependencyGraph Parts Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,14 @@ extension ModuleDependencyGraph.NodeFinder {
71
71
. map ( fnVerifyingSwiftDeps)
72
72
}
73
73
74
+ func forEachUseInOrder( of def: Graph . Node , _ fn: ( Graph . Node , Graph . SwiftDeps ) -> Void ) {
75
+ var uses = [ ( Graph . Node, Graph . SwiftDeps) ] ( )
76
+ forEachUse ( of: def) {
77
+ uses. append ( ( $0, $1) )
78
+ }
79
+ uses. sorted { $0. 0 < $1. 0 } . forEach { fn ( $0. 0 , $0. 1 ) }
80
+ }
81
+
74
82
func mappings( of n: Graph . Node ) -> [ ( Graph . SwiftDeps ? , DependencyKey ) ]
75
83
{
76
84
nodeMap. compactMap {
Original file line number Diff line number Diff line change @@ -57,7 +57,8 @@ extension ModuleDependencyGraph.Tracer {
57
57
where Nodes. Element == ModuleDependencyGraph . Node
58
58
{
59
59
self . graph = graph
60
- self . startingPoints = Array ( defs)
60
+ // Sort so "Tracing" diagnostics are deterministically ordered
61
+ self . startingPoints = defs. sorted ( )
61
62
self . currentPathIfTracing = graph. reportIncrementalDecision != nil ? [ ] : nil
62
63
self . diagnosticEngine = diagnosticEngine
63
64
}
@@ -83,7 +84,7 @@ extension ModuleDependencyGraph.Tracer {
83
84
let pathLengthAfterArrival = traceArrival ( at: definition) ;
84
85
85
86
// If this use also provides something, follow it
86
- graph. nodeFinder. forEachUse ( of: definition) { use, _ in
87
+ graph. nodeFinder. forEachUseInOrder ( of: definition) { use, _ in
87
88
findNextPreviouslyUntracedDependent ( of: use)
88
89
}
89
90
traceDeparture ( pathLengthAfterArrival) ;
Original file line number Diff line number Diff line change @@ -194,7 +194,7 @@ extension ModuleDependencyGraph {
194
194
// These nodes will depend on the *interface* of the external Decl.
195
195
let key = DependencyKey ( interfaceFor: externalSwiftDeps)
196
196
let node = Node ( key: key, fingerprint: nil , swiftDeps: nil )
197
- nodeFinder. forEachUse ( of: node) { use, useSwiftDeps in
197
+ nodeFinder. forEachUseInOrder ( of: node) { use, useSwiftDeps in
198
198
if isUntraced ( use) {
199
199
fn ( useSwiftDeps)
200
200
}
You can’t perform that action at this time.
0 commit comments