Add a new predicate for integer type equality tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92759 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2010-01-05 20:04:48 +00:00
parent 6786d5e183
commit 13be48701d
2 changed files with 8 additions and 0 deletions

View File

@ -217,6 +217,9 @@ public:
///
bool isInteger() const { return ID == IntegerTyID; }
/// isInteger - Return true if this is an IntegerType of the specified width.
bool isInteger(unsigned Bitwidth) const;
/// isIntOrIntVector - Return true if this is an integer type or a vector of
/// integer types.
///

View File

@ -124,6 +124,11 @@ const Type *Type::getScalarType() const {
return this;
}
/// isInteger - Return true if this is an IntegerType of the specified width.
bool Type::isInteger(unsigned Bitwidth) const {
return isInteger() && cast<IntegerType>(this)->getBitWidth() == Bitwidth;
}
/// isIntOrIntVector - Return true if this is an integer type or a vector of
/// integer types.
///