[PATCH] D22682: [esan] Add iterator to esan's generic hashtable

Mike Aizatsky via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 27 14:18:10 PDT 2016


aizatsky added inline comments.

================
Comment at: lib/esan/esan_hashtable.h:70
@@ +69,3 @@
+  // Calling HashTable functions while using the iterator is not supported.
+  class iterator {
+   public:
----------------
Specify that iterator copies data, so it would be inefficient for non-primitive types.

================
Comment at: lib/esan/esan_hashtable.h:343
@@ +342,3 @@
+HashTable<KeyTy, DataTy>::end() {
+  return iterator(this, Capacity);
+}
----------------
I'm not sure that this iterator is correct when table is empty. Could you add a test please?

================
Comment at: test/esan/Unit/hashtable.cpp:86
@@ -63,3 +85,3 @@
 
   fprintf(stderr, "All checks passed.\n");
   return 0;
----------------
Please also add a small test to make sure it works with

for (auto Pair : DataTable) {
}


https://reviews.llvm.org/D22682





More information about the llvm-commits mailing list