Author: mgrang Date: Mon Nov 20 10:49:14 2017 New Revision: 318681 URL: http://llvm.org/viewvc/llvm-project?rev=318681&view=rev Log: [AutoComplete] Use stronger sort predicate for autocomplete candidates to remove non-deterministic ordering
Summary: This fixes the failure in test/Driver/autocomplete.c uncovered by D39245. Reviewers: yamaguchi, teemperor, ruiu Reviewed By: yamaguchi, ruiu Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D40234 Modified: cfe/trunk/lib/Driver/Driver.cpp Modified: cfe/trunk/lib/Driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=318681&r1=318680&r2=318681&view=diff ============================================================================== --- cfe/trunk/lib/Driver/Driver.cpp (original) +++ cfe/trunk/lib/Driver/Driver.cpp Mon Nov 20 10:49:14 2017 @@ -1198,7 +1198,11 @@ void Driver::handleAutocompletions(Strin // case-insensitive sorting for consistency with the -help option // which prints out options in the case-insensitive alphabetical order. std::sort(SuggestedCompletions.begin(), SuggestedCompletions.end(), - [](StringRef A, StringRef B) { return A.compare_lower(B) < 0; }); + [](StringRef A, StringRef B) { + if (int X = A.compare_lower(B)) + return X < 0; + return A.compare(B) > 0; + }); llvm::outs() << llvm::join(SuggestedCompletions, "\n") << '\n'; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits