[PATCH] D78919: Changing DenseMapIterator's comparisons to be hidden friends.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 20:29:04 PDT 2020


dblaikie added inline comments.


================
Comment at: llvm/include/llvm/ADT/DenseMap.h:1247-1259
+  friend bool operator==(const DenseMapIterator &LHS,
+                         const DenseMapIterator &RHS) {
+    assert((!LHS.Ptr || LHS.isHandleInSync()) && "handle not in sync!");
     assert((!RHS.Ptr || RHS.isHandleInSync()) && "handle not in sync!");
-    assert(getEpochAddress() == RHS.getEpochAddress() &&
+    assert(LHS.getEpochAddress() == RHS.getEpochAddress() &&
            "comparing incomparable iterators!");
+    return LHS.Ptr == RHS.Ptr;
----------------
Should these use ConstIterator parameters? Guess that'd reduce the number of instantiations/versions of this function (rather than having const and non-const versions of the function instantiated)? 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78919/new/

https://reviews.llvm.org/D78919





More information about the llvm-commits mailing list