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 {
7171 . map ( fnVerifyingSwiftDeps)
7272 }
7373
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+
7482 func mappings( of n: Graph . Node ) -> [ ( Graph . SwiftDeps ? , DependencyKey ) ]
7583 {
7684 nodeMap. compactMap {
Original file line number Diff line number Diff line change @@ -57,7 +57,8 @@ extension ModuleDependencyGraph.Tracer {
5757 where Nodes. Element == ModuleDependencyGraph . Node
5858 {
5959 self . graph = graph
60- self . startingPoints = Array ( defs)
60+ // Sort so "Tracing" diagnostics are deterministically ordered
61+ self . startingPoints = defs. sorted ( )
6162 self . currentPathIfTracing = graph. reportIncrementalDecision != nil ? [ ] : nil
6263 self . diagnosticEngine = diagnosticEngine
6364 }
@@ -83,7 +84,7 @@ extension ModuleDependencyGraph.Tracer {
8384 let pathLengthAfterArrival = traceArrival ( at: definition) ;
8485
8586 // If this use also provides something, follow it
86- graph. nodeFinder. forEachUse ( of: definition) { use, _ in
87+ graph. nodeFinder. forEachUseInOrder ( of: definition) { use, _ in
8788 findNextPreviouslyUntracedDependent ( of: use)
8889 }
8990 traceDeparture ( pathLengthAfterArrival) ;
Original file line number Diff line number Diff line change @@ -194,7 +194,7 @@ extension ModuleDependencyGraph {
194194 // These nodes will depend on the *interface* of the external Decl.
195195 let key = DependencyKey ( interfaceFor: externalSwiftDeps)
196196 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
198198 if isUntraced ( use) {
199199 fn ( useSwiftDeps)
200200 }
You can’t perform that action at this time.
0 commit comments