[llvm-commits] [llvm] r68772 - in /llvm/trunk: include/llvm/Type.h lib/VMCore/Type.cpp

Chris Lattner sabre at nondot.org
Thu Apr 9 23:42:10 PDT 2009


Author: lattner
Date: Fri Apr 10 01:42:02 2009
New Revision: 68772

URL: http://llvm.org/viewvc/llvm-project?rev=68772&view=rev
Log:
Add a new Type::getPointerTo method, which is shorthand for
llvm::PointerType::get().  Patch by Anders Johnsen!

Modified:
    llvm/trunk/include/llvm/Type.h
    llvm/trunk/lib/VMCore/Type.cpp

Modified: llvm/trunk/include/llvm/Type.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Type.h?rev=68772&r1=68771&r2=68772&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Type.h (original)
+++ llvm/trunk/include/llvm/Type.h Fri Apr 10 01:42:02 2009
@@ -364,6 +364,10 @@
   ///
   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

Modified: llvm/trunk/lib/VMCore/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=68772&r1=68771&r2=68772&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Type.cpp (original)
+++ llvm/trunk/lib/VMCore/Type.cpp Fri Apr 10 01:42:02 2009
@@ -1214,6 +1214,10 @@
   return PT;
 }
 
+PointerType *Type::getPointerTo(unsigned addrs) const {
+  return PointerType::get(this, addrs);
+}
+
 //===----------------------------------------------------------------------===//
 //                     Derived Type Refinement Functions
 //===----------------------------------------------------------------------===//





More information about the llvm-commits mailing list