[llvm-commits] CVS: llvm/include/llvm/Constants.h

Chris Lattner lattner at cs.uiuc.edu
Tue Aug 3 19:42:33 PDT 2004



Changes in directory llvm/include/llvm:

Constants.h updated: 1.52 -> 1.53
---
Log message:

Add a special version of getType for ConstantPointerNull, exposing the fact
that all Null pointers have pointer type


---
Diffs of the changes:  (+7 -0)

Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.52 llvm/include/llvm/Constants.h:1.53
--- llvm/include/llvm/Constants.h:1.52	Mon Jul 19 16:11:45 2004
+++ llvm/include/llvm/Constants.h	Tue Aug  3 21:42:17 2004
@@ -454,6 +454,13 @@
 
   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<const PointerType*>(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) {






More information about the llvm-commits mailing list