mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Serialization] Preserve source order in serialization (#18361)
We previously shied away from this in order to not /accidentally/ depend on it, but it becomes interesting again with textual interfaces, which can certainly be read by humans. The cross-file order is the order of input files, which is at least controllable by users.
This commit is contained in:
@@ -497,7 +497,7 @@ void swift::ide::printSubmoduleInterface(
|
||||
// If the group name is specified, we sort them according to their source order,
|
||||
// which is the order preserved by getTopLevelDecls.
|
||||
if (GroupNames.empty()) {
|
||||
std::sort(SwiftDecls.begin(), SwiftDecls.end(),
|
||||
std::stable_sort(SwiftDecls.begin(), SwiftDecls.end(),
|
||||
[&](Decl *LHS, Decl *RHS) -> bool {
|
||||
auto *LHSValue = dyn_cast<ValueDecl>(LHS);
|
||||
auto *RHSValue = dyn_cast<ValueDecl>(RHS);
|
||||
|
||||
Reference in New Issue
Block a user