nridge added a comment.

I played around with the patch a little, and found some cases where semantic 
tokens should be present but aren't:

  template <typename T> class S {
  public:
    template <typename U> class Nested;
  };
  
  // explicit specialization
  // parameter list is missing semantic tokens
  template <>
  class S<int> {};
  
  // partial specialization
  // parameter and argument lists are missing semantic tokens
  template <typename T>
  class S<T*> {};
  
  // nested template definition
  // outer parameter list is missing semantic tokens
  template <typename T>
  template <typename U>
  class S<T>::Nested {};
  
  // nested template specialization
  // both parameter lists are missing semantic tokens
  template <>
  template <>
  class S<float>::Nested<float> {};
  
  template <typename T> void foo();
  
  void bar() {
    // function with call explicit template arguments
    // argument list is missing semantic tokens
    foo<int>();
  }
  
  template <typename T> constexpr int V = 42;
  
  // variable template reference
  // argument list is missing semantic tokens
  constexpr int Y = V<char>;
  
  // variable template specialization
  // parameter and argument lists are missing semantic tokens
  template <>
  constexpr int V<int> = 5;
  
  // variable template partial specialization
  // parameter and argument lists are missing semantic tokens
  template <typename T>
  constexpr int V<T*> = 6;
  
  template <typename T>
  concept C = true;
  
  // constrained template
  // concept's argument list is missing semantic tokens
  template <typename T> requires C<T>
  class Z {};



================
Comment at: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp:939
+            
$Class[[S]]$Bracket[[<]]$Class[[S]]$Bracket[[<]]int$Bracket[[>]]$Bracket[[>]] 
$LocalVariable_def[[s1]];
+            $Class[[S]]<$Class[[S]]$Bracket[[<]]int$Bracket[[>]]\
+> $LocalVariable_def[[s2]];
----------------
It's easy to overlook this, could you please add a comment similar to:

```
// Semantic tokens for outer argument list are deliberately omitted to
// avoid having to handle line-continuations
```

(feel free to reword to better express the reason)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139926

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

Reply via email to