diff options
author | Chris Lattner <sabre@nondot.org> | 2001-07-20 19:12:34 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-07-20 19:12:34 +0000 |
commit | edde66d9e02c917c358b7bec38e84feacca4d797 (patch) | |
tree | 5a099c2d6fd59597b94e08fd45f64a45deefb650 /include | |
parent | 781532e45bbf739b4776e8b4a4c388cf8ac3d087 (diff) | |
download | llvm-edde66d9e02c917c358b7bec38e84feacca4d797.tar.gz llvm-edde66d9e02c917c358b7bec38e84feacca4d797.tar.bz2 llvm-edde66d9e02c917c358b7bec38e84feacca4d797.tar.xz |
Change is*Type to be a casting convertion operator
Add a new isIntegral virtual function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Type.h | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/include/llvm/Type.h b/include/llvm/Type.h index 27448a4bf9..9bd5b74b21 100644 --- a/include/llvm/Type.h +++ b/include/llvm/Type.h @@ -21,6 +21,10 @@ namespace opt { class ConstRules; } class ConstPoolVal; +class MethodType; +class ArrayType; +class StructType; +class PointerType; class Type : public Value { public: @@ -77,6 +81,11 @@ public: // do with isSigned. // virtual bool isUnsigned() const { return 0; } + + // isIntegral - Equilivent to isSigned() || isUnsigned, but with only a single + // virtual function invocation. + // + virtual bool isIntegral() const { return 0; } inline unsigned getUniqueID() const { return UID; } inline PrimitiveID getPrimitiveID() const { return ID; } @@ -108,11 +117,19 @@ public: // These are the builtin types that are always available... inline bool isPrimitiveType() const { return ID < FirstDerivedTyID; } inline bool isLabelType() const { return this == LabelTy; } - inline bool isMethodType() const { return ID == MethodTyID; } + inline const MethodType *isMethodType() const { + return ID == MethodTyID ? (const MethodType*)this : 0; + } inline bool isModuleType() const { return ID == ModuleTyID; } - inline bool isArrayType() const { return ID == ArrayTyID; } - inline bool isPointerType() const { return ID == PointerTyID; } - inline bool isStructType() const { return ID == StructTyID; } + inline const ArrayType *isArrayType() const { + return ID == ArrayTyID ? (const ArrayType*)this : 0; + } + inline const PointerType *isPointerType() const { + return ID == PointerTyID ? (const PointerType*)this : 0; + } + inline const StructType *isStructType() const { + return ID == StructTyID ? (const StructType*)this : 0; + } }; #endif |