Skip to content

Commit

Permalink
[llvm-cov] Use a stable sort on sub-views
Browse files Browse the repository at this point in the history
We need to use a stable sort on instantiation and expansion sub-views to
produce consistent output. Fortunately, we've gotten lucky and the tests
have checks for the stable order.

This is needed to unblock D39245. Once that lands, we'll have better
test coverage for sort non-determinism.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316490 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
vedantk committed Oct 24, 2017
1 parent aa35415 commit 7e80950
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/llvm-cov/SourceCoverageView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ void SourceCoverageView::print(raw_ostream &OS, bool WholeFile,

// We need the expansions and instantiations sorted so we can go through them
// while we iterate lines.
std::sort(ExpansionSubViews.begin(), ExpansionSubViews.end());
std::sort(InstantiationSubViews.begin(), InstantiationSubViews.end());
std::stable_sort(ExpansionSubViews.begin(), ExpansionSubViews.end());
std::stable_sort(InstantiationSubViews.begin(), InstantiationSubViews.end());
auto NextESV = ExpansionSubViews.begin();
auto EndESV = ExpansionSubViews.end();
auto NextISV = InstantiationSubViews.begin();
Expand Down

0 comments on commit 7e80950

Please sign in to comment.