]> granicus.if.org Git - clang/commitdiff
[AutoComplete] Use stronger sort predicate for autocomplete candidates to remove...
authorMandeep Singh Grang <mgrang@codeaurora.org>
Mon, 20 Nov 2017 18:49:14 +0000 (18:49 +0000)
committerMandeep Singh Grang <mgrang@codeaurora.org>
Mon, 20 Nov 2017 18:49:14 +0000 (18:49 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318681 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Driver.cpp

index a1aa4db671fa6935284ea536e9f16017e768505d..9ae33b80f889823668b593c29ffee27d40814752 100644 (file)
@@ -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';
 }