summaryrefslogtreecommitdiff
path: root/include/llvm/Type.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-10-02 03:41:24 +0000
committerChris Lattner <sabre@nondot.org>2001-10-02 03:41:24 +0000
commitb00c582b6d40e6b9ff2d1ed4f5eaf7930e792ace (patch)
tree44b5f879c16e7ecb2e9334ad120e3454270e1bb3 /include/llvm/Type.h
parent1d87bcf4909b06dcd86320722653341f08b8b396 (diff)
downloadllvm-b00c582b6d40e6b9ff2d1ed4f5eaf7930e792ace.tar.gz
llvm-b00c582b6d40e6b9ff2d1ed4f5eaf7930e792ace.tar.bz2
llvm-b00c582b6d40e6b9ff2d1ed4f5eaf7930e792ace.tar.xz
Commit more code over to new cast style
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@697 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Type.h')
-rw-r--r--include/llvm/Type.h35
1 files changed, 6 insertions, 29 deletions
diff --git a/include/llvm/Type.h b/include/llvm/Type.h
index 687b12afb0..cc682669ce 100644
--- a/include/llvm/Type.h
+++ b/include/llvm/Type.h
@@ -189,42 +189,19 @@ public:
inline bool isDerivedType() const { return ID >= FirstDerivedTyID; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool isa(const Type *T) { return true; }
- static inline bool isa(const Value *V) {
+ static inline bool classof(const Type *T) { return true; }
+ static inline bool classof(const Value *V) {
return V->getValueType() == Value::TypeVal;
}
- // Methods for determining the subtype of this Type. The cast*() methods are
- // equilivent to using dynamic_cast<>... if the cast is successful, this is
- // returned, otherwise you get a null pointer, allowing expressions like this:
- //
- // if (MethodType *MTy = Ty->dyncastMethodType()) { ... }
- //
- // This section also defines a family of isArrayType(), isLabelType(),
- // etc functions...
- //
- // The family of functions Ty->cast<type>() is used in the same way as the
- // Ty->dyncast<type>() instructions, but they assert the expected type instead
- // of checking it at runtime.
+ // Methods for determining the subtype of this Type. This section defines a
+ // family of isArrayType(), isLabelType(), etc functions...
//
#define HANDLE_PRIM_TYPE(NAME, SIZE) \
inline bool is##NAME##Type() const { return ID == NAME##TyID; }
#define HANDLE_DERV_TYPE(NAME, CLASS) \
- inline bool is##NAME##Type() const { return ID == NAME##TyID; } \
- inline const CLASS *dyncast##NAME##Type() const { /*const version */ \
- return is##NAME##Type() ? (const CLASS*)this : 0; \
- } \
- inline CLASS *dyncast##NAME##Type() { /* nonconst version */ \
- return is##NAME##Type() ? (CLASS*)this : 0; \
- } \
- inline const CLASS *cast##NAME##Type() const { /*const version */ \
- assert(is##NAME##Type() && "Expected TypeTy: " #NAME); \
- return (const CLASS*)this; \
- } \
- inline CLASS *cast##NAME##Type() { /* nonconst version */ \
- assert(is##NAME##Type() && "Expected TypeTy: " #NAME); \
- return (CLASS*)this; \
- }
+ inline bool is##NAME##Type() const { return ID == NAME##TyID; }
+
#include "llvm/Type.def"
private: