diff --git a/clang-tools-extra/clangd/SemanticHighlighting.cpp b/clang-tools-extra/clangd/SemanticHighlighting.cpp --- a/clang-tools-extra/clangd/SemanticHighlighting.cpp +++ b/clang-tools-extra/clangd/SemanticHighlighting.cpp @@ -229,6 +229,10 @@ addToken(Loc, HighlightingKind::Variable); return; } + if (isa(D)) { + addToken(Loc, HighlightingKind::Variable); + return; + } if (isa(D)) { addToken(Loc, HighlightingKind::Function); return; diff --git a/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp b/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp --- a/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp +++ b/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp @@ -431,6 +431,21 @@ assert($Variable[[x]] != $Variable[[y]]); assert($Variable[[x]] != $Function[[f]]()); } + )cpp", + R"cpp( + struct $Class[[S]] { + $Primitive[[float]] $Field[[Value]]; + $Class[[S]] *$Field[[Next]]; + }; + $Class[[S]] $Variable[[Global]][2] = {$Class[[S]](), $Class[[S]]()}; + $Primitive[[void]] $Function[[f]]($Class[[S]] $Parameter[[P]]) { + $Primitive[[int]] $Variable[[A]][2] = {1,2}; + auto [$Variable[[B1]], $Variable[[B2]]] = $Variable[[A]]; + auto [$Variable[[G1]], $Variable[[G2]]] = $Variable[[Global]]; + $Class[[auto]] [$Variable[[P1]], $Variable[[P2]]] = $Parameter[[P]]; + // Highlights references to BindingDecls. + $Variable[[B1]]++; + } )cpp"}; for (const auto &TestCase : TestCases) { checkHighlightings(TestCase);