[PATCH] D55760: [ADT] IntervalMap: add contains(a, b) method

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 17 09:08:39 PST 2018


vsk added inline comments.


================
Comment at: include/llvm/ADT/IntervalMap.h:1140
+  /// the range [a;b]
+  bool contains(KeyT a, KeyT b) {
+    assert(Traits::nonEmpty(a, b));
----------------
When I read ‘contains’, I tend to assume ‘contains entire subset/subrange’. Would ‘containsSubrangeOf’ or some variant help readability?


================
Comment at: include/llvm/ADT/IntervalMap.h:1145
+      return false;
+    // [a;b] and [x;y] intersect iff x<=b and a<=y. The find() call guarantees
+    // the second part, so it is sufficient to check the first one.
----------------
It might help future readers out to explain that at this point, y = find(a).


Repository:
  rL LLVM

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

https://reviews.llvm.org/D55760





More information about the llvm-commits mailing list