[clang] [RFC] Initial implementation of P2719 (PR #113510)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 30 02:29:59 PST 2025
================
@@ -3128,6 +3128,26 @@ bool Type::isStdByteType() const {
return false;
}
+static const TemplateDecl *getSpecializedTemplateType(const Type *T) {
+ const Type *DesugaredType = T->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 *STDecl = getSpecializedTemplateType(this);
+ if (!STDecl)
+ return false;
+ IdentifierInfo *II = STDecl->getIdentifier();
+ return II && STDecl->isInStdNamespace() && II->isStr("type_identity");
----------------
cor3ntin wrote:
can II actually be null ?
https://github.com/llvm/llvm-project/pull/113510
More information about the cfe-commits
mailing list