diff options
author | Chris Lattner <sabre@nondot.org> | 2011-07-18 04:54:35 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-07-18 04:54:35 +0000 |
commit | db125cfaf57cc83e7dd7453de2d509bc8efd0e5e (patch) | |
tree | a163ac0f83da7be3f9675a122a6144b12418be09 /include/llvm/Support/GetElementPtrTypeIterator.h | |
parent | 4b3d5469fb7c25504fa20dc65640f02d79675d48 (diff) | |
download | llvm-db125cfaf57cc83e7dd7453de2d509bc8efd0e5e.tar.gz llvm-db125cfaf57cc83e7dd7453de2d509bc8efd0e5e.tar.bz2 llvm-db125cfaf57cc83e7dd7453de2d509bc8efd0e5e.tar.xz |
land David Blaikie's patch to de-constify Type, with a few tweaks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135375 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/GetElementPtrTypeIterator.h')
-rw-r--r-- | include/llvm/Support/GetElementPtrTypeIterator.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/include/llvm/Support/GetElementPtrTypeIterator.h b/include/llvm/Support/GetElementPtrTypeIterator.h index e5e7fc7409..526afd40c6 100644 --- a/include/llvm/Support/GetElementPtrTypeIterator.h +++ b/include/llvm/Support/GetElementPtrTypeIterator.h @@ -21,16 +21,16 @@ namespace llvm { template<typename ItTy = User::const_op_iterator> class generic_gep_type_iterator - : public std::iterator<std::forward_iterator_tag, const Type *, ptrdiff_t> { + : public std::iterator<std::forward_iterator_tag, Type *, ptrdiff_t> { typedef std::iterator<std::forward_iterator_tag, - const Type *, ptrdiff_t> super; + Type *, ptrdiff_t> super; ItTy OpIt; - const Type *CurTy; + Type *CurTy; generic_gep_type_iterator() {} public: - static generic_gep_type_iterator begin(const Type *Ty, ItTy It) { + static generic_gep_type_iterator begin(Type *Ty, ItTy It) { generic_gep_type_iterator I; I.CurTy = Ty; I.OpIt = It; @@ -50,23 +50,23 @@ namespace llvm { return !operator==(x); } - const Type *operator*() const { + Type *operator*() const { return CurTy; } - const Type *getIndexedType() const { - const CompositeType *CT = cast<CompositeType>(CurTy); + Type *getIndexedType() const { + CompositeType *CT = cast<CompositeType>(CurTy); return CT->getTypeAtIndex(getOperand()); } // This is a non-standard operator->. It allows you to call methods on the // current type directly. - const Type *operator->() const { return operator*(); } + Type *operator->() const { return operator*(); } Value *getOperand() const { return *OpIt; } generic_gep_type_iterator& operator++() { // Preincrement - if (const CompositeType *CT = dyn_cast<CompositeType>(CurTy)) { + if (CompositeType *CT = dyn_cast<CompositeType>(CurTy)) { CurTy = CT->getTypeAtIndex(getOperand()); } else { CurTy = 0; @@ -99,13 +99,13 @@ namespace llvm { template<typename ItTy> inline generic_gep_type_iterator<ItTy> - gep_type_begin(const Type *Op0, ItTy I, ItTy E) { + gep_type_begin(Type *Op0, ItTy I, ItTy E) { return generic_gep_type_iterator<ItTy>::begin(Op0, I); } template<typename ItTy> inline generic_gep_type_iterator<ItTy> - gep_type_end(const Type *Op0, ItTy I, ItTy E) { + gep_type_end(Type *Op0, ItTy I, ItTy E) { return generic_gep_type_iterator<ItTy>::end(E); } } // end namespace llvm |