mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[IDE] Preserve order for Clang declarations with the same source loc. (#9581)
This usually indicates the same declaration being imported multiple ways; trust the ClangImporter to provide a reasonable order for these.
This commit is contained in:
@@ -450,12 +450,12 @@ void swift::ide::printSubmoduleInterface(
|
||||
|
||||
// Sort imported declarations in source order *within a submodule*.
|
||||
for (auto &P : ClangDecls) {
|
||||
std::sort(P.second.begin(), P.second.end(),
|
||||
[&](std::pair<Decl *, clang::SourceLocation> LHS,
|
||||
std::pair<Decl *, clang::SourceLocation> RHS) -> bool {
|
||||
return ClangSourceManager.isBeforeInTranslationUnit(LHS.second,
|
||||
RHS.second);
|
||||
});
|
||||
std::stable_sort(P.second.begin(), P.second.end(),
|
||||
[&](std::pair<Decl *, clang::SourceLocation> LHS,
|
||||
std::pair<Decl *, clang::SourceLocation> RHS) -> bool {
|
||||
return ClangSourceManager.isBeforeInTranslationUnit(LHS.second,
|
||||
RHS.second);
|
||||
});
|
||||
}
|
||||
|
||||
// Sort Swift declarations so that we print them in a consistent order.
|
||||
|
||||
Reference in New Issue
Block a user