aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-08-26 03:53:50 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-08-26 03:53:50 +0000
commit1cb237fbf9e52e17f1e03b6f80c1114f47f93781 (patch)
treec554dbc456a878d2b8280d89a47ea4b50881494f /lib
parent12f740f4cd86c1e948f004437e6b47df8e75daff (diff)
Revert r112149, "Move the sorting of code-completion results out of the main
path and ...", it is failing tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112161 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Frontend/ASTUnit.cpp4
-rw-r--r--lib/Sema/CodeCompleteConsumer.cpp9
-rw-r--r--lib/Sema/SemaCodeComplete.cpp2
3 files changed, 6 insertions, 9 deletions
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp
index 874fd012b3..452803acd2 100644
--- a/lib/Frontend/ASTUnit.cpp
+++ b/lib/Frontend/ASTUnit.cpp
@@ -1678,7 +1678,9 @@ void AugmentedCodeCompleteConsumer::ProcessCodeCompleteResults(Sema &S,
Next.ProcessCodeCompleteResults(S, Context, Results, NumResults);
return;
}
-
+
+ // Sort the completion results before passing them on to the actual consumer.
+ std::stable_sort(AllResults.begin(), AllResults.end());
Next.ProcessCodeCompleteResults(S, Context, AllResults.data(),
AllResults.size());
diff --git a/lib/Sema/CodeCompleteConsumer.cpp b/lib/Sema/CodeCompleteConsumer.cpp
index c4e7bb4269..4345123558 100644
--- a/lib/Sema/CodeCompleteConsumer.cpp
+++ b/lib/Sema/CodeCompleteConsumer.cpp
@@ -443,8 +443,6 @@ PrintingCodeCompleteConsumer::ProcessCodeCompleteResults(Sema &SemaRef,
CodeCompletionContext Context,
CodeCompletionResult *Results,
unsigned NumResults) {
- std::stable_sort(Results, Results + NumResults);
-
// Print the results.
for (unsigned I = 0; I != NumResults; ++I) {
OS << "COMPLETION: ";
@@ -662,11 +660,6 @@ bool clang::operator<(const CodeCompletionResult &X,
if (cmp)
return cmp < 0;
- // If case-insensitive comparison fails, try case-sensitive comparison.
- cmp = XStr.compare(YStr);
- if (cmp)
- return cmp < 0;
-
// Non-hidden names precede hidden names.
if (X.Hidden != Y.Hidden)
return !X.Hidden;
@@ -702,7 +695,7 @@ CIndexCodeCompleteConsumer::ProcessOverloadCandidates(Sema &SemaRef,
unsigned NumCandidates) {
for (unsigned I = 0; I != NumCandidates; ++I) {
WriteUnsigned(OS, CXCursor_NotImplemented);
- WriteUnsigned(OS, /*Priority=*/I);
+ WriteUnsigned(OS, /*Priority=*/0);
WriteUnsigned(OS, /*Availability=*/CXAvailability_Available);
CodeCompletionString *CCS
= Candidates[I].CreateSignatureString(CurrentArg, SemaRef);
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp
index d61ddcdf75..fed6536570 100644
--- a/lib/Sema/SemaCodeComplete.cpp
+++ b/lib/Sema/SemaCodeComplete.cpp
@@ -2277,6 +2277,8 @@ static void HandleCodeCompleteResults(Sema *S,
CodeCompletionContext Context,
CodeCompletionResult *Results,
unsigned NumResults) {
+ std::stable_sort(Results, Results + NumResults);
+
if (CodeCompleter)
CodeCompleter->ProcessCodeCompleteResults(*S, Context, Results, NumResults);