[llvm-commits] CVS: llvm/include/llvm/Type.h
Chris Lattner
lattner at cs.uiuc.edu
Thu Jul 8 12:30:01 PDT 2004
Changes in directory llvm/include/llvm:
Type.h updated: 1.48 -> 1.49
---
Log message:
isSigned/isUnsigned/isInteger methods do not need to be virtual
---
Diffs of the changes: (+11 -7)
Index: llvm/include/llvm/Type.h
diff -u llvm/include/llvm/Type.h:1.48 llvm/include/llvm/Type.h:1.49
--- llvm/include/llvm/Type.h:1.48 Thu Jul 8 11:09:38 2004
+++ llvm/include/llvm/Type.h Thu Jul 8 12:29:36 2004
@@ -94,8 +94,7 @@
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 @@
/// 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.
More information about the llvm-commits
mailing list