Skip to content

Commit

Permalink
[clangd] Fix the flaky FindTarget unittest after 1b66840
Browse files Browse the repository at this point in the history
after 1b66840, FindTarget will report multiple refs with the same
location, make the sort order of the refs deterministic in
FindTargetTests.
  • Loading branch information
hokein committed Jun 27, 2023
1 parent cc0fc35 commit 8aa88ee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion clang-tools-extra/clangd/unittests/FindTargetTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ class FindExplicitReferencesTest : public ::testing::Test {
AllRefs annotatedReferences(llvm::StringRef Code, ParsedAST &AST,
std::vector<ReferenceLoc> Refs) {
auto &SM = AST.getSourceManager();
llvm::sort(Refs, [&](const ReferenceLoc &L, const ReferenceLoc &R) {
llvm::stable_sort(Refs, [&](const ReferenceLoc &L, const ReferenceLoc &R) {
return SM.isBeforeInTranslationUnit(L.NameLoc, R.NameLoc);
});

Expand Down

0 comments on commit 8aa88ee

Please sign in to comment.