[PATCH] D139926: [clangd] Add semantic token for angle brackets

Nathan Ridge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 27 00:56:29 PST 2023


nridge added inline comments.


================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:641
+  VisitClassTemplateSpecializationDecl(ClassTemplateSpecializationDecl *D) {
+    for (unsigned i = 0; i < D->getNumTemplateParameterLists(); ++i) {
+      if (auto *TPL = D->getTemplateParameterList(i))
----------------
nridge wrote:
> I would suggest moving this loop into `VisitTagDecl()`, as `TagDecl` is the base class of `ClassTemplateSpecializationDecl` that declares `getNumTemplateParameterLists()`. That way, we can be sure every derived class is handled.
(Here's an example of a `TagDecl` which is not a `ClassTemplateSpecializationDecl` but has a template parameter list:

```
template <typename>
class A {
  enum class E;
};

template <typename T> // <--
enum class A<T>::E {X, Y, Z};
```
)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139926



More information about the cfe-commits mailing list