@@ -6679,9 +6679,9 @@ inline bool Type::isTemplateTypeParmType() const {
6679
6679
}
6680
6680
6681
6681
inline bool Type::isSpecificBuiltinType (unsigned K) const {
6682
- if (const BuiltinType *BT = getAs<BuiltinType>())
6683
- if ( BT->getKind () == ( BuiltinType::Kind) K)
6684
- return true ;
6682
+ if (const BuiltinType *BT = getAs<BuiltinType>()) {
6683
+ return BT->getKind () == static_cast < BuiltinType::Kind>(K);
6684
+ }
6685
6685
return false ;
6686
6686
}
6687
6687
@@ -6700,9 +6700,7 @@ inline const BuiltinType *Type::getAsPlaceholderType() const {
6700
6700
6701
6701
inline bool Type::isSpecificPlaceholderType (unsigned K) const {
6702
6702
assert (BuiltinType::isPlaceholderTypeKind ((BuiltinType::Kind) K));
6703
- if (const auto *BT = dyn_cast<BuiltinType>(this ))
6704
- return (BT->getKind () == (BuiltinType::Kind) K);
6705
- return false ;
6703
+ return isSpecificBuiltinType (K);
6706
6704
}
6707
6705
6708
6706
inline bool Type::isNonOverloadPlaceholderType () const {
@@ -6712,34 +6710,24 @@ inline bool Type::isNonOverloadPlaceholderType() const {
6712
6710
}
6713
6711
6714
6712
inline bool Type::isVoidType () const {
6715
- if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6716
- return BT->getKind () == BuiltinType::Void;
6717
- return false ;
6713
+ return isSpecificBuiltinType (BuiltinType::Void);
6718
6714
}
6719
6715
6720
6716
inline bool Type::isHalfType () const {
6721
- if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6722
- return BT->getKind () == BuiltinType::Half;
6723
6717
// FIXME: Should we allow complex __fp16? Probably not.
6724
- return false ;
6718
+ return isSpecificBuiltinType (BuiltinType::Half) ;
6725
6719
}
6726
6720
6727
6721
inline bool Type::isFloat16Type () const {
6728
- if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6729
- return BT->getKind () == BuiltinType::Float16;
6730
- return false ;
6722
+ return isSpecificBuiltinType (BuiltinType::Float16);
6731
6723
}
6732
6724
6733
6725
inline bool Type::isFloat128Type () const {
6734
- if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6735
- return BT->getKind () == BuiltinType::Float128;
6736
- return false ;
6726
+ return isSpecificBuiltinType (BuiltinType::Float128);
6737
6727
}
6738
6728
6739
6729
inline bool Type::isNullPtrType () const {
6740
- if (const auto *BT = getAs<BuiltinType>())
6741
- return BT->getKind () == BuiltinType::NullPtr;
6742
- return false ;
6730
+ return isSpecificBuiltinType (BuiltinType::NullPtr);
6743
6731
}
6744
6732
6745
6733
bool IsEnumDeclComplete (EnumDecl *);
0 commit comments