summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorMandeep Singh Grang <mgrang@codeaurora.org>2017-11-20 18:49:14 +0000
committerMandeep Singh Grang <mgrang@codeaurora.org>2017-11-20 18:49:14 +0000
commit8f54ae15a0d3f822ac834776665bf5676a7d24f7 (patch)
treedef17d082bbd30181a91c43491f9b9e86b241969 /clang
parentdc9de50902b34e4995f73bfa33a0ad40b4928518 (diff)
downloadbcm5719-llvm-8f54ae15a0d3f822ac834776665bf5676a7d24f7.tar.gz
bcm5719-llvm-8f54ae15a0d3f822ac834776665bf5676a7d24f7.zip
[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 llvm-svn: 318681
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Driver/Driver.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index a1aa4db671f..9ae33b80f88 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1198,7 +1198,11 @@ void Driver::handleAutocompletions(StringRef PassedFlags) const {
// 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';
}
OpenPOWER on IntegriCloud