[PATCH] D110130: [clangd] Ensure lambda init-capture gets semantic token

Nathan Ridge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 22 00:25:06 PDT 2021


nridge marked an inline comment as done.
nridge added a comment.

In D110130#3012748 <https://reviews.llvm.org/D110130#3012748>, @kadircet wrote:

> Naming of the patch is a little bit confusing. We're actually dropping the semantic highlighting for the type of lambdacaptures, which was showing up in the declarator names since there was no explicit type spelled in the source code. This turns on highlighting for the capture variables because we're left with a single token now.
>
> Can you reword the description to reflect that?

Updated patch description. (Also, I forgot to link to https://github.com/clangd/clangd/issues/868 which contains additional context, sorry!)



================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:522
+      // is the same as the location of the declared name itself.
+      if (StartLoc != D->getLocation()) {
+        auto &Tok =
----------------
kadircet wrote:
> nridge wrote:
> > Note, I initially tried `D->getTypeSpecStartLoc() != D->getTypeSpecEndLoc()`, but it turns out they are equal both in the init-capture case and in the regular `auto` case, so that check cannot be used to discriminate between the two.
> why not just check if `D` is implicit?
If you mean `D->isImplicit()`, that returns false for init-captures.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110130



More information about the cfe-commits mailing list