https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/218397
Always get the canonical type and handle some more builtin types in canClassify(). >From d2f34460ae120749c46d4608dd70313cbd68bd6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]> Date: Mon, 24 Aug 2026 14:06:41 +0200 Subject: [PATCH] [clang][bytecode] Optimize canClassify/classify Always get the canonical type and handle some more builtin types in canClassify(). --- clang/lib/AST/ByteCode/Context.cpp | 8 +++----- clang/lib/AST/ByteCode/Context.h | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/clang/lib/AST/ByteCode/Context.cpp b/clang/lib/AST/ByteCode/Context.cpp index 0678b07d0bbf2..96f26a6a7a083 100644 --- a/clang/lib/AST/ByteCode/Context.cpp +++ b/clang/lib/AST/ByteCode/Context.cpp @@ -463,8 +463,9 @@ static PrimType integralTypeToPrimTypeU(unsigned BitWidth) { } OptPrimType Context::classify(QualType T) const { + T = T.getCanonicalType(); - if (const auto *BT = dyn_cast<BuiltinType>(T.getCanonicalType())) { + if (const auto *BT = dyn_cast<BuiltinType>(T)) { auto Kind = BT->getKind(); if (Kind == BuiltinType::Bool) return PT_Bool; @@ -528,10 +529,7 @@ OptPrimType Context::classify(QualType T) const { if (const auto *AT = T->getAs<AtomicType>()) return classify(AT->getValueType()); - if (const auto *DT = dyn_cast<DecltypeType>(T)) - return classify(DT->getUnderlyingType()); - - if (const auto *OBT = T.getCanonicalType()->getAs<OverflowBehaviorType>()) + if (const auto *OBT = T->getAs<OverflowBehaviorType>()) return classify(OBT->getUnderlyingType()); if (T->isObjCObjectPointerType() || T->isBlockPointerType()) diff --git a/clang/lib/AST/ByteCode/Context.h b/clang/lib/AST/ByteCode/Context.h index eaace87ceae9d..586b600614596 100644 --- a/clang/lib/AST/ByteCode/Context.h +++ b/clang/lib/AST/ByteCode/Context.h @@ -131,7 +131,8 @@ class Context final { if (const auto *BT = dyn_cast<BuiltinType>(T)) { if (BT->isInteger() || BT->isFloatingPoint()) return true; - if (BT->getKind() == BuiltinType::Bool) + if (BT->getKind() == BuiltinType::NullPtr || + BT->getKind() == BuiltinType::BoundMember) return true; } if (T->isPointerOrReferenceType()) _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
