[clang] [clang][bytecode] Reorder type checks in classify() (PR #139046)
via cfe-commits
cfe-commits at lists.llvm.org
Thu May 8 01:22:28 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Timm Baeder (tbaederr)
<details>
<summary>Changes</summary>
Move the member pointer check further below and remove Complex/Vector type checks and instead rely on the final return to handle those.
---
Full diff: https://github.com/llvm/llvm-project/pull/139046.diff
1 Files Affected:
- (modified) clang/lib/AST/ByteCode/Context.cpp (+6-9)
``````````diff
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;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/139046
More information about the cfe-commits
mailing list