Skip to content

Commit f7c01c4

Browse files
authored
[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.
1 parent a1beb61 commit f7c01c4

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

clang/lib/AST/ByteCode/Context.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,6 @@ std::optional<PrimType> Context::classify(QualType T) const {
219219
if (T->isBooleanType())
220220
return PT_Bool;
221221

222-
// We map these to primitive arrays.
223-
if (T->isAnyComplexType() || T->isVectorType())
224-
return std::nullopt;
225-
226222
if (T->isSignedIntegerOrEnumerationType()) {
227223
switch (Ctx.getIntWidth(T)) {
228224
case 64:
@@ -259,13 +255,9 @@ std::optional<PrimType> Context::classify(QualType T) const {
259255
if (T->isNullPtrType())
260256
return PT_Ptr;
261257

262-
if (T->isFloatingType())
258+
if (T->isRealFloatingType())
263259
return PT_Float;
264260

265-
if (T->isSpecificBuiltinType(BuiltinType::BoundMember) ||
266-
T->isMemberPointerType())
267-
return PT_MemberPtr;
268-
269261
if (T->isFunctionPointerType() || T->isFunctionReferenceType() ||
270262
T->isFunctionType() || T->isBlockPointerType())
271263
return PT_Ptr;
@@ -279,9 +271,14 @@ std::optional<PrimType> Context::classify(QualType T) const {
279271
if (const auto *DT = dyn_cast<DecltypeType>(T))
280272
return classify(DT->getUnderlyingType());
281273

274+
if (T->isSpecificBuiltinType(BuiltinType::BoundMember) ||
275+
T->isMemberPointerType())
276+
return PT_MemberPtr;
277+
282278
if (T->isFixedPointType())
283279
return PT_FixedPoint;
284280

281+
// Vector and complex types get here.
285282
return std::nullopt;
286283
}
287284

0 commit comments

Comments
 (0)