diff options
author | Chris Lattner <sabre@nondot.org> | 2004-07-08 17:29:36 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-07-08 17:29:36 +0000 |
commit | e1d6799661f9b7fe7f5729005f9ff4afb9df9592 (patch) | |
tree | 9271fa804a744ef184f7b23548f24134ecf59446 /include/llvm/Type.h | |
parent | c29af0084fc35259ec71ac49d607543d801c13d5 (diff) | |
download | external_llvm-e1d6799661f9b7fe7f5729005f9ff4afb9df9592.zip external_llvm-e1d6799661f9b7fe7f5729005f9ff4afb9df9592.tar.gz external_llvm-e1d6799661f9b7fe7f5729005f9ff4afb9df9592.tar.bz2 |
isSigned/isUnsigned/isInteger methods do not need to be virtual
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14694 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Type.h')
-rw-r--r-- | include/llvm/Type.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/include/llvm/Type.h b/include/llvm/Type.h index dffe258..b558eb1 100644 --- a/include/llvm/Type.h +++ b/include/llvm/Type.h @@ -94,8 +94,7 @@ private: const Type *getForwardedTypeInternal() const; protected: - /// ctor is protected, so only subclasses can create Type objects... - Type(const std::string& Name, TypeID id ); + Type(const std::string& Name, TypeID id); virtual ~Type() {} @@ -158,19 +157,24 @@ public: /// true for SByteTy, ShortTy, IntTy, LongTy. Note that this is not true for /// Float and Double. /// - virtual bool isSigned() const { return 0; } + bool isSigned() const { + return ID == SByteTyID || ID == ShortTyID || + ID == IntTyID || ID == LongTyID; + } /// 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; } + bool isUnsigned() const { + return ID == UByteTyID || ID == UShortTyID || + ID == UIntTyID || ID == ULongTyID; + } - /// isInteger - Equilivent to isSigned() || isUnsigned(), but with only a - /// single virtual function invocation. + /// isInteger - Equilivant to isSigned() || isUnsigned() /// - virtual bool isInteger() const { return 0; } + bool isInteger() const { return ID >= UByteTyID && ID <= LongTyID; } /// isIntegral - Returns true if this is an integral type, which is either /// BoolTy or one of the Integer types. |