summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2011-07-29 19:07:02 +0000
committerDavid Greene <greened@obbligato.org>2011-07-29 19:07:02 +0000
commit60c04af7879c3eda957162737783de726dd177b6 (patch)
tree6810716b6b9a1dc310a75d6c890a85f91a0d38ad /utils
parentca7fd3de360b266783438666054dba198ff77ba2 (diff)
downloadllvm-60c04af7879c3eda957162737783de726dd177b6.tar.gz
llvm-60c04af7879c3eda957162737783de726dd177b6.tar.bz2
llvm-60c04af7879c3eda957162737783de726dd177b6.tar.xz
[AVX] Remove non-const Iterators
Remove all non-const iterators from Init classes. This is another step toward constifying Inits and ultimately turning them into FoldingSetNodes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136484 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/ClangAttrEmitter.cpp4
-rw-r--r--utils/TableGen/Record.cpp10
-rw-r--r--utils/TableGen/Record.h13
3 files changed, 13 insertions, 14 deletions
diff --git a/utils/TableGen/ClangAttrEmitter.cpp b/utils/TableGen/ClangAttrEmitter.cpp
index 9ad0603bdb..40bbb08524 100644
--- a/utils/TableGen/ClangAttrEmitter.cpp
+++ b/utils/TableGen/ClangAttrEmitter.cpp
@@ -27,7 +27,9 @@ getValueAsListOfStrings(Record &R, StringRef FieldName) {
std::vector<StringRef> Strings;
Strings.reserve(List->getSize());
- for (ListInit::iterator i = List->begin(), e = List->end(); i != e; ++i) {
+ for (ListInit::const_iterator i = List->begin(), e = List->end();
+ i != e;
+ ++i) {
assert(*i && "Got a null element in a ListInit");
if (StringInit *S = dynamic_cast<StringInit *>(*i))
Strings.push_back(S->getValue());
diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp
index e2ec81609a..4f33638eaa 100644
--- a/utils/TableGen/Record.cpp
+++ b/utils/TableGen/Record.cpp
@@ -673,7 +673,13 @@ Init *UnOpInit::Fold(Record *CurRec, MultiClass *CurMultiClass) {
assert(0 && "Empty list in cdr");
return 0;
}
- ListInit *Result = new ListInit(LHSl->begin()+1, LHSl->end(),
+ ListInit::const_iterator begin = LHSl->begin()+1;
+ ListInit::const_iterator end = LHSl->end();
+ // We can't pass these iterators directly to ArrayRef because
+ // they are not convertible to Init **. Fortunately,
+ // RandomAccessIterator::operator * is guaranteed to return an
+ // lvalue.
+ ListInit *Result = new ListInit(ArrayRef<Init *>(&*begin, end - begin),
LHSl->getType());
return Result;
}
@@ -920,7 +926,7 @@ static Init *ForeachHelper(Init *LHS, Init *MHS, Init *RHS, RecTy *Type,
std::vector<Init *> NewOperands;
std::vector<Init *> NewList(MHSl->begin(), MHSl->end());
- for (ListInit::iterator li = NewList.begin(),
+ for (std::vector<Init *>::iterator li = NewList.begin(),
liend = NewList.end();
li != liend;
++li) {
diff --git a/utils/TableGen/Record.h b/utils/TableGen/Record.h
index 39d3668cd6..599b6dcd5c 100644
--- a/utils/TableGen/Record.h
+++ b/utils/TableGen/Record.h
@@ -749,15 +749,14 @@ public:
class ListInit : public TypedInit {
std::vector<Init*> Values;
public:
- typedef std::vector<Init*>::iterator iterator;
typedef std::vector<Init*>::const_iterator const_iterator;
explicit ListInit(std::vector<Init*> &Vs, RecTy *EltTy)
: TypedInit(ListRecTy::get(EltTy)) {
Values.swap(Vs);
}
- explicit ListInit(iterator Start, iterator End, RecTy *EltTy)
- : TypedInit(ListRecTy::get(EltTy)), Values(Start, End) {}
+ explicit ListInit(ArrayRef<Init *> Range, RecTy *EltTy)
+ : TypedInit(ListRecTy::get(EltTy)), Values(Range.begin(), Range.end()) {}
unsigned getSize() const { return Values.size(); }
Init *getElement(unsigned i) const {
@@ -784,9 +783,7 @@ public:
ArrayRef<Init*> getValues() const { return Values; }
- inline iterator begin() { return Values.begin(); }
inline const_iterator begin() const { return Values.begin(); }
- inline iterator end () { return Values.end(); }
inline const_iterator end () const { return Values.end(); }
inline size_t size () const { return Values.size(); }
@@ -1177,22 +1174,16 @@ public:
virtual std::string getAsString() const;
- typedef std::vector<Init*>::iterator arg_iterator;
typedef std::vector<Init*>::const_iterator const_arg_iterator;
- typedef std::vector<std::string>::iterator name_iterator;
typedef std::vector<std::string>::const_iterator const_name_iterator;
- inline arg_iterator arg_begin() { return Args.begin(); }
inline const_arg_iterator arg_begin() const { return Args.begin(); }
- inline arg_iterator arg_end () { return Args.end(); }
inline const_arg_iterator arg_end () const { return Args.end(); }
inline size_t arg_size () const { return Args.size(); }
inline bool arg_empty() const { return Args.empty(); }
- inline name_iterator name_begin() { return ArgNames.begin(); }
inline const_name_iterator name_begin() const { return ArgNames.begin(); }
- inline name_iterator name_end () { return ArgNames.end(); }
inline const_name_iterator name_end () const { return ArgNames.end(); }
inline size_t name_size () const { return ArgNames.size(); }