Add a new Type::getPointerTo method, which is shorthand for
authorChris Lattner <sabre@nondot.org>
Fri, 10 Apr 2009 06:42:02 +0000 (06:42 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 10 Apr 2009 06:42:02 +0000 (06:42 +0000)
llvm::PointerType::get().  Patch by Anders Johnsen!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68772 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Type.h
lib/VMCore/Type.cpp

index a284d80bb5c3c45b00f3eae3de0d4049461c0bf7..e80c8760691fe616bc940291f048a814b0841d6e 100644 (file)
@@ -364,6 +364,10 @@ public:
   ///
   void removeAbstractTypeUser(AbstractTypeUser *U) const;
 
+  /// getPointerTo - Return a pointer to the current type.  This is equivalent
+  /// to PointerType::get(Foo, AddrSpace).
+  PointerType *getPointerTo(unsigned AddrSpace = 0) const;
+
 private:
   /// isSizedDerivedType - Derived types like structures and arrays are sized
   /// iff all of the members of the type are sized as well.  Since asking for
index 642fc1907ef7f6cc9c963710afebfb392a42f517..edd8cf35022fb2858e7746d3c2694f3fb755b65c 100644 (file)
@@ -1214,6 +1214,10 @@ PointerType *PointerType::get(const Type *ValueType, unsigned AddressSpace) {
   return PT;
 }
 
+PointerType *Type::getPointerTo(unsigned addrs) const {
+  return PointerType::get(this, addrs);
+}
+
 //===----------------------------------------------------------------------===//
 //                     Derived Type Refinement Functions
 //===----------------------------------------------------------------------===//