[PATCH] D125776: [llvm-dva] 01 - Interval tree

Carlos Alberto Enciso via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 13 02:40:21 PDT 2022


CarlosAlbertoEnciso added inline comments.


================
Comment at: llvm/include/llvm/ADT/IntervalTree.h:298
+  /// Print the interval list (left and right) for a given \a Node.
+  void printList(raw_ostream &OS, IntervalReferences &IntervalSet,
+                 unsigned Start, unsigned Size, bool HexFormat = true) {
----------------
psamolysov wrote:
> This method looks as it could be `static`.
Added the `static` bit.


================
Comment at: llvm/include/llvm/ADT/IntervalTree.h:601
+  /// Descending: return the intervals with the biggest at the front.
+  void sortIntervals(IntervalReferences &IntervalSet, Sorting Sort) const {
+    std::sort(IntervalSet.begin(), IntervalSet.end(),
----------------
psamolysov wrote:
> psamolysov wrote:
> > This method is for sorting already returned interval set, so this is just a helper and it looks like the method can be a static member of the class.
> Hm... maybe I get it wrong and because the `IntervalSet` contains only pointers inside the instance of the tree, the method should be a member of the class, not a static member.
I am afraid I don't follow you. `IntervalSet` is just an alias for the `SmallVector` instance. Do you mean make it `static` as the `printList` method you mentioned in other comment?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125776



More information about the llvm-commits mailing list