[PATCH] D140791: [DWARFLinkerParallel] Add simple list with thread safe insertions.

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 28 16:50:30 PST 2023


JDevlieghere added a comment.

The implementation looks good. I left some inline comments with suggestions for names that more closely match that of the STL containers to make the class feel more familiar to those who are used to them.



================
Comment at: llvm/include/llvm/DWARFLinkerParallel/NonAllocatingList.h:38
+  /// \returns current head of the list.
+  T *getHead() { return Head; }
+  const T *getHead() const { return Head; }
----------------
front


================
Comment at: llvm/include/llvm/DWARFLinkerParallel/NonAllocatingList.h:42
+  /// \returns true if the list is empty.
+  bool isEmpty() const { return Head == nullptr; }
+
----------------
empty


================
Comment at: llvm/include/llvm/DWARFLinkerParallel/NonAllocatingList.h:45
+  /// Adds \p NewItem into the list. Item added at front of the list.
+  void addAtFront(T *NewItem) {
+    T *CurHead = nullptr;
----------------
pushFront


================
Comment at: llvm/include/llvm/DWARFLinkerParallel/NonAllocatingList.h:76
+  /// Sets list head to null.
+  void erase() { Head = nullptr; }
+
----------------
clear


================
Comment at: llvm/include/llvm/DWARFLinkerParallel/NonAllocatingList.h:79
+  /// Sorts list items according to the \p Comparator.
+  void sortItems(function_ref<bool(T *LHS, T *RHS)> Comparator) {
+    // TODO: It might be beneficial to implement sorting of items
----------------
sort


================
Comment at: llvm/include/llvm/DWARFLinkerParallel/NonAllocatingList.h:98
+  /// Reverse list items.
+  void reverseItems() {
+    T *nextItem = nullptr;
----------------
reverse


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140791



More information about the llvm-commits mailing list