[PATCH] D28183: [SmallPtrSet] Introduce a find primitive and rewrite count/erase in terms of it

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 30 18:12:45 PST 2016


sanjoy added inline comments.


================
Comment at: include/llvm/ADT/SmallPtrSet.h:389
   size_type count(PtrType Ptr) const {
-    return count_imp(PtrTraits::getAsVoidPointer(Ptr)) ? 1 : 0;
+    return find(Ptr) != endPtr() ? 1 : 0;
+  }
----------------
reames wrote:
> sanjoy wrote:
> > What is `endPtr`?  Is this patch based on some other patch?
> endPtr is already in tree.  This is almost "end()", but it can't be because of the breaking API check logic.  Honestly, the breaking API check logic looks broken to me.  :(  It doesn't seem to cover anything other than begin/end, whereas we return other forms of iterators and might reasonable compare them against end.
Yeah, this part looks fine.  I was looking at a stale version of `SmallPtrSet`.


https://reviews.llvm.org/D28183





More information about the llvm-commits mailing list