[clang-tools-extra] [clangd] Include the operator name in documentHighlight (PR #220518)

Aleksandr Platonov via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 4 02:20:42 PDT 2026


https://github.com/ArcsinX commented:

The current solution seems a bit inconsistent to me.

1. We highlight the `operator` declaration, yet the same issue remains with the usages.

```cpp
struct S {
  void [[operator]] [[+]](int); // operator and + in the range
};
void f(S a, int b) {
  a.[[operator]] +(b); // only operator in the range
}
```

2. find-all-references/definition still return range of `operator` keyword only.

3. Literal operators are no covered

```cpp
long double [[operator]]""_test(long double); // only operator keyword in the range
// (however hover on _test works)
auto Test = [[1.0_test]];
```

4. Conversion operator are not covered

```cpp
struct S {
  [[operator]] int(); // only operator keyword in the range
};
S A;
int B = [[A]];
```

https://github.com/llvm/llvm-project/pull/220518


More information about the cfe-commits mailing list