================ @@ -3134,6 +3134,31 @@ bool Type::isStdByteType() const { return false; } +bool Type::isDestroyingDeleteT() const { + auto *RD = getAsCXXRecordDecl(); + return RD && RD->isInStdNamespace() && RD->getIdentifier() && + RD->getIdentifier()->isStr("destroying_delete_t"); +} + +TemplateDecl *Type::getSpecializedTemplateDecl() const { + auto UnderlyingType = getCanonicalTypeInternal(); + if (auto *TST = UnderlyingType->getAs<TemplateSpecializationType>()) + return TST->getTemplateName().getAsTemplateDecl(); + if (auto *RT = UnderlyingType->getAsCXXRecordDecl()) { + if (auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(RT)) + return CTSD->getSpecializedTemplate(); + } + return nullptr; +} + +bool Type::isTypeIdentitySpecialization() const { + const TemplateDecl *STDecl = getSpecializedTemplateDecl(); + if (!STDecl) + return false; + IdentifierInfo *II = STDecl->getIdentifier(); + return STDecl->isInStdNamespace() && II->isStr("type_identity"); +} + ---------------- ojhunt wrote:
@cor3ntin Ok, I worked out how I ended up here - I originally had multiple "isX" methods, one on Sema one on the type or decl, but reduced it to a single shared implementation in response to one of the first reviews - they're modeled after the existing Type::isFoo methods above. As these functions are not always queried when there is a Sema object available, we'd need to thread a Sema reference through a bunch of methods on FunctionDecl and MethodDecl which does not seem to be something that is done on any of the other methods. 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