[PATCH] D47957: [clangd] Add option to fold overloads into a single completion item.

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 15 03:27:17 PDT 2018


ilya-biryukov accepted this revision.
ilya-biryukov added a comment.
This revision is now accepted and ready to land.

LGTM. (and a question on why we want to special-case the members)



================
Comment at: clangd/CodeComplete.cpp:245
+        // Methods are simply grouped by name.
+        return hash_combine('M', IndexResult->Name);
+      case index::SymbolKind::Function:
----------------
sammccall wrote:
> ilya-biryukov wrote:
> > Members never come from the index for completion, right? Maybe add an assert here instead?
> Done.
> I'd keep the actual return here as it's simple and explains the value. We likely want to use it in future to augment members with signals from the index.
LG, thanks!


================
Comment at: clangd/CodeComplete.cpp:263
+    if (D->isCXXClassMember())
+      return hash_combine('M', D->getDeclName().isIdentifier()
+                                   ? D->getName()
----------------
Using the normal-function scheme (fully-qualified name as grouping key) should also work for members and will make the code simpler.
Why do we choose to special-case the members?

This might be addressed after landing the patch, just wanted to get the rationale behind special-casing members.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D47957





More information about the cfe-commits mailing list