<html><body bgcolor="#FFFFFF"><div><br><br>Sent from my iPhone</div><div><br>On Aug 25, 2010, at 8:53 PM, Daniel Dunbar <<a href="mailto:daniel@zuster.org">daniel@zuster.org</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div><span>Author: ddunbar</span><br><span>Date: Wed Aug 25 22:53:50 2010</span><br><span>New Revision: 112161</span><br><span></span><br><span>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=112161&view=rev"><a href="http://llvm.org/viewvc/llvm-project?rev=112161&view=rev">http://llvm.org/viewvc/llvm-project?rev=112161&view=rev</a></a></span><br><span>Log:</span><br><span>Revert r112149, "Move the sorting of code-completion results out of the main</span><br><span>path and ...", it is failing tests.</span><br></div></blockquote><br><span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); font-size: 16px; font-weight: bold; line-height: 18px; ">r112159 didn't solve this?</span><div><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 16px; line-height: 18px; -webkit-tap-highlight-color: rgba(26, 26, 26, 0.292969); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469);"><b><br></b></span></font></div><div><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 16px; line-height: 18px; -webkit-tap-highlight-color: rgba(26, 26, 26, 0.292969); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469);"><b>  - Doug</b></span></font></div><div><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 16px; line-height: 18px; -webkit-tap-highlight-color: rgba(26, 26, 26, 0.292969); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469);"><b><br></b></span></font><blockquote type="cite"><div><span>Modified:</span><br><span>    cfe/trunk/include/clang-c/Index.h</span><br><span>    cfe/trunk/lib/Frontend/ASTUnit.cpp</span><br><span>    cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp</span><br><span>    cfe/trunk/lib/Sema/SemaCodeComplete.cpp</span><br><span>    cfe/trunk/tools/c-index-test/c-index-test.c</span><br><span>    cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp</span><br><span>    cfe/trunk/tools/libclang/libclang.darwin.exports</span><br><span>    cfe/trunk/tools/libclang/libclang.exports</span><br><span></span><br><span>Modified: cfe/trunk/include/clang-c/Index.h</span><br><span>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=112161&r1=112160&r2=112161&view=diff"><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=112161&r1=112160&r2=112161&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=112161&r1=112160&r2=112161&view=diff</a></a></span><br><span>==============================================================================</span><br><span>--- cfe/trunk/include/clang-c/Index.h (original)</span><br><span>+++ cfe/trunk/include/clang-c/Index.h Wed Aug 25 22:53:50 2010</span><br><span>@@ -2350,17 +2350,6 @@</span><br><span>                                             unsigned options);</span><br><span></span><br><span> /**</span><br><span>- * \brief Sort the code-completion results in case-insensitive alphabetical </span><br><span>- * order.</span><br><span>- *</span><br><span>- * \param Results The set of results to sort.</span><br><span>- * \param NumResults The number of results in \p Results.</span><br><span>- */</span><br><span>-CINDEX_LINKAGE</span><br><span>-void clang_sortCodeCompletionResults(CXCompletionResult *Results,</span><br><span>-                                     unsigned NumResults);</span><br><span>-  </span><br><span>-/**</span><br><span>  * \brief Free the given set of code-completion results.</span><br><span>  */</span><br><span> CINDEX_LINKAGE</span><br><span></span><br><span>Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp</span><br><span>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=112161&r1=112160&r2=112161&view=diff"><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=112161&r1=112160&r2=112161&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=112161&r1=112160&r2=112161&view=diff</a></a></span><br><span>==============================================================================</span><br><span>--- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)</span><br><span>+++ cfe/trunk/lib/Frontend/ASTUnit.cpp Wed Aug 25 22:53:50 2010</span><br><span>@@ -1678,7 +1678,9 @@</span><br><span>     Next.ProcessCodeCompleteResults(S, Context, Results, NumResults);</span><br><span>     return;</span><br><span>   }</span><br><span>-  </span><br><span>+</span><br><span>+  // Sort the completion results before passing them on to the actual consumer.</span><br><span>+  std::stable_sort(AllResults.begin(), AllResults.end());</span><br><span>   Next.ProcessCodeCompleteResults(S, Context, AllResults.data(),</span><br><span>                                   AllResults.size());</span><br><span></span><br><span></span><br><span>Modified: cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp</span><br><span>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp?rev=112161&r1=112160&r2=112161&view=diff"><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp?rev=112161&r1=112160&r2=112161&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp?rev=112161&r1=112160&r2=112161&view=diff</a></a></span><br><span>==============================================================================</span><br><span>--- cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp (original)</span><br><span>+++ cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp Wed Aug 25 22:53:50 2010</span><br><span>@@ -443,8 +443,6 @@</span><br><span>                                                  CodeCompletionContext Context,</span><br><span>                                                  CodeCompletionResult *Results,</span><br><span>                                                          unsigned NumResults) {</span><br><span>-  std::stable_sort(Results, Results + NumResults);</span><br><span>-  </span><br><span>   // Print the results.</span><br><span>   for (unsigned I = 0; I != NumResults; ++I) {</span><br><span>     OS << "COMPLETION: ";</span><br><span>@@ -662,11 +660,6 @@</span><br><span>   if (cmp)</span><br><span>     return cmp < 0;</span><br><span></span><br><span>-  // If case-insensitive comparison fails, try case-sensitive comparison.</span><br><span>-  cmp = XStr.compare(YStr);</span><br><span>-  if (cmp)</span><br><span>-    return cmp < 0;</span><br><span>-</span><br><span>   // Non-hidden names precede hidden names.</span><br><span>   if (X.Hidden != Y.Hidden)</span><br><span>     return !X.Hidden;</span><br><span>@@ -702,7 +695,7 @@</span><br><span>                                                        unsigned NumCandidates) {</span><br><span>   for (unsigned I = 0; I != NumCandidates; ++I) {</span><br><span>     WriteUnsigned(OS, CXCursor_NotImplemented);</span><br><span>-    WriteUnsigned(OS, /*Priority=*/I);</span><br><span>+    WriteUnsigned(OS, /*Priority=*/0);</span><br><span>     WriteUnsigned(OS, /*Availability=*/CXAvailability_Available);</span><br><span>     CodeCompletionString *CCS</span><br><span>       = Candidates[I].CreateSignatureString(CurrentArg, SemaRef);</span><br><span></span><br><span>Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp</span><br><span>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=112161&r1=112160&r2=112161&view=diff"><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=112161&r1=112160&r2=112161&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=112161&r1=112160&r2=112161&view=diff</a></a></span><br><span>==============================================================================</span><br><span>--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)</span><br><span>+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Wed Aug 25 22:53:50 2010</span><br><span>@@ -2277,6 +2277,8 @@</span><br><span>                                       CodeCompletionContext Context,</span><br><span>                                       CodeCompletionResult *Results,</span><br><span>                                       unsigned NumResults) {</span><br><span>+  std::stable_sort(Results, Results + NumResults);</span><br><span>+</span><br><span>   if (CodeCompleter)</span><br><span>     CodeCompleter->ProcessCodeCompleteResults(*S, Context, Results, NumResults);</span><br><span></span><br><span></span><br><span>Modified: cfe/trunk/tools/c-index-test/c-index-test.c</span><br><span>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=112161&r1=112160&r2=112161&view=diff"><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=112161&r1=112160&r2=112161&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=112161&r1=112160&r2=112161&view=diff</a></a></span><br><span>==============================================================================</span><br><span>--- cfe/trunk/tools/c-index-test/c-index-test.c (original)</span><br><span>+++ cfe/trunk/tools/c-index-test/c-index-test.c Wed Aug 25 22:53:50 2010</span><br><span>@@ -1,7 +1,6 @@</span><br><span> /* c-index-test.c */</span><br><span></span><br><span> #include "clang-c/Index.h"</span><br><span>-#include <ctype.h></span><br><span> #include <stdlib.h></span><br><span> #include <stdio.h></span><br><span> #include <string.h></span><br><span>@@ -904,25 +903,6 @@</span><br><span>   fprintf(file, "\n");</span><br><span> }</span><br><span></span><br><span>-int my_stricmp(const char *s1, const char *s2) {</span><br><span>-  while (*s1 && *s2) {</span><br><span>-    int c1 = tolower(*s1), c2 = tolower(*s2);</span><br><span>-    if (c1 < c2)</span><br><span>-      return -1;</span><br><span>-    else if (c1 > c2)</span><br><span>-      return 1;</span><br><span>-    </span><br><span>-    ++s1;</span><br><span>-    ++s2;</span><br><span>-  }</span><br><span>-  </span><br><span>-  if (*s1)</span><br><span>-    return 1;</span><br><span>-  else if (*s2)</span><br><span>-    return -1;</span><br><span>-  return 0;</span><br><span>-}</span><br><span>-</span><br><span> int perform_code_completion(int argc, const char **argv, int timing_only) {</span><br><span>   const char *input = argv[1];</span><br><span>   char *filename = 0;</span><br><span>@@ -978,13 +958,9 @@</span><br><span></span><br><span>   if (results) {</span><br><span>     unsigned i, n = results->NumResults;</span><br><span>-    if (!timing_only) {      </span><br><span>-      /* Sort the code-completion results based on the typed text. */</span><br><span>-      clang_sortCodeCompletionResults(results->Results, results->NumResults);</span><br><span>-</span><br><span>+    if (!timing_only)</span><br><span>       for (i = 0; i != n; ++i)</span><br><span>         print_completion_result(results->Results + i, stdout);</span><br><span>-    }</span><br><span>     n = clang_codeCompleteGetNumDiagnostics(results);</span><br><span>     for (i = 0; i != n; ++i) {</span><br><span>       CXDiagnostic diag = clang_codeCompleteGetDiagnostic(results, i);</span><br><span></span><br><span>Modified: cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp</span><br><span>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp?rev=112161&r1=112160&r2=112161&view=diff"><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp?rev=112161&r1=112160&r2=112161&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp?rev=112161&r1=112160&r2=112161&view=diff</a></a></span><br><span>==============================================================================</span><br><span>--- cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp (original)</span><br><span>+++ cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp Wed Aug 25 22:53:50 2010</span><br><span>@@ -582,8 +582,6 @@</span><br><span>         AllocatedResults.Results[I].CompletionString = StoredCompletion;</span><br><span>       }</span><br><span>     }</span><br><span>-    </span><br><span>-    // FIXME: Add ProcessOverloadCandidates?</span><br><span>   };</span><br><span> }</span><br><span></span><br><span>@@ -786,36 +784,3 @@</span><br><span></span><br><span></span><br><span> } // end extern "C"</span><br><span>-</span><br><span>-namespace {</span><br><span>-  struct OrderCompletionResults {</span><br><span>-    bool operator()(const CXCompletionResult &XR, </span><br><span>-                    const CXCompletionResult &YR) const {</span><br><span>-      CXStoredCodeCompletionString *X</span><br><span>-        = (CXStoredCodeCompletionString *)XR.CompletionString;</span><br><span>-      CXStoredCodeCompletionString *Y</span><br><span>-        = (CXStoredCodeCompletionString *)YR.CompletionString;</span><br><span>-      </span><br><span>-      const char *XText = X->getTypedText();</span><br><span>-      const char *YText = Y->getTypedText();</span><br><span>-      if (!XText || !YText)</span><br><span>-        return XText != 0;</span><br><span>-      </span><br><span>-      int result = llvm::StringRef(XText).compare_lower(YText);</span><br><span>-      if (result < 0)</span><br><span>-        return true;</span><br><span>-      if (result > 0)</span><br><span>-        return false;</span><br><span>-      </span><br><span>-      result = llvm::StringRef(XText).compare(YText);</span><br><span>-      return result;</span><br><span>-    }</span><br><span>-  };</span><br><span>-}</span><br><span>-</span><br><span>-extern "C" {</span><br><span>-  void clang_sortCodeCompletionResults(CXCompletionResult *Results,</span><br><span>-                                       unsigned NumResults) {</span><br><span>-    std::stable_sort(Results, Results + NumResults, OrderCompletionResults());</span><br><span>-  }</span><br><span>-}</span><br><span>\ No newline at end of file</span><br><span></span><br><span>Modified: cfe/trunk/tools/libclang/libclang.darwin.exports</span><br><span>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/libclang.darwin.exports?rev=112161&r1=112160&r2=112161&view=diff"><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/libclang.darwin.exports?rev=112161&r1=112160&r2=112161&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/libclang.darwin.exports?rev=112161&r1=112160&r2=112161&view=diff</a></a></span><br><span>==============================================================================</span><br><span>--- cfe/trunk/tools/libclang/libclang.darwin.exports (original)</span><br><span>+++ cfe/trunk/tools/libclang/libclang.darwin.exports Wed Aug 25 22:53:50 2010</span><br><span>@@ -99,6 +99,5 @@</span><br><span> _clang_reparseTranslationUnit</span><br><span> _clang_saveTranslationUnit</span><br><span> _clang_setUseExternalASTGeneration</span><br><span>-_clang_sortCodeCompletionResults</span><br><span> _clang_tokenize</span><br><span> _clang_visitChildren</span><br><span></span><br><span>Modified: cfe/trunk/tools/libclang/libclang.exports</span><br><span>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/libclang.exports?rev=112161&r1=112160&r2=112161&view=diff"><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/libclang.exports?rev=112161&r1=112160&r2=112161&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/libclang.exports?rev=112161&r1=112160&r2=112161&view=diff</a></a></span><br><span>==============================================================================</span><br><span>--- cfe/trunk/tools/libclang/libclang.exports (original)</span><br><span>+++ cfe/trunk/tools/libclang/libclang.exports Wed Aug 25 22:53:50 2010</span><br><span>@@ -99,6 +99,5 @@</span><br><span> clang_reparseTranslationUnit</span><br><span> clang_saveTranslationUnit</span><br><span> clang_setUseExternalASTGeneration</span><br><span>-clang_sortCodeCompletionResults</span><br><span> clang_tokenize</span><br><span> clang_visitChildren</span><br><span></span><br><span></span><br><span>_______________________________________________</span><br><span>cfe-commits mailing list</span><br><span><a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a></span><br><span><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a></span><br></div></blockquote></div></body></html>