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(T.getCanonicalType())) { + if (const auto *BT = dyn_cast(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()) return classify(AT->getValueType()); - if (const auto *DT = dyn_cast(T)) - return classify(DT->getUnderlyingType()); - - if (const auto *OBT = T.getCanonicalType()->getAs()) + if (const auto *OBT = T->getAs()) 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(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())