From: Craig Topper Date: Sat, 1 Aug 2015 22:20:31 +0000 (+0000) Subject: Mark Type::getPointerTo as const. Unfortunately, this requires a const_cast inside... X-Git-Tag: studio-1.4~1040 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=84a138a351d665332477e807b4292c1b1f7dd523;p=platform%2Fupstream%2Fllvm.git Mark Type::getPointerTo as const. Unfortunately, this requires a const_cast inside, but at least it makes all methods on Type const. NFC llvm-svn: 243844 --- diff --git a/llvm/include/llvm/IR/Type.h b/llvm/include/llvm/IR/Type.h index bbee3f9..93a8a2f 100644 --- a/llvm/include/llvm/IR/Type.h +++ b/llvm/include/llvm/IR/Type.h @@ -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 diff --git a/llvm/lib/IR/Type.cpp b/llvm/lib/IR/Type.cpp index 17d2446..553fa93 100644 --- a/llvm/lib/IR/Type.cpp +++ b/llvm/lib/IR/Type.cpp @@ -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(this), addrs); } bool PointerType::isValidElementType(Type *ElemTy) {