================ @@ -3130,6 +3130,30 @@ bool Type::isStdByteType() const { return false; } +const TemplateDecl *Type::getSpecializedTemplateDecl() const { + const Type *DesugaredType = getUnqualifiedDesugaredType(); + if (const auto *Specialization = + DesugaredType->getAs<TemplateSpecializationType>()) + return Specialization->getTemplateName().getAsTemplateDecl(); + if (const auto *Record = DesugaredType->getAsCXXRecordDecl()) { + if (const auto *CTS = dyn_cast<ClassTemplateSpecializationDecl>(Record)) + return CTS->getSpecializedTemplate(); + } + return nullptr; +} + +bool Type::isTypeIdentitySpecialization() const { + const TemplateDecl *SpecializedDecl = getSpecializedTemplateDecl(); + if (!SpecializedDecl) + return false; + IdentifierInfo *II = SpecializedDecl->getIdentifier(); + if (!II) + return false; + if (!SpecializedDecl->isInStdNamespace()) + return false; + return II->isStr("type_identity"); ---------------- cor3ntin wrote:
Might as well collapse that on a single line https://github.com/llvm/llvm-project/pull/113510 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits