[PATCH] D150683: [clangd] Tweak "provides" hover card when symbols have the same name

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 16 09:06:08 PDT 2023


sammccall added inline comments.


================
Comment at: clang-tools-extra/clangd/Hover.cpp:1539
+        Front, [&](llvm::StringRef Sym) { P.appendCode(Sym); },
+        [&] { P.appendText(", "); });
     if (UsedSymbolNames.size() > Front.size()) {
----------------
sammccall wrote:
> VitaNuo wrote:
> > What will this do if `Front` has an even number of elements? AFAIU the message will end in a comma then, which is not desirable.
> llvm::interleave invokes the first callback for each element, and the second callback between subsequent elements. So this prints Front as a comma-separated list.
> (It's very similar to the example in the llvm::interleave docs)
Oh, the docs are confusing.

Given a list [a b c d] the relevant pairs are [a b];[b c];[c d]. Each one gets a comma in the middle, there are three commas.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150683/new/

https://reviews.llvm.org/D150683



More information about the cfe-commits mailing list