Index: clang-tools-extra/trunk/clangd/SemanticHighlighting.cpp =================================================================== --- clang-tools-extra/trunk/clangd/SemanticHighlighting.cpp +++ clang-tools-extra/trunk/clangd/SemanticHighlighting.cpp @@ -11,6 +11,7 @@ #include "Protocol.h" #include "SourceCode.h" #include "clang/AST/ASTContext.h" +#include "clang/AST/DeclCXX.h" #include "clang/AST/RecursiveASTVisitor.h" #include @@ -136,6 +137,13 @@ HighlightingTokenCollector>::TraverseNestedNameSpecifierLoc(NNSLoc); } + bool TraverseConstructorInitializer(CXXCtorInitializer *CI) { + if (const FieldDecl *FD = CI->getMember()) + addToken(CI->getSourceLocation(), FD); + return RecursiveASTVisitor< + HighlightingTokenCollector>::TraverseConstructorInitializer(CI); + } + private: void addTypeLoc(SourceLocation Loc, const TypeLoc &TL) { if (const Type *TP = TL.getTypePtr()) { Index: clang-tools-extra/trunk/clangd/unittests/SemanticHighlightingTests.cpp =================================================================== --- clang-tools-extra/trunk/clangd/unittests/SemanticHighlightingTests.cpp +++ clang-tools-extra/trunk/clangd/unittests/SemanticHighlightingTests.cpp @@ -285,6 +285,24 @@ }; $Class[[A]] &$Class[[A]]::operator=($Class[[A]] &&$Variable[[O]]) = default; + )cpp", + R"cpp( + enum $Enum[[En]] { + $EnumConstant[[EC]], + }; + class $Class[[Foo]] {}; + class $Class[[Bar]] { + $Class[[Foo]] $Field[[Fo]]; + $Enum[[En]] $Field[[E]]; + $Primitive[[int]] $Field[[I]]; + $Class[[Bar]] ($Class[[Foo]] $Variable[[F]], + $Enum[[En]] $Variable[[E]]) + : $Field[[Fo]] ($Variable[[F]]), $Field[[E]] ($Variable[[E]]), + $Field[[I]] (123) {} + }; + class $Class[[Bar2]] : public $Class[[Bar]] { + $Class[[Bar2]]() : $Class[[Bar]]($Class[[Foo]](), $EnumConstant[[EC]]) {} + }; )cpp"}; for (const auto &TestCase : TestCases) { checkHighlightings(TestCase);