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

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


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

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.


>From 3f8e4fb24b8f83f2f44f67f773681dfe7058b6fc Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 24 Aug 2025 22:17:24 -0700
Subject: [PATCH] [ADT] Teach SmallSetVector to inherit constructors (NFC)

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.
---
 llvm/include/llvm/ADT/SetVector.h | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

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



More information about the llvm-commits mailing list