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

Not always.

I mean you could certainly attempt to define an `InjectedClassNameType` whose 
declaration necessarily is the definition.

This would cause many annoyances, most of them surmountable, as you wouldn't be 
able to form a type to an arbitrary declaration (which we do offhandedly in 
error recovery and printing diagnostics), and the type would play by different 
rules than other tag types.

Though I think at the end, you would come to the problem of demoted 
definitions, which come up for example when merging definitions from the GMF of 
different modules. You would have to throw away the ability to represent an 
InjectedClassNameType pointing to a demoted definition.

https://github.com/llvm/llvm-project/pull/147835
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to