aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Type.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-09-03 01:05:48 +0000
committerChris Lattner <sabre@nondot.org>2002-09-03 01:05:48 +0000
commitce8a14915d2971039b576e03a32e0ba7c421dba7 (patch)
tree148593a8f58b5bbac0171ded5dcf3e9e60b2eee5 /include/llvm/Type.h
parent625ea21205d1fb6f175e22477f55dd485b7c65c4 (diff)
- Renamed Type::isIntegral() to Type::isInteger()
- Added new method Type::isIntegral() that is the same as isInteger, but also accepts bool. SCVS: ---------------------------------------------------------------------- git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3572 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Type.h')
-rw-r--r--include/llvm/Type.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/include/llvm/Type.h b/include/llvm/Type.h
index a86c220382..3cf08a3bb5 100644
--- a/include/llvm/Type.h
+++ b/include/llvm/Type.h
@@ -121,19 +121,28 @@ public:
/// getDescription - Return the string representation of the type...
inline const std::string &getDescription() const { return Desc; }
- /// isSigned - Return whether a numeric type is signed.
+ /// isSigned - Return whether an integral numeric type is signed. This is
+ /// true for SByteTy, ShortTy, IntTy, LongTy. Note that this is not true for
+ /// Float and Double.
+ //
virtual bool isSigned() const { return 0; }
- /// isUnsigned - Return whether a numeric type is unsigned. This is not
- /// quite the complement of isSigned... nonnumeric types return false as they
- /// do with isSigned.
+ /// isUnsigned - Return whether a numeric type is unsigned. This is not quite
+ /// the complement of isSigned... nonnumeric types return false as they do
+ /// with isSigned. This returns true for UByteTy, UShortTy, UIntTy, and
+ /// ULongTy
///
virtual bool isUnsigned() const { return 0; }
- /// isIntegral - Equilivent to isSigned() || isUnsigned, but with only a
+ /// isInteger - Equilivent to isSigned() || isUnsigned(), but with only a
/// single virtual function invocation.
///
- virtual bool isIntegral() const { return 0; }
+ virtual bool isInteger() const { return 0; }
+
+ /// isIntegral - Returns true if this is an integral type, which is either
+ /// BoolTy or one of the Integer types.
+ ///
+ bool isIntegral() const { return isInteger() || this == BoolTy; }
/// isFloatingPoint - Return true if this is one of the two floating point
/// types