https://github.com/tbaederr created 
https://github.com/llvm/llvm-project/pull/139046

Move the member pointer check further below and remove Complex/Vector type 
checks and instead rely on the final return to handle those.

>From 7ec6c9f5508766ffa1860fe84ac7c0c2a7e64d8e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbae...@redhat.com>
Date: Wed, 7 May 2025 12:17:43 +0200
Subject: [PATCH] [clang][bytecode] Reorder type checks in classify()

Move the member pointer check further below and remove
Complex/Vector type checks and instead rely on the final return to
handle those.
---
 clang/lib/AST/ByteCode/Context.cpp | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/clang/lib/AST/ByteCode/Context.cpp 
b/clang/lib/AST/ByteCode/Context.cpp
index db9df7abf7a29..dae94fc9829c7 100644
--- a/clang/lib/AST/ByteCode/Context.cpp
+++ b/clang/lib/AST/ByteCode/Context.cpp
@@ -219,10 +219,6 @@ std::optional<PrimType> Context::classify(QualType T) 
const {
   if (T->isBooleanType())
     return PT_Bool;
 
-  // We map these to primitive arrays.
-  if (T->isAnyComplexType() || T->isVectorType())
-    return std::nullopt;
-
   if (T->isSignedIntegerOrEnumerationType()) {
     switch (Ctx.getIntWidth(T)) {
     case 64:
@@ -259,13 +255,9 @@ std::optional<PrimType> Context::classify(QualType T) 
const {
   if (T->isNullPtrType())
     return PT_Ptr;
 
-  if (T->isFloatingType())
+  if (T->isRealFloatingType())
     return PT_Float;
 
-  if (T->isSpecificBuiltinType(BuiltinType::BoundMember) ||
-      T->isMemberPointerType())
-    return PT_MemberPtr;
-
   if (T->isFunctionPointerType() || T->isFunctionReferenceType() ||
       T->isFunctionType() || T->isBlockPointerType())
     return PT_Ptr;
@@ -279,9 +271,14 @@ std::optional<PrimType> Context::classify(QualType T) 
const {
   if (const auto *DT = dyn_cast<DecltypeType>(T))
     return classify(DT->getUnderlyingType());
 
+  if (T->isSpecificBuiltinType(BuiltinType::BoundMember) ||
+      T->isMemberPointerType())
+    return PT_MemberPtr;
+
   if (T->isFixedPointType())
     return PT_FixedPoint;
 
+  // Vector and complex types get here.
   return std::nullopt;
 }
 

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to