Mark Type::getPointerTo as const. Unfortunately, this requires a const_cast inside...
authorCraig Topper <craig.topper@gmail.com>
Sat, 1 Aug 2015 22:20:31 +0000 (22:20 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sat, 1 Aug 2015 22:20:31 +0000 (22:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243844 91177308-0d34-0410-b5e6-96231b3b80d8

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

index bbee3f93741ece1bc95548812d41c717d11372c4..93a8a2f186531633e13811900c615265eb95098d 100644 (file)
@@ -416,7 +416,7 @@ public:
 
   /// getPointerTo - Return a pointer to the current type.  This is equivalent
   /// to PointerType::get(Foo, AddrSpace).
-  PointerType *getPointerTo(unsigned AddrSpace = 0);
+  PointerType *getPointerTo(unsigned AddrSpace = 0) const;
 
 private:
   /// isSizedDerivedType - Derived types like structures and arrays are sized
index 17d24465601f27e9acb4e4a800355669ee7f78ce..553fa93f5856e40822b2b7cad6ec702d9e8eaed3 100644 (file)
@@ -748,8 +748,8 @@ PointerType::PointerType(Type *E, unsigned AddrSpace)
   assert(oldNCT == NumContainedTys && "bitfield written out of bounds?");
 }
 
-PointerType *Type::getPointerTo(unsigned addrs) {
-  return PointerType::get(this, addrs);
+PointerType *Type::getPointerTo(unsigned addrs) const {
+  return PointerType::get(const_cast<Type*>(this), addrs);
 }
 
 bool PointerType::isValidElementType(Type *ElemTy) {