diff --git a/clang-tools-extra/clangd/unittests/SelectionTests.cpp b/clang-tools-extra/clangd/unittests/SelectionTests.cpp --- a/clang-tools-extra/clangd/unittests/SelectionTests.cpp +++ b/clang-tools-extra/clangd/unittests/SelectionTests.cpp @@ -520,6 +520,13 @@ )cpp", "TypedefTypeLoc"}, + {R"cpp( + namespace ns { class Foo {}; } + using ns::Foo; + class [[^Foo]] foo; + )cpp", + "UsingTypeLoc"}, + // lambda captured var-decl {R"cpp( void test(int bar) { diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -6256,6 +6256,9 @@ void VisitTagTypeLoc(TagTypeLoc TL) { TL.setNameLoc(DS.getTypeSpecTypeNameLoc()); } + void VisitUsingTypeLoc(UsingTypeLoc TL) { + TL.setNameLoc(DS.getTypeSpecTypeNameLoc()); + } void VisitAtomicTypeLoc(AtomicTypeLoc TL) { // An AtomicTypeLoc can come from either an _Atomic(...) type specifier // or an _Atomic qualifier.