[PATCH] D66516: [clangd] Highlight typedefs to template parameters as template parameters

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 9 01:57:17 PDT 2019


hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.

thanks for taking care of it.



================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:129
     if (const auto *TSI = TD->getTypeSourceInfo())
-      addType(TD->getLocation(), TSI->getTypeLoc().getTypePtr());
+      addType(TD->getLocation(), TSI->getTypeLoc().getType().getTypePtr());
     return true;
----------------
nit: I think the previous ` TSI->getTypeLoc().getTypePtr()` should work?


================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:191
       addToken(Loc, HighlightingKind::Primitive);
+    if (const TemplateTypeParmType *TD = dyn_cast<TemplateTypeParmType>(TP))
+      // TemplateTypeParmType also do not have a TagDecl.
----------------
nit: use `auto`, since the type is obvious from RHS.


================
Comment at: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp:270
+        struct $Class[[A]] {
+          $Primitive[[void]] $Method[[foo]]($Class[[A]]*);
+        };
----------------
Is this change relevant to this patch?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66516





More information about the cfe-commits mailing list