From bc8848f76fe0096ca5a8cc91134ffe8b22f1c7e1 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 10 Apr 2009 06:42:02 +0000 Subject: [PATCH] Add a new Type::getPointerTo method, which is shorthand for llvm::PointerType::get(). Patch by Anders Johnsen! llvm-svn: 68772 --- llvm/include/llvm/Type.h | 4 ++++ llvm/lib/VMCore/Type.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/llvm/include/llvm/Type.h b/llvm/include/llvm/Type.h index a284d80bb5c3..e80c8760691f 100644 --- a/llvm/include/llvm/Type.h +++ b/llvm/include/llvm/Type.h @@ -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 diff --git a/llvm/lib/VMCore/Type.cpp b/llvm/lib/VMCore/Type.cpp index 642fc1907ef7..edd8cf35022f 100644 --- a/llvm/lib/VMCore/Type.cpp +++ b/llvm/lib/VMCore/Type.cpp @@ -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 //===----------------------------------------------------------------------===//