Rename class to be consistent with other iterator classes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10213 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2003-11-25 19:58:35 +00:00
parent 19ed305339
commit 94a28c6bc8

View File

@ -20,7 +20,7 @@
#include "llvm/DerivedTypes.h" #include "llvm/DerivedTypes.h"
namespace llvm { namespace llvm {
class GetElementPtrTypeIterator class gep_type_iterator
: public forward_iterator<const Type *, ptrdiff_t> { : public forward_iterator<const Type *, ptrdiff_t> {
typedef forward_iterator<const Type*, ptrdiff_t> super; typedef forward_iterator<const Type*, ptrdiff_t> super;
@ -28,28 +28,28 @@ namespace llvm {
const Type *CurTy; const Type *CurTy;
unsigned Operand; unsigned Operand;
GetElementPtrTypeIterator() {} gep_type_iterator() {}
public: public:
static GetElementPtrTypeIterator begin(GetElementPtrInst *gep) { static gep_type_iterator begin(GetElementPtrInst *gep) {
GetElementPtrTypeIterator I; gep_type_iterator I;
I.TheGEP = gep; I.TheGEP = gep;
I.CurTy = gep->getOperand(0)->getType(); I.CurTy = gep->getOperand(0)->getType();
I.Operand = 1; I.Operand = 1;
return I; return I;
} }
static GetElementPtrTypeIterator end(GetElementPtrInst *gep) { static gep_type_iterator end(GetElementPtrInst *gep) {
GetElementPtrTypeIterator I; gep_type_iterator I;
I.TheGEP = gep; I.TheGEP = gep;
I.CurTy = 0; I.CurTy = 0;
I.Operand = gep->getNumOperands(); I.Operand = gep->getNumOperands();
return I; return I;
} }
bool operator==(const GetElementPtrTypeIterator& x) const { bool operator==(const gep_type_iterator& x) const {
return Operand == x.Operand; return Operand == x.Operand;
} }
bool operator!=(const GetElementPtrTypeIterator& x) const { bool operator!=(const gep_type_iterator& x) const {
return !operator==(x); return !operator==(x);
} }
@ -65,7 +65,7 @@ namespace llvm {
Value *getOperand() const { return TheGEP->getOperand(Operand); } Value *getOperand() const { return TheGEP->getOperand(Operand); }
GetElementPtrTypeIterator& operator++() { // Preincrement gep_type_iterator& operator++() { // Preincrement
if (const CompositeType *CT = dyn_cast<CompositeType>(CurTy)) { if (const CompositeType *CT = dyn_cast<CompositeType>(CurTy)) {
CurTy = CT->getTypeAtIndex(getOperand()); CurTy = CT->getTypeAtIndex(getOperand());
} else { } else {
@ -75,17 +75,17 @@ namespace llvm {
return *this; return *this;
} }
GetElementPtrTypeIterator operator++(int) { // Postincrement gep_type_iterator operator++(int) { // Postincrement
GetElementPtrTypeIterator tmp = *this; ++*this; return tmp; gep_type_iterator tmp = *this; ++*this; return tmp;
} }
}; };
inline GetElementPtrTypeIterator gep_type_begin(GetElementPtrInst *GEP) { inline gep_type_iterator gep_type_begin(GetElementPtrInst *GEP) {
return GetElementPtrTypeIterator::begin(GEP); return gep_type_iterator::begin(GEP);
} }
inline GetElementPtrTypeIterator gep_type_end(GetElementPtrInst *GEP) { inline gep_type_iterator gep_type_end(GetElementPtrInst *GEP) {
return GetElementPtrTypeIterator::end(GEP); return gep_type_iterator::end(GEP);
} }
} // end namespace llvm } // end namespace llvm