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

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 30 18:05:32 PST 2016


reames 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;
+  }
----------------
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.


https://reviews.llvm.org/D28183





More information about the llvm-commits mailing list