summaryrefslogtreecommitdiff
path: root/compiler/utils/growable_array.h
diff options
context:
space:
mode:
author Jean Christophe Beyler <jean.christophe.beyler@intel.com> 2014-04-15 16:18:48 -0700
committer Jean Christophe Beyler <jean.christophe.beyler@intel.com> 2014-04-29 07:12:04 -0700
commit1ceea7eb080a309fc2811db604bceed9e638bc5e (patch)
tree0a8612c1a9ff83e3fc325be5245d476f52c023f6 /compiler/utils/growable_array.h
parentb99985a089e23929c920201c14875b51c5b6217e (diff)
ART: Initialization of RegLocation and API for GrowableArray Iterator
Two things: - Added a default initialization for the RegLocation. - Added a default constructor and Reset for the GrowableArray's Iterator class. Change-Id: I74d9c584304c77add42e0d66e4037ac45b890142 Signed-off-by: Jean Christophe Beyler <jean.christophe.beyler@intel.com> Signed-off-by: Razvan A Lupusoru <razvan.a.lupusoru@intel.com> Signed-off-by: Yixin Shou <yixin.shou@intel.com> Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com> Signed-off-by: Udayan Banerji <udayan.banerji@intel.com>
Diffstat (limited to 'compiler/utils/growable_array.h')
-rw-r--r--compiler/utils/growable_array.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/utils/growable_array.h b/compiler/utils/growable_array.h
index a7d1f0e5a5..e6c53dab24 100644
--- a/compiler/utils/growable_array.h
+++ b/compiler/utils/growable_array.h
@@ -50,9 +50,14 @@ class GrowableArray {
: idx_(0),
g_list_(g_list) {}
+ explicit Iterator()
+ : idx_(0),
+ g_list_(nullptr) {}
+
// NOTE: returns 0/NULL when no next.
// TODO: redo to make usage consistent with other iterators.
T Next() {
+ DCHECK(g_list_ != nullptr);
if (idx_ >= g_list_->Size()) {
return 0;
} else {
@@ -64,6 +69,15 @@ class GrowableArray {
idx_ = 0;
}
+ void Reset(GrowableArray* g_list) {
+ idx_ = 0;
+ g_list_ = g_list;
+ }
+
+ size_t GetIndex() const {
+ return idx_;
+ }
+
private:
size_t idx_;
GrowableArray* const g_list_;