[clang] f7c01c4 - [clang][bytecode] Reorder type checks in classify() (#139046)
via cfe-commits
cfe-commits at lists.llvm.org
Thu May 8 21:48:27 PDT 2025
Author: Timm Baeder
Date: 2025-05-09T06:48:24+02:00
New Revision: f7c01c40457c2f0fd20ab59244738ed61d4e989c
URL: https://github.com/llvm/llvm-project/commit/f7c01c40457c2f0fd20ab59244738ed61d4e989c
DIFF: https://github.com/llvm/llvm-project/commit/f7c01c40457c2f0fd20ab59244738ed61d4e989c.diff
LOG: [clang][bytecode] Reorder type checks in classify() (#139046)
Move the member pointer check further below and remove Complex/Vector
type checks and instead rely on the final return to handle those.
Added:
Modified:
clang/lib/AST/ByteCode/Context.cpp
Removed:
################################################################################
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;
}
More information about the cfe-commits
mailing list