================
@@ -2289,6 +2289,33 @@ bool Type::isFloatingType() const {
   return false;
 }
 
+bool Type::isCXX23StandardFloatingPointType(const ASTContext &Ctx) const {
+  if (!Ctx.getLangOpts().CPlusPlus23)
+    return false;
+  if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
+    return BT->getKind() >= BuiltinType::Float &&
+           BT->getKind() <= BuiltinType::LongDouble;
+  if (const auto *CT = dyn_cast<ComplexType>(CanonicalType))
+    return CT->getElementType()->isCXX23StandardFloatingPointType(Ctx);
+  return false;
+}
+
+bool Type::isCXX23ExtendedFloatingPointType(const ASTContext &Ctx) const {
+  if (!Ctx.getLangOpts().CPlusPlus23)
+    return false;
+  if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
+    return BT->getKind() == BuiltinType::Float16 ||
+           BT->getKind() == BuiltinType::BFloat16;
+  if (const auto *CT = dyn_cast<ComplexType>(CanonicalType))
+    return CT->getElementType()->isCXX23ExtendedFloatingPointType(Ctx);
+  return false;
+}
+
+bool Type::isCXX23FloatingPointType(const ASTContext &Ctx) const {
+  return isCXX23StandardFloatingPointType(Ctx) ||
+         isCXX23ExtendedFloatingPointType(Ctx);
+}
+
----------------
cor3ntin wrote:

Can we make this a conforming extension?

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

Reply via email to