File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,24 @@ swift::frontend::utils::escapeForMake(StringRef raw,
139
139
return buffer.data ();
140
140
}
141
141
142
+ // / This sorting function is used to stabilize the order in which dependencies
143
+ // / are emitted into \c .d files that are consumed by external build systems.
144
+ // / This serves to eliminate order as a source of non-determinism in these
145
+ // / outputs.
146
+ // /
147
+ // / The exact sorting predicate is not important. Currently, it is a
148
+ // / lexicographic comparison that reverses the provided strings before applying
149
+ // / the sorting predicate. This has the benefit of being somewhat
150
+ // / invariant with respect to the installation location of various system
151
+ // / components. e.g. on two systems, the same file identified by two different
152
+ // / paths differing only in their relative install location such as
153
+ // /
154
+ // / /Applications/MyXcode.app/Path/To/A/Framework/In/The/SDK/Header.h
155
+ // / /Applications/Xcodes/AnotherXcode.app/Path/To/A/Framework/In/The/SDK/Header.h
156
+ // /
157
+ // / should appear in roughly the same order relative to other paths. Ultimately,
158
+ // / this makes it easier to test the contents of the emitted files with tools
159
+ // / like FileCheck.
142
160
static std::vector<std::string>
143
161
reversePathSortedFilenames (const ArrayRef<std::string> elts) {
144
162
std::vector<std::string> tmp (elts.begin (), elts.end ());
You can’t perform that action at this time.
0 commit comments