[PATCH] D110130: [clangd] Semantic highlighting for lambda init-capture

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 21 08:27:31 PDT 2021


kadircet added a comment.

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?



================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:515
       return true;
     if (auto K = kindForType(AT->getDeducedType().getTypePtrOrNull(),
                              H.getResolver())) {
----------------
nit: while here do you mind turning this into an early exit as well? the nesting below seems a little distracting.


================
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 =
----------------
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?


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