[clang] [Index] Report references through UsingType (PR #228823)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 11 21:55:44 PST 2026


================
@@ -81,6 +81,26 @@ class TypeIndexer : public RecursiveASTVisitor<TypeIndexer> {
     return true;
   }
 
+  bool VisitUsingTypeLoc(UsingTypeLoc TL) {
+    // A type found via a using-declaration, e.g. `ns2::A` after
+    // `namespace ns2 { using ns1::A; }`. Like DeclRefExpr, report the target
+    // declaration rather than the UsingShadowDecl.
+    SourceLocation Loc = TL.getNameLoc();
+    NamedDecl *ND = TL.getDecl()->getTargetDecl();
----------------
MaskRay wrote:

Yes, thanks. Refactored the typedef/using path to a helper so both look through transparent tags. Added test.

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


More information about the cfe-commits mailing list