[clang] [clang-tools-extra] [clang] Improve nested name specifier AST representation (PR #147835)

Andrey Ali Khan Bolshakov via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 17 10:29:30 PDT 2025


================
@@ -2586,8 +2561,9 @@ bool CXXNameMangler::mangleUnresolvedTypeOrSimpleId(QualType Ty,
   }
 
   case Type::InjectedClassName:
-    mangleSourceNameWithAbiTags(
-        cast<InjectedClassNameType>(Ty)->getDecl());
+    mangleSourceNameWithAbiTags(cast<InjectedClassNameType>(Ty)
+                                    ->getOriginalDecl()
+                                    ->getDefinitionOrSelf());
----------------
bolshakov-a wrote:

I've understood: there are specializations of `getAs` for the leaf non-sugar types:

https://github.com/llvm/llvm-project/blob/71925a90c8b713d8fccbfae496e10c68f80b932b/clang/include/clang/AST/Type.h#L3138-L3140

If you call `getAs<InjectedClassNameType>()` on a `Type` which is already `InjectedClassNameType`, you get its canonical type.

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


More information about the cfe-commits mailing list