[PATCH] D40234: [AutoComplete] Use stronger sort predicate for autocomplete candidates to remove non-deterministic ordering
Mandeep Singh Grang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 20 10:50:12 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL318681: [AutoComplete] Use stronger sort predicate for autocomplete candidates to… (authored by mgrang).
Changed prior to commit:
https://reviews.llvm.org/D40234?vs=123546&id=123623#toc
Repository:
rL LLVM
https://reviews.llvm.org/D40234
Files:
cfe/trunk/lib/Driver/Driver.cpp
Index: cfe/trunk/lib/Driver/Driver.cpp
===================================================================
--- cfe/trunk/lib/Driver/Driver.cpp
+++ cfe/trunk/lib/Driver/Driver.cpp
@@ -1198,7 +1198,11 @@
// 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';
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40234.123623.patch
Type: text/x-patch
Size: 747 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171120/67627060/attachment.bin>
More information about the cfe-commits
mailing list