From: Chris Lattner Date: Wed, 4 Aug 2004 02:42:17 +0000 (+0000) Subject: Add a special version of getType for ConstantPointerNull, exposing the fact X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0f42ba67771627453187e44fea935d6bab7a8152;p=oota-llvm.git Add a special version of getType for ConstantPointerNull, exposing the fact that all Null pointers have pointer type git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15458 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h index 230d6ffb478..6afaa065927 100644 --- a/include/llvm/Constants.h +++ b/include/llvm/Constants.h @@ -454,6 +454,13 @@ public: virtual void destroyConstant(); + /// getType - Specialize the getType() method to always return an PointerType, + /// which reduces the amount of casting needed in parts of the compiler. + /// + inline const PointerType *getType() const { + return reinterpret_cast(Value::getType()); + } + /// Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const ConstantPointerNull *) { return true; } static bool classof(const Value *V) {