[llvm-branch-commits] [llvm] [NFC] Use unique_ptr in SparseSet (PR #116617)

David Blaikie via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Nov 18 09:58:42 PST 2024


================
@@ -205,7 +209,7 @@ class SparseSet {
     assert(Idx < Universe && "Key out of range");
     assert(Sparse != nullptr && "Invalid sparse type");
     const unsigned Stride = std::numeric_limits<SparseT>::max() + 1u;
-    for (unsigned i = Sparse[Idx], e = size(); i < e; i += Stride) {
+    for (unsigned i = Sparse.get()[Idx], e = size(); i < e; i += Stride) {
----------------
dwblaikie wrote:

If you make the `std::unique_ptr<SparseT, Deleter>` into a `std::unique_ptr<SparseT[], Deleter>` then you can use [] directly without the `.get()` I think?

https://github.com/llvm/llvm-project/pull/116617


More information about the llvm-branch-commits mailing list