forked from OSchip/llvm-project
In hasPlaceholderType(Kind) and isSpecificPlaceholderType(Kind), assert
that the parameter is actually a placeholder type kind. llvm-svn: 142312
This commit is contained in:
parent
7e16493c9b
commit
1bb357929d
|
@ -398,6 +398,7 @@ public:
|
|||
|
||||
/// \brief Returns whether this expression has a specific placeholder type.
|
||||
bool hasPlaceholderType(BuiltinType::Kind K) const {
|
||||
assert(BuiltinType::isPlaceholderTypeKind(K));
|
||||
if (const BuiltinType *BT = dyn_cast<BuiltinType>(getType()))
|
||||
return BT->getKind() == K;
|
||||
return false;
|
||||
|
|
|
@ -1790,11 +1790,16 @@ public:
|
|||
return getKind() >= Half && getKind() <= LongDouble;
|
||||
}
|
||||
|
||||
/// Determines whether the given kind corresponds to a placeholder type.
|
||||
static bool isPlaceholderTypeKind(Kind K) {
|
||||
return K >= Overload;
|
||||
}
|
||||
|
||||
/// Determines whether this type is a placeholder type, i.e. a type
|
||||
/// which cannot appear in arbitrary positions in a fully-formed
|
||||
/// expression.
|
||||
bool isPlaceholderType() const {
|
||||
return getKind() >= Overload;
|
||||
return isPlaceholderTypeKind(getKind());
|
||||
}
|
||||
|
||||
static bool classof(const Type *T) { return T->getTypeClass() == Builtin; }
|
||||
|
@ -4775,6 +4780,7 @@ inline const BuiltinType *Type::getAsPlaceholderType() const {
|
|||
}
|
||||
|
||||
inline bool Type::isSpecificPlaceholderType(unsigned K) const {
|
||||
assert(BuiltinType::isPlaceholderTypeKind((BuiltinType::Kind) K));
|
||||
if (const BuiltinType *BT = dyn_cast<BuiltinType>(this))
|
||||
return (BT->getKind() == (BuiltinType::Kind) K);
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue