mgrang updated this revision to Diff 123538. mgrang retitled this revision from "[AutoComplete] Stable sort autocomplete candidates to remove non-deterministic ordering" to "[AutoComplete] Use stronger sort predicate for autocomplete candidates to remove non-deterministic ordering". mgrang added a comment.
Added a stronger sorting predicate instead of stable sort. https://reviews.llvm.org/D40234 Files: lib/Driver/Driver.cpp Index: lib/Driver/Driver.cpp =================================================================== --- lib/Driver/Driver.cpp +++ lib/Driver/Driver.cpp @@ -1200,7 +1200,10 @@ // 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) { + return A.equals_lower(B) ? + A.compare(B) == 1 : + A.compare_lower(B) < 0; }); llvm::outs() << llvm::join(SuggestedCompletions, "\n") << '\n'; }
Index: lib/Driver/Driver.cpp =================================================================== --- lib/Driver/Driver.cpp +++ lib/Driver/Driver.cpp @@ -1200,7 +1200,10 @@ // 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) { + return A.equals_lower(B) ? + A.compare(B) == 1 : + A.compare_lower(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