From: Vedant Kumar Date: Tue, 24 Oct 2017 20:03:37 +0000 (+0000) Subject: [llvm-cov] Use a stable sort on sub-views X-Git-Tag: llvmorg-6.0.0-rc1~5005 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8c07280f0e431d675da395b8b1652682e6a19b3f;p=platform%2Fupstream%2Fllvm.git [llvm-cov] Use a stable sort on sub-views 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. llvm-svn: 316490 --- diff --git a/llvm/tools/llvm-cov/SourceCoverageView.cpp b/llvm/tools/llvm-cov/SourceCoverageView.cpp index f2e8788..31ab132 100644 --- a/llvm/tools/llvm-cov/SourceCoverageView.cpp +++ b/llvm/tools/llvm-cov/SourceCoverageView.cpp @@ -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();