[llvm] [ADT] Teach SmallSetVector to inherit constructors (NFC) (PR #155788)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 28 01:52:57 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-adt

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

This patch teaches SmallSetVector to inherit constructors from the
base class with "using".  This way, we can remove all of the manually
defined constructors in SmallSetVector.


---
Full diff: https://github.com/llvm/llvm-project/pull/155788.diff


1 Files Affected:

- (modified) llvm/include/llvm/ADT/SetVector.h (+1-11) 


``````````diff
diff --git a/llvm/include/llvm/ADT/SetVector.h b/llvm/include/llvm/ADT/SetVector.h
index 85d4f2d5ee28a..deed62187ee12 100644
--- a/llvm/include/llvm/ADT/SetVector.h
+++ b/llvm/include/llvm/ADT/SetVector.h
@@ -377,17 +377,7 @@ class SetVector {
 template <typename T, unsigned N>
 class SmallSetVector : public SetVector<T, SmallVector<T, N>, DenseSet<T>, N> {
 public:
-  SmallSetVector() = default;
-
-  /// Initialize a SmallSetVector with a range of elements
-  template<typename It>
-  SmallSetVector(It Start, It End) {
-    this->insert(Start, End);
-  }
-
-  template <typename Range>
-  SmallSetVector(llvm::from_range_t, Range &&R)
-      : SmallSetVector(adl_begin(R), adl_end(R)) {}
+  using SetVector<T, SmallVector<T, N>, DenseSet<T>, N>::SetVector;
 };
 
 } // end namespace llvm

``````````

</details>


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


More information about the llvm-commits mailing list