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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to