[llvm] 11c2923 - [ADT] Use "using" instead of "typedef" (NFC) (#166129)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 3 08:41:28 PST 2025
Author: Kazu Hirata
Date: 2025-11-03T08:41:25-08:00
New Revision: 11c2923ccc6ec7f67049e9ea151467224814dbe5
URL: https://github.com/llvm/llvm-project/commit/11c2923ccc6ec7f67049e9ea151467224814dbe5
DIFF: https://github.com/llvm/llvm-project/commit/11c2923ccc6ec7f67049e9ea151467224814dbe5.diff
LOG: [ADT] Use "using" instead of "typedef" (NFC) (#166129)
Identified with modernize-use-using.
Added:
Modified:
llvm/include/llvm/ADT/APFloat.h
llvm/include/llvm/ADT/APInt.h
llvm/include/llvm/ADT/BitVector.h
llvm/include/llvm/ADT/GenericSSAContext.h
llvm/include/llvm/ADT/STLExtras.h
llvm/include/llvm/ADT/ilist.h
llvm/include/llvm/ADT/ilist_node_options.h
llvm/unittests/ADT/APFloatTest.cpp
llvm/unittests/ADT/BitVectorTest.cpp
llvm/unittests/ADT/BreadthFirstIteratorTest.cpp
llvm/unittests/ADT/DAGDeltaAlgorithmTest.cpp
llvm/unittests/ADT/DenseMapTest.cpp
llvm/unittests/ADT/DenseSetTest.cpp
llvm/unittests/ADT/DepthFirstIteratorTest.cpp
llvm/unittests/ADT/IListBaseTest.cpp
llvm/unittests/ADT/IListIteratorTest.cpp
llvm/unittests/ADT/IListNodeBaseTest.cpp
llvm/unittests/ADT/IListSentinelTest.cpp
llvm/unittests/ADT/IntervalMapTest.cpp
llvm/unittests/ADT/IntrusiveRefCntPtrTest.cpp
llvm/unittests/ADT/IteratorTest.cpp
llvm/unittests/ADT/PointerSumTypeTest.cpp
llvm/unittests/ADT/PointerUnionTest.cpp
llvm/unittests/ADT/PostOrderIteratorTest.cpp
llvm/unittests/ADT/PriorityWorklistTest.cpp
llvm/unittests/ADT/RangeAdapterTest.cpp
llvm/unittests/ADT/SCCIteratorTest.cpp
llvm/unittests/ADT/STLExtrasTest.cpp
llvm/unittests/ADT/SimpleIListTest.cpp
llvm/unittests/ADT/SmallPtrSetTest.cpp
llvm/unittests/ADT/SmallStringTest.cpp
llvm/unittests/ADT/SmallVectorTest.cpp
llvm/unittests/ADT/SparseMultiSetTest.cpp
llvm/unittests/ADT/SparseSetTest.cpp
llvm/unittests/ADT/TestGraph.h
llvm/unittests/ADT/TinyPtrVectorTest.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/APFloat.h b/llvm/include/llvm/ADT/APFloat.h
index bccdb8930561e..82ac9a3a1ef80 100644
--- a/llvm/include/llvm/ADT/APFloat.h
+++ b/llvm/include/llvm/ADT/APFloat.h
@@ -152,7 +152,7 @@ class APFloatBase {
static constexpr unsigned integerPartWidth = APInt::APINT_BITS_PER_WORD;
/// A signed type to represent a floating point numbers unbiased exponent.
- typedef int32_t ExponentType;
+ using ExponentType = int32_t;
/// \name Floating Point Semantics.
/// @{
@@ -938,8 +938,8 @@ LLVM_ABI DoubleAPFloat frexp(const DoubleAPFloat &X, int &Exp, roundingMode);
// This is a interface class that is currently forwarding functionalities from
// detail::IEEEFloat.
class APFloat : public APFloatBase {
- typedef detail::IEEEFloat IEEEFloat;
- typedef detail::DoubleAPFloat DoubleAPFloat;
+ using IEEEFloat = detail::IEEEFloat;
+ using DoubleAPFloat = detail::DoubleAPFloat;
static_assert(std::is_standard_layout<IEEEFloat>::value);
diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h
index 9fa98ad4ddde1..26283d2437d48 100644
--- a/llvm/include/llvm/ADT/APInt.h
+++ b/llvm/include/llvm/ADT/APInt.h
@@ -77,7 +77,7 @@ inline APInt operator-(APInt);
///
class [[nodiscard]] APInt {
public:
- typedef uint64_t WordType;
+ using WordType = uint64_t;
/// Byte size of a word.
static constexpr unsigned APINT_WORD_SIZE = sizeof(WordType);
diff --git a/llvm/include/llvm/ADT/BitVector.h b/llvm/include/llvm/ADT/BitVector.h
index 9e81a4b735e7f..cc3f3a9226395 100644
--- a/llvm/include/llvm/ADT/BitVector.h
+++ b/llvm/include/llvm/ADT/BitVector.h
@@ -99,7 +99,7 @@ template <typename BitVectorT> class const_set_bits_iterator_impl {
};
class BitVector {
- typedef uintptr_t BitWord;
+ using BitWord = uintptr_t;
enum { BITWORD_SIZE = (unsigned)sizeof(BitWord) * CHAR_BIT };
@@ -147,8 +147,8 @@ class BitVector {
}
};
- typedef const_set_bits_iterator_impl<BitVector> const_set_bits_iterator;
- typedef const_set_bits_iterator set_iterator;
+ using const_set_bits_iterator = const_set_bits_iterator_impl<BitVector>;
+ using set_iterator = const_set_bits_iterator;
const_set_bits_iterator set_bits_begin() const {
return const_set_bits_iterator(*this);
diff --git a/llvm/include/llvm/ADT/GenericSSAContext.h b/llvm/include/llvm/ADT/GenericSSAContext.h
index e9f99bafe9f1e..426a083778d6e 100644
--- a/llvm/include/llvm/ADT/GenericSSAContext.h
+++ b/llvm/include/llvm/ADT/GenericSSAContext.h
@@ -25,7 +25,7 @@ template <typename, bool> class DominatorTreeBase;
template <typename> class SmallVectorImpl;
namespace Intrinsic {
-typedef unsigned ID;
+using ID = unsigned;
}
// Specializations of this template should provide the types used by the
diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h
index a9841c6651b72..8de8eb5b86640 100644
--- a/llvm/include/llvm/ADT/STLExtras.h
+++ b/llvm/include/llvm/ADT/STLExtras.h
@@ -1516,8 +1516,8 @@ template <class Iterator, class RNG>
void shuffle(Iterator first, Iterator last, RNG &&g) {
// It would be better to use a std::uniform_int_distribution,
// but that would be stdlib dependent.
- typedef
- typename std::iterator_traits<Iterator>::
diff erence_type
diff erence_type;
+ using
diff erence_type =
+ typename std::iterator_traits<Iterator>::
diff erence_type;
for (auto size = last - first; size > 1; ++first, (void)--size) {
diff erence_type offset = g() % size;
// Avoid self-assignment due to incorrect assertions in libstdc++
diff --git a/llvm/include/llvm/ADT/ilist.h b/llvm/include/llvm/ADT/ilist.h
index aed19ccbff7f2..64392903bec74 100644
--- a/llvm/include/llvm/ADT/ilist.h
+++ b/llvm/include/llvm/ADT/ilist.h
@@ -108,21 +108,21 @@ template <typename Ty> struct ilist_traits<const Ty> {};
/// list.
template <class IntrusiveListT, class TraitsT>
class iplist_impl : public TraitsT, IntrusiveListT {
- typedef IntrusiveListT base_list_type;
+ using base_list_type = IntrusiveListT;
public:
- typedef typename base_list_type::pointer pointer;
- typedef typename base_list_type::const_pointer const_pointer;
- typedef typename base_list_type::reference reference;
- typedef typename base_list_type::const_reference const_reference;
- typedef typename base_list_type::value_type value_type;
- typedef typename base_list_type::size_type size_type;
- typedef typename base_list_type::
diff erence_type
diff erence_type;
- typedef typename base_list_type::iterator iterator;
- typedef typename base_list_type::const_iterator const_iterator;
- typedef typename base_list_type::reverse_iterator reverse_iterator;
- typedef
- typename base_list_type::const_reverse_iterator const_reverse_iterator;
+ using pointer = typename base_list_type::pointer;
+ using const_pointer = typename base_list_type::const_pointer;
+ using reference = typename base_list_type::reference;
+ using const_reference = typename base_list_type::const_reference;
+ using value_type = typename base_list_type::value_type;
+ using size_type = typename base_list_type::size_type;
+ using
diff erence_type = typename base_list_type::
diff erence_type;
+ using iterator = typename base_list_type::iterator;
+ using const_iterator = typename base_list_type::const_iterator;
+ using reverse_iterator = typename base_list_type::reverse_iterator;
+ using const_reverse_iterator =
+ typename base_list_type::const_reverse_iterator;
private:
static bool op_less(const_reference L, const_reference R) { return L < R; }
diff --git a/llvm/include/llvm/ADT/ilist_node_options.h b/llvm/include/llvm/ADT/ilist_node_options.h
index 003d5dabce897..53719b07a3768 100644
--- a/llvm/include/llvm/ADT/ilist_node_options.h
+++ b/llvm/include/llvm/ADT/ilist_node_options.h
@@ -58,8 +58,8 @@ namespace ilist_detail {
template <bool IsExplicit> struct explicitness {
static const bool is_explicit = IsExplicit;
};
-typedef explicitness<true> is_explicit;
-typedef explicitness<false> is_implicit;
+using is_explicit = explicitness<true>;
+using is_implicit = explicitness<false>;
/// Check whether an option is valid.
///
@@ -103,12 +103,12 @@ struct is_valid_option<ilist_sentinel_tracking<EnableSentinelTracking>>
template <class... Options> struct extract_tag;
template <class Tag, class... Options>
struct extract_tag<ilist_tag<Tag>, Options...> {
- typedef Tag type;
+ using type = Tag;
};
template <class Option1, class... Options>
struct extract_tag<Option1, Options...> : extract_tag<Options...> {};
template <> struct extract_tag<> {
- typedef void type;
+ using type = void;
};
template <class Tag> struct is_valid_option<ilist_tag<Tag>> : std::true_type {};
@@ -134,11 +134,13 @@ struct is_valid_option<ilist_iterator_bits<IteratorBits>> : std::true_type {};
template <class... Options> struct extract_parent;
template <class ParentTy, class... Options>
struct extract_parent<ilist_parent<ParentTy>, Options...> {
- typedef ParentTy type;
+ using type = ParentTy;
};
template <class Option1, class... Options>
struct extract_parent<Option1, Options...> : extract_parent<Options...> {};
-template <> struct extract_parent<> { typedef void type; };
+template <> struct extract_parent<> {
+ using type = void;
+};
template <class ParentTy>
struct is_valid_option<ilist_parent<ParentTy>> : std::true_type {};
@@ -154,28 +156,27 @@ struct check_options : std::conjunction<is_valid_option<Options>...> {};
template <class T, bool EnableSentinelTracking, bool IsSentinelTrackingExplicit,
class TagT, bool HasIteratorBits, class ParentTy>
struct node_options {
- typedef T value_type;
- typedef T *pointer;
- typedef T &reference;
- typedef const T *const_pointer;
- typedef const T &const_reference;
+ using value_type = T;
+ using pointer = T *;
+ using reference = T &;
+ using const_pointer = const T *;
+ using const_reference = const T &;
static const bool enable_sentinel_tracking = EnableSentinelTracking;
static const bool is_sentinel_tracking_explicit = IsSentinelTrackingExplicit;
static const bool has_iterator_bits = HasIteratorBits;
- typedef TagT tag;
- typedef ParentTy parent_ty;
- typedef ilist_node_base<enable_sentinel_tracking, parent_ty> node_base_type;
- typedef ilist_base<enable_sentinel_tracking, parent_ty> list_base_type;
+ using tag = TagT;
+ using parent_ty = ParentTy;
+ using node_base_type = ilist_node_base<enable_sentinel_tracking, parent_ty>;
+ using list_base_type = ilist_base<enable_sentinel_tracking, parent_ty>;
};
template <class T, class... Options> struct compute_node_options {
- typedef node_options<T, extract_sentinel_tracking<Options...>::value,
- extract_sentinel_tracking<Options...>::is_explicit,
- typename extract_tag<Options...>::type,
- extract_iterator_bits<Options...>::value,
- typename extract_parent<Options...>::type>
- type;
+ using type = node_options<T, extract_sentinel_tracking<Options...>::value,
+ extract_sentinel_tracking<Options...>::is_explicit,
+ typename extract_tag<Options...>::type,
+ extract_iterator_bits<Options...>::value,
+ typename extract_parent<Options...>::type>;
};
} // end namespace ilist_detail
diff --git a/llvm/unittests/ADT/APFloatTest.cpp b/llvm/unittests/ADT/APFloatTest.cpp
index fbe96bb127836..99cc38b6b422b 100644
--- a/llvm/unittests/ADT/APFloatTest.cpp
+++ b/llvm/unittests/ADT/APFloatTest.cpp
@@ -10118,7 +10118,7 @@ TEST(APFloatTest, Float4E2M1FNToFloat) {
}
TEST(APFloatTest, AddOrSubtractSignificand) {
- typedef detail::IEEEFloatUnitTestHelper Helper;
+ using Helper = detail::IEEEFloatUnitTestHelper;
// Test cases are all combinations of:
// {equal exponents, LHS larger exponent, RHS larger exponent}
// {equal significands, LHS larger significand, RHS larger significand}
diff --git a/llvm/unittests/ADT/BitVectorTest.cpp b/llvm/unittests/ADT/BitVectorTest.cpp
index 12ba0041af551..e13523b8e10c3 100644
--- a/llvm/unittests/ADT/BitVectorTest.cpp
+++ b/llvm/unittests/ADT/BitVectorTest.cpp
@@ -21,7 +21,7 @@ template <typename T>
class BitVectorTest : public ::testing::Test { };
// Test both BitVector and SmallBitVector with the same suite of tests.
-typedef ::testing::Types<BitVector, SmallBitVector> BitVectorTestTypes;
+using BitVectorTestTypes = ::testing::Types<BitVector, SmallBitVector>;
TYPED_TEST_SUITE(BitVectorTest, BitVectorTestTypes, );
TYPED_TEST(BitVectorTest, TrivialOperation) {
@@ -857,7 +857,7 @@ TYPED_TEST(BitVectorTest, BinOps) {
EXPECT_FALSE(B.anyCommon(A));
}
-typedef std::vector<std::pair<int, int>> RangeList;
+using RangeList = std::vector<std::pair<int, int>>;
template <typename VecType>
static inline VecType createBitVector(uint32_t Size,
diff --git a/llvm/unittests/ADT/BreadthFirstIteratorTest.cpp b/llvm/unittests/ADT/BreadthFirstIteratorTest.cpp
index a737390e79d8d..571e4d27c6752 100644
--- a/llvm/unittests/ADT/BreadthFirstIteratorTest.cpp
+++ b/llvm/unittests/ADT/BreadthFirstIteratorTest.cpp
@@ -21,7 +21,7 @@ using namespace llvm;
namespace llvm {
TEST(BreadthFristIteratorTest, Basic) {
- typedef bf_iterator<Graph<4>> BFIter;
+ using BFIter = bf_iterator<Graph<4>>;
Graph<4> G;
G.AddEdge(0, 1);
@@ -46,7 +46,7 @@ TEST(BreadthFristIteratorTest, Basic) {
}
TEST(BreadthFristIteratorTest, Cycle) {
- typedef bf_iterator<Graph<4>> BFIter;
+ using BFIter = bf_iterator<Graph<4>>;
Graph<4> G;
G.AddEdge(0, 1);
diff --git a/llvm/unittests/ADT/DAGDeltaAlgorithmTest.cpp b/llvm/unittests/ADT/DAGDeltaAlgorithmTest.cpp
index f543947899393..918a2e63da935 100644
--- a/llvm/unittests/ADT/DAGDeltaAlgorithmTest.cpp
+++ b/llvm/unittests/ADT/DAGDeltaAlgorithmTest.cpp
@@ -15,7 +15,7 @@ using namespace llvm;
namespace {
-typedef DAGDeltaAlgorithm::edge_ty edge_ty;
+using edge_ty = DAGDeltaAlgorithm::edge_ty;
class FixedDAGDeltaAlgorithm : public DAGDeltaAlgorithm {
changeset_ty FailingSet;
diff --git a/llvm/unittests/ADT/DenseMapTest.cpp b/llvm/unittests/ADT/DenseMapTest.cpp
index aceb4f30d878d..273ee09fc1e28 100644
--- a/llvm/unittests/ADT/DenseMapTest.cpp
+++ b/llvm/unittests/ADT/DenseMapTest.cpp
@@ -129,18 +129,17 @@ typename T::mapped_type *const DenseMapTest<T>::dummy_value_ptr = nullptr;
// Register these types for testing.
// clang-format off
-typedef ::testing::Types<DenseMap<uint32_t, uint32_t>,
- DenseMap<uint32_t *, uint32_t *>,
- DenseMap<CtorTester, CtorTester, CtorTesterMapInfo>,
- DenseMap<EnumClass, uint32_t>,
- DenseMap<std::optional<uint32_t>, uint32_t>,
- SmallDenseMap<uint32_t, uint32_t>,
- SmallDenseMap<uint32_t *, uint32_t *>,
- SmallDenseMap<CtorTester, CtorTester, 4,
- CtorTesterMapInfo>,
- SmallDenseMap<EnumClass, uint32_t>,
- SmallDenseMap<std::optional<uint32_t>, uint32_t>
- > DenseMapTestTypes;
+using DenseMapTestTypes = ::testing::Types<
+ DenseMap<uint32_t, uint32_t>,
+ DenseMap<uint32_t *, uint32_t *>,
+ DenseMap<CtorTester, CtorTester, CtorTesterMapInfo>,
+ DenseMap<EnumClass, uint32_t>,
+ DenseMap<std::optional<uint32_t>, uint32_t>,
+ SmallDenseMap<uint32_t, uint32_t>,
+ SmallDenseMap<uint32_t *, uint32_t *>,
+ SmallDenseMap<CtorTester, CtorTester, 4, CtorTesterMapInfo>,
+ SmallDenseMap<EnumClass, uint32_t>,
+ SmallDenseMap<std::optional<uint32_t>, uint32_t>>;
// clang-format on
TYPED_TEST_SUITE(DenseMapTest, DenseMapTestTypes, );
diff --git a/llvm/unittests/ADT/DenseSetTest.cpp b/llvm/unittests/ADT/DenseSetTest.cpp
index a24f99b6bb34f..a2a062b151b67 100644
--- a/llvm/unittests/ADT/DenseSetTest.cpp
+++ b/llvm/unittests/ADT/DenseSetTest.cpp
@@ -96,13 +96,13 @@ template <typename T> class DenseSetTest : public testing::Test {
};
// Register these types for testing.
-typedef ::testing::Types<DenseSet<unsigned, TestDenseSetInfo>,
- const DenseSet<unsigned, TestDenseSetInfo>,
- SmallDenseSet<unsigned, 1, TestDenseSetInfo>,
- SmallDenseSet<unsigned, 4, TestDenseSetInfo>,
- const SmallDenseSet<unsigned, 4, TestDenseSetInfo>,
- SmallDenseSet<unsigned, 64, TestDenseSetInfo>>
- DenseSetTestTypes;
+using DenseSetTestTypes =
+ ::testing::Types<DenseSet<unsigned, TestDenseSetInfo>,
+ const DenseSet<unsigned, TestDenseSetInfo>,
+ SmallDenseSet<unsigned, 1, TestDenseSetInfo>,
+ SmallDenseSet<unsigned, 4, TestDenseSetInfo>,
+ const SmallDenseSet<unsigned, 4, TestDenseSetInfo>,
+ SmallDenseSet<unsigned, 64, TestDenseSetInfo>>;
TYPED_TEST_SUITE(DenseSetTest, DenseSetTestTypes, );
TYPED_TEST(DenseSetTest, Constructor) {
diff --git a/llvm/unittests/ADT/DepthFirstIteratorTest.cpp b/llvm/unittests/ADT/DepthFirstIteratorTest.cpp
index f792878004e7a..00312ca6044e6 100644
--- a/llvm/unittests/ADT/DepthFirstIteratorTest.cpp
+++ b/llvm/unittests/ADT/DepthFirstIteratorTest.cpp
@@ -21,7 +21,7 @@ using namespace llvm;
namespace llvm {
template <typename T> struct CountedSet {
- typedef typename SmallPtrSet<T, 4>::iterator iterator;
+ using iterator = typename SmallPtrSet<T, 4>::iterator;
SmallPtrSet<T, 4> S;
int InsertVisited = 0;
@@ -44,8 +44,8 @@ template <typename T> class df_iterator_storage<CountedSet<T>, true> {
};
TEST(DepthFirstIteratorTest, ActuallyUpdateIterator) {
- typedef CountedSet<Graph<3>::NodeType *> StorageT;
- typedef df_iterator<Graph<3>, StorageT, true> DFIter;
+ using StorageT = CountedSet<Graph<3>::NodeType *>;
+ using DFIter = df_iterator<Graph<3>, StorageT, true>;
Graph<3> G;
G.AddEdge(0, 1);
diff --git a/llvm/unittests/ADT/IListBaseTest.cpp b/llvm/unittests/ADT/IListBaseTest.cpp
index bd915688b190d..eeed488c28d88 100644
--- a/llvm/unittests/ADT/IListBaseTest.cpp
+++ b/llvm/unittests/ADT/IListBaseTest.cpp
@@ -19,13 +19,14 @@ template <typename T> class IListBaseTest : public ::testing::Test {};
class Parent;
// Test variants with the same test.
-typedef ::testing::Types<ilist_base<false, void>, ilist_base<true, void>, ilist_base<false, Parent*>, ilist_base<true, Parent*>>
- IListBaseTestTypes;
+using IListBaseTestTypes =
+ ::testing::Types<ilist_base<false, void>, ilist_base<true, void>,
+ ilist_base<false, Parent *>, ilist_base<true, Parent *>>;
TYPED_TEST_SUITE(IListBaseTest, IListBaseTestTypes, );
TYPED_TEST(IListBaseTest, insertBeforeImpl) {
- typedef TypeParam list_base_type;
- typedef typename list_base_type::node_base_type node_base_type;
+ using list_base_type = TypeParam;
+ using node_base_type = typename list_base_type::node_base_type;
node_base_type S, A, B;
@@ -51,8 +52,8 @@ TYPED_TEST(IListBaseTest, insertBeforeImpl) {
}
TYPED_TEST(IListBaseTest, removeImpl) {
- typedef TypeParam list_base_type;
- typedef typename list_base_type::node_base_type node_base_type;
+ using list_base_type = TypeParam;
+ using node_base_type = typename list_base_type::node_base_type;
node_base_type S, A, B;
@@ -80,8 +81,8 @@ TYPED_TEST(IListBaseTest, removeImpl) {
}
TYPED_TEST(IListBaseTest, removeRangeImpl) {
- typedef TypeParam list_base_type;
- typedef typename list_base_type::node_base_type node_base_type;
+ using list_base_type = TypeParam;
+ using node_base_type = typename list_base_type::node_base_type;
node_base_type S, A, B, C, D;
@@ -106,8 +107,8 @@ TYPED_TEST(IListBaseTest, removeRangeImpl) {
}
TYPED_TEST(IListBaseTest, removeRangeImplAllButSentinel) {
- typedef TypeParam list_base_type;
- typedef typename list_base_type::node_base_type node_base_type;
+ using list_base_type = TypeParam;
+ using node_base_type = typename list_base_type::node_base_type;
node_base_type S, A, B;
@@ -126,8 +127,8 @@ TYPED_TEST(IListBaseTest, removeRangeImplAllButSentinel) {
}
TYPED_TEST(IListBaseTest, transferBeforeImpl) {
- typedef TypeParam list_base_type;
- typedef typename list_base_type::node_base_type node_base_type;
+ using list_base_type = TypeParam;
+ using node_base_type = typename list_base_type::node_base_type;
node_base_type S1, S2, A, B, C, D, E;
diff --git a/llvm/unittests/ADT/IListIteratorTest.cpp b/llvm/unittests/ADT/IListIteratorTest.cpp
index 4e5b847b35ffe..54a4258246e9b 100644
--- a/llvm/unittests/ADT/IListIteratorTest.cpp
+++ b/llvm/unittests/ADT/IListIteratorTest.cpp
@@ -141,10 +141,10 @@ TEST(IListIteratorTest, ReverseConstructor) {
L.insert(L.end(), B);
// Save typing.
- typedef simple_ilist<Node>::iterator iterator;
- typedef simple_ilist<Node>::reverse_iterator reverse_iterator;
- typedef simple_ilist<Node>::const_iterator const_iterator;
- typedef simple_ilist<Node>::const_reverse_iterator const_reverse_iterator;
+ using iterator = simple_ilist<Node>::iterator;
+ using reverse_iterator = simple_ilist<Node>::reverse_iterator;
+ using const_iterator = simple_ilist<Node>::const_iterator;
+ using const_reverse_iterator = simple_ilist<Node>::const_reverse_iterator;
// Check conversion values.
EXPECT_EQ(L.begin(), iterator(L.rend()));
diff --git a/llvm/unittests/ADT/IListNodeBaseTest.cpp b/llvm/unittests/ADT/IListNodeBaseTest.cpp
index ef90c716a4118..393f83af99b76 100644
--- a/llvm/unittests/ADT/IListNodeBaseTest.cpp
+++ b/llvm/unittests/ADT/IListNodeBaseTest.cpp
@@ -17,10 +17,10 @@ namespace {
class Parent {};
-typedef ilist_node_base<false, void> RawNode;
-typedef ilist_node_base<true, void> TrackingNode;
-typedef ilist_node_base<false, Parent> ParentNode;
-typedef ilist_node_base<true, Parent> ParentTrackingNode;
+using RawNode = ilist_node_base<false, void>;
+using TrackingNode = ilist_node_base<true, void>;
+using ParentNode = ilist_node_base<false, Parent>;
+using ParentTrackingNode = ilist_node_base<true, Parent>;
TEST(IListNodeBaseTest, DefaultConstructor) {
RawNode A;
diff --git a/llvm/unittests/ADT/IListSentinelTest.cpp b/llvm/unittests/ADT/IListSentinelTest.cpp
index 1f4a8311370a6..709a1a4bb90e7 100644
--- a/llvm/unittests/ADT/IListSentinelTest.cpp
+++ b/llvm/unittests/ADT/IListSentinelTest.cpp
@@ -14,18 +14,17 @@ using namespace llvm;
namespace {
template <class T, class... Options> struct PickSentinel {
- typedef ilist_sentinel<
- typename ilist_detail::compute_node_options<T, Options...>::type>
- type;
+ using type = ilist_sentinel<
+ typename ilist_detail::compute_node_options<T, Options...>::type>;
};
class Node : public ilist_node<Node> {};
class TrackingNode : public ilist_node<Node, ilist_sentinel_tracking<true>> {};
-typedef PickSentinel<Node>::type Sentinel;
-typedef PickSentinel<Node, ilist_sentinel_tracking<true>>::type
- TrackingSentinel;
-typedef PickSentinel<Node, ilist_sentinel_tracking<false>>::type
- NoTrackingSentinel;
+using Sentinel = PickSentinel<Node>::type;
+using TrackingSentinel =
+ PickSentinel<Node, ilist_sentinel_tracking<true>>::type;
+using NoTrackingSentinel =
+ PickSentinel<Node, ilist_sentinel_tracking<false>>::type;
struct LocalAccess : ilist_detail::NodeAccess {
using NodeAccess::getPrev;
diff --git a/llvm/unittests/ADT/IntervalMapTest.cpp b/llvm/unittests/ADT/IntervalMapTest.cpp
index 99a93ab198d89..38f397ff2eb54 100644
--- a/llvm/unittests/ADT/IntervalMapTest.cpp
+++ b/llvm/unittests/ADT/IntervalMapTest.cpp
@@ -14,9 +14,9 @@ using namespace llvm;
namespace {
-typedef IntervalMap<unsigned, unsigned, 4> UUMap;
-typedef IntervalMap<unsigned, unsigned, 4,
- IntervalMapHalfOpenInfo<unsigned>> UUHalfOpenMap;
+using UUMap = IntervalMap<unsigned, unsigned, 4>;
+using UUHalfOpenMap =
+ IntervalMap<unsigned, unsigned, 4, IntervalMapHalfOpenInfo<unsigned>>;
// Empty map tests
TEST(IntervalMapTest, EmptyMap) {
@@ -713,7 +713,7 @@ TEST(IntervalMapTest, OverlapsHalfOpen) {
}
TEST(IntervalMapOverlapsTest, SmallMaps) {
- typedef IntervalMapOverlaps<UUMap,UUMap> UUOverlaps;
+ using UUOverlaps = IntervalMapOverlaps<UUMap, UUMap>;
UUMap::Allocator allocator;
UUMap mapA(allocator);
UUMap mapB(allocator);
@@ -757,7 +757,7 @@ TEST(IntervalMapOverlapsTest, SmallMaps) {
}
TEST(IntervalMapOverlapsTest, BigMaps) {
- typedef IntervalMapOverlaps<UUMap,UUMap> UUOverlaps;
+ using UUOverlaps = IntervalMapOverlaps<UUMap, UUMap>;
UUMap::Allocator allocator;
UUMap mapA(allocator);
UUMap mapB(allocator);
diff --git a/llvm/unittests/ADT/IntrusiveRefCntPtrTest.cpp b/llvm/unittests/ADT/IntrusiveRefCntPtrTest.cpp
index f4f2083482804..6da42271764bc 100644
--- a/llvm/unittests/ADT/IntrusiveRefCntPtrTest.cpp
+++ b/llvm/unittests/ADT/IntrusiveRefCntPtrTest.cpp
@@ -25,9 +25,9 @@ struct SimpleRefCounted : Base<SimpleRefCounted<Base>> {
template <typename T> struct IntrusiveRefCntPtrTest : testing::Test {};
-typedef ::testing::Types<SimpleRefCounted<RefCountedBase>,
- SimpleRefCounted<ThreadSafeRefCountedBase>>
- IntrusiveRefCntTypes;
+using IntrusiveRefCntTypes =
+ ::testing::Types<SimpleRefCounted<RefCountedBase>,
+ SimpleRefCounted<ThreadSafeRefCountedBase>>;
TYPED_TEST_SUITE(IntrusiveRefCntPtrTest, IntrusiveRefCntTypes, );
TYPED_TEST(IntrusiveRefCntPtrTest, RefCountedBaseCopyDoesNotLeak) {
diff --git a/llvm/unittests/ADT/IteratorTest.cpp b/llvm/unittests/ADT/IteratorTest.cpp
index b5d63efd8ccba..9dd8c1a84f44a 100644
--- a/llvm/unittests/ADT/IteratorTest.cpp
+++ b/llvm/unittests/ADT/IteratorTest.cpp
@@ -177,8 +177,8 @@ TEST(PointeeIteratorTest, Basic) {
V.push_back(&arr[2]);
V.push_back(&arr[3]);
- typedef pointee_iterator<SmallVectorImpl<int *>::const_iterator>
- test_iterator;
+ using test_iterator =
+ pointee_iterator<SmallVectorImpl<int *>::const_iterator>;
test_iterator Begin, End;
Begin = V.begin();
@@ -218,9 +218,8 @@ TEST(PointeeIteratorTest, SmartPointer) {
V.push_back(std::make_unique<int>(3));
V.push_back(std::make_unique<int>(4));
- typedef pointee_iterator<
- SmallVectorImpl<std::unique_ptr<int>>::const_iterator>
- test_iterator;
+ using test_iterator =
+ pointee_iterator<SmallVectorImpl<std::unique_ptr<int>>::const_iterator>;
test_iterator Begin, End;
Begin = V.begin();
diff --git a/llvm/unittests/ADT/PointerSumTypeTest.cpp b/llvm/unittests/ADT/PointerSumTypeTest.cpp
index fbf59f3a2fda5..11e657ad8bd25 100644
--- a/llvm/unittests/ADT/PointerSumTypeTest.cpp
+++ b/llvm/unittests/ADT/PointerSumTypeTest.cpp
@@ -17,10 +17,9 @@ struct PointerSumTypeTest : public testing::Test {
float f;
int i1, i2;
- typedef PointerSumType<Kinds, PointerSumTypeMember<Float, float *>,
- PointerSumTypeMember<Int1, int *>,
- PointerSumTypeMember<Int2, int *>>
- SumType;
+ using SumType = PointerSumType<Kinds, PointerSumTypeMember<Float, float *>,
+ PointerSumTypeMember<Int1, int *>,
+ PointerSumTypeMember<Int2, int *>>;
SumType a, b, c, n;
PointerSumTypeTest()
diff --git a/llvm/unittests/ADT/PointerUnionTest.cpp b/llvm/unittests/ADT/PointerUnionTest.cpp
index acddb78960149..d8ac3aed76da2 100644
--- a/llvm/unittests/ADT/PointerUnionTest.cpp
+++ b/llvm/unittests/ADT/PointerUnionTest.cpp
@@ -12,9 +12,9 @@ using namespace llvm;
namespace {
-typedef PointerUnion<int *, float *> PU;
-typedef PointerUnion<int *, float *, long long *> PU3;
-typedef PointerUnion<int *, float *, long long *, double *> PU4;
+using PU = PointerUnion<int *, float *>;
+using PU3 = PointerUnion<int *, float *, long long *>;
+using PU4 = PointerUnion<int *, float *, long long *, double *>;
struct PointerUnionTest : public testing::Test {
float f;
@@ -116,9 +116,9 @@ TEST_F(PointerUnionTest, Get) {
template<int I> struct alignas(8) Aligned {};
-typedef PointerUnion<Aligned<0> *, Aligned<1> *, Aligned<2> *, Aligned<3> *,
- Aligned<4> *, Aligned<5> *, Aligned<6> *, Aligned<7> *>
- PU8;
+using PU8 =
+ PointerUnion<Aligned<0> *, Aligned<1> *, Aligned<2> *, Aligned<3> *,
+ Aligned<4> *, Aligned<5> *, Aligned<6> *, Aligned<7> *>;
TEST_F(PointerUnionTest, ManyElements) {
Aligned<0> a0;
diff --git a/llvm/unittests/ADT/PostOrderIteratorTest.cpp b/llvm/unittests/ADT/PostOrderIteratorTest.cpp
index 838481f76ed7f..e875dd63a1958 100644
--- a/llvm/unittests/ADT/PostOrderIteratorTest.cpp
+++ b/llvm/unittests/ADT/PostOrderIteratorTest.cpp
@@ -23,7 +23,7 @@ namespace {
// Whether we're able to compile
TEST(PostOrderIteratorTest, Compiles) {
- typedef SmallPtrSet<void *, 4> ExtSetTy;
+ using ExtSetTy = SmallPtrSet<void *, 4>;
// Tests that template specializations are kept up to date
void *Null = nullptr;
diff --git a/llvm/unittests/ADT/PriorityWorklistTest.cpp b/llvm/unittests/ADT/PriorityWorklistTest.cpp
index f12d32ac9f496..08a47736c392e 100644
--- a/llvm/unittests/ADT/PriorityWorklistTest.cpp
+++ b/llvm/unittests/ADT/PriorityWorklistTest.cpp
@@ -20,8 +20,8 @@ namespace {
using namespace llvm;
template <typename T> class PriorityWorklistTest : public ::testing::Test {};
-typedef ::testing::Types<PriorityWorklist<int>, SmallPriorityWorklist<int, 2>>
- TestTypes;
+using TestTypes =
+ ::testing::Types<PriorityWorklist<int>, SmallPriorityWorklist<int, 2>>;
TYPED_TEST_SUITE(PriorityWorklistTest, TestTypes, );
TYPED_TEST(PriorityWorklistTest, Basic) {
diff --git a/llvm/unittests/ADT/RangeAdapterTest.cpp b/llvm/unittests/ADT/RangeAdapterTest.cpp
index c1a8a984f233b..6849ccbc8052d 100644
--- a/llvm/unittests/ADT/RangeAdapterTest.cpp
+++ b/llvm/unittests/ADT/RangeAdapterTest.cpp
@@ -24,8 +24,8 @@ class ReverseOnlyVector {
public:
ReverseOnlyVector(std::initializer_list<int> list) : Vec(list) {}
- typedef std::vector<int>::reverse_iterator reverse_iterator;
- typedef std::vector<int>::const_reverse_iterator const_reverse_iterator;
+ using reverse_iterator = std::vector<int>::reverse_iterator;
+ using const_reverse_iterator = std::vector<int>::const_reverse_iterator;
reverse_iterator rbegin() { return Vec.rbegin(); }
reverse_iterator rend() { return Vec.rend(); }
const_reverse_iterator rbegin() const { return Vec.rbegin(); }
@@ -41,11 +41,11 @@ class BidirectionalVector {
public:
BidirectionalVector(std::initializer_list<int> list) : Vec(list) {}
- typedef std::vector<int>::iterator iterator;
+ using iterator = std::vector<int>::iterator;
iterator begin() const;
iterator end() const;
- typedef std::vector<int>::reverse_iterator reverse_iterator;
+ using reverse_iterator = std::vector<int>::reverse_iterator;
reverse_iterator rbegin() const { return Vec.rbegin(); }
reverse_iterator rend() const { return Vec.rend(); }
};
@@ -58,15 +58,15 @@ class BidirectionalVectorConsts {
public:
BidirectionalVectorConsts(std::initializer_list<int> list) : Vec(list) {}
- typedef std::vector<int>::iterator iterator;
- typedef std::vector<int>::const_iterator const_iterator;
+ using iterator = std::vector<int>::iterator;
+ using const_iterator = std::vector<int>::const_iterator;
iterator begin();
iterator end();
const_iterator begin() const;
const_iterator end() const;
- typedef std::vector<int>::reverse_iterator reverse_iterator;
- typedef std::vector<int>::const_reverse_iterator const_reverse_iterator;
+ using reverse_iterator = std::vector<int>::reverse_iterator;
+ using const_reverse_iterator = std::vector<int>::const_reverse_iterator;
reverse_iterator rbegin() { return Vec.rbegin(); }
reverse_iterator rend() { return Vec.rend(); }
const_reverse_iterator rbegin() const { return Vec.rbegin(); }
@@ -80,7 +80,7 @@ class CustomIteratorVector {
public:
CustomIteratorVector(std::initializer_list<int> list) : V(list) {}
- typedef std::vector<int>::iterator iterator;
+ using iterator = std::vector<int>::iterator;
class reverse_iterator {
std::vector<int>::iterator I;
@@ -126,8 +126,8 @@ template <typename R> void TestRev(const R &r) {
// Test fixture
template <typename T> class RangeAdapterLValueTest : public ::testing::Test {};
-typedef ::testing::Types<std::vector<int>, std::list<int>, int[4]>
- RangeAdapterLValueTestTypes;
+using RangeAdapterLValueTestTypes =
+ ::testing::Types<std::vector<int>, std::list<int>, int[4]>;
TYPED_TEST_SUITE(RangeAdapterLValueTest, RangeAdapterLValueTestTypes, );
TYPED_TEST(RangeAdapterLValueTest, TrivialOperation) {
@@ -140,10 +140,10 @@ TYPED_TEST(RangeAdapterLValueTest, TrivialOperation) {
template <typename T> struct RangeAdapterRValueTest : testing::Test {};
-typedef ::testing::Types<std::vector<int>, std::list<int>, CustomIteratorVector,
- ReverseOnlyVector, BidirectionalVector,
- BidirectionalVectorConsts>
- RangeAdapterRValueTestTypes;
+using RangeAdapterRValueTestTypes =
+ ::testing::Types<std::vector<int>, std::list<int>, CustomIteratorVector,
+ ReverseOnlyVector, BidirectionalVector,
+ BidirectionalVectorConsts>;
TYPED_TEST_SUITE(RangeAdapterRValueTest, RangeAdapterRValueTestTypes, );
TYPED_TEST(RangeAdapterRValueTest, TrivialOperation) {
diff --git a/llvm/unittests/ADT/SCCIteratorTest.cpp b/llvm/unittests/ADT/SCCIteratorTest.cpp
index 48350959d046b..5f088294b1a2d 100644
--- a/llvm/unittests/ADT/SCCIteratorTest.cpp
+++ b/llvm/unittests/ADT/SCCIteratorTest.cpp
@@ -21,7 +21,7 @@ TEST(SCCIteratorTest, AllSmallGraphs) {
// create graphs for which every node has a self-edge.
#define NUM_NODES 4
#define NUM_GRAPHS (NUM_NODES * (NUM_NODES - 1))
- typedef Graph<NUM_NODES> GT;
+ using GT = Graph<NUM_NODES>;
/// Enumerate all graphs using NUM_GRAPHS bits.
static_assert(NUM_GRAPHS < sizeof(unsigned) * CHAR_BIT, "Too many graphs!");
diff --git a/llvm/unittests/ADT/STLExtrasTest.cpp b/llvm/unittests/ADT/STLExtrasTest.cpp
index 966b1f01e8a31..85567775e4ebd 100644
--- a/llvm/unittests/ADT/STLExtrasTest.cpp
+++ b/llvm/unittests/ADT/STLExtrasTest.cpp
@@ -60,7 +60,7 @@ TEST(STLExtrasTest, EnumerateLValue) {
// Test that a simple LValue can be enumerated and gives correct results with
// multiple types, including the empty container.
std::vector<char> foo = {'a', 'b', 'c'};
- typedef std::pair<std::size_t, char> CharPairType;
+ using CharPairType = std::pair<std::size_t, char>;
std::vector<CharPairType> CharResults;
for (auto [index, value] : llvm::enumerate(foo)) {
@@ -72,7 +72,7 @@ TEST(STLExtrasTest, EnumerateLValue) {
CharPairType(2u, 'c')));
// Test a const range of a
diff erent type.
- typedef std::pair<std::size_t, int> IntPairType;
+ using IntPairType = std::pair<std::size_t, int>;
std::vector<IntPairType> IntResults;
const std::vector<int> bar = {1, 2, 3};
for (auto [index, value] : llvm::enumerate(bar)) {
@@ -111,7 +111,7 @@ TEST(STLExtrasTest, EnumerateModifyLValue) {
TEST(STLExtrasTest, EnumerateRValueRef) {
// Test that an rvalue can be enumerated.
- typedef std::pair<std::size_t, int> PairType;
+ using PairType = std::pair<std::size_t, int>;
std::vector<PairType> Results;
auto Enumerator = llvm::enumerate(std::vector<int>{1, 2, 3});
@@ -138,7 +138,7 @@ TEST(STLExtrasTest, EnumerateModifyRValue) {
// Test that when enumerating an rvalue, modification still works (even if
// this isn't terribly useful, it at least shows that we haven't snuck an
// extra const in there somewhere.
- typedef std::pair<std::size_t, char> PairType;
+ using PairType = std::pair<std::size_t, char>;
std::vector<PairType> Results;
for (auto X : llvm::enumerate(std::vector<char>{'1', '2', '3'})) {
diff --git a/llvm/unittests/ADT/SimpleIListTest.cpp b/llvm/unittests/ADT/SimpleIListTest.cpp
index c2992baf8a5f7..cf3df8c293e25 100644
--- a/llvm/unittests/ADT/SimpleIListTest.cpp
+++ b/llvm/unittests/ADT/SimpleIListTest.cpp
@@ -605,8 +605,8 @@ struct Tag2 {};
struct DoubleNode : ilist_node<DoubleNode, ilist_tag<Tag1>>,
ilist_node<DoubleNode, ilist_tag<Tag2>> {
- typedef ilist_node<DoubleNode, ilist_tag<Tag1>> Node1Type;
- typedef ilist_node<DoubleNode, ilist_tag<Tag2>> Node2Type;
+ using Node1Type = ilist_node<DoubleNode, ilist_tag<Tag1>>;
+ using Node2Type = ilist_node<DoubleNode, ilist_tag<Tag2>>;
Node1Type::self_iterator getIterator1() { return Node1Type::getIterator(); }
Node2Type::self_iterator getIterator2() { return Node2Type::getIterator(); }
@@ -617,8 +617,8 @@ struct DoubleNode : ilist_node<DoubleNode, ilist_tag<Tag1>>,
return Node2Type::getIterator();
}
};
-typedef simple_ilist<DoubleNode, ilist_tag<Tag1>> TaggedList1Type;
-typedef simple_ilist<DoubleNode, ilist_tag<Tag2>> TaggedList2Type;
+using TaggedList1Type = simple_ilist<DoubleNode, ilist_tag<Tag1>>;
+using TaggedList2Type = simple_ilist<DoubleNode, ilist_tag<Tag2>>;
TEST(SimpleIListTest, TaggedLists) {
TaggedList1Type L1;
diff --git a/llvm/unittests/ADT/SmallPtrSetTest.cpp b/llvm/unittests/ADT/SmallPtrSetTest.cpp
index a627091b90c70..fe7a8279d06b1 100644
--- a/llvm/unittests/ADT/SmallPtrSetTest.cpp
+++ b/llvm/unittests/ADT/SmallPtrSetTest.cpp
@@ -57,7 +57,7 @@ TEST(SmallPtrSetTest, GrowthTest) {
SmallPtrSet<int *, 4> s;
- typedef SmallPtrSet<int *, 4>::iterator iter;
+ using iter = SmallPtrSet<int *, 4>::iterator;
s.insert(&buf[0]);
s.insert(&buf[1]);
diff --git a/llvm/unittests/ADT/SmallStringTest.cpp b/llvm/unittests/ADT/SmallStringTest.cpp
index 2f4df8afeafa5..db858246c9bbf 100644
--- a/llvm/unittests/ADT/SmallStringTest.cpp
+++ b/llvm/unittests/ADT/SmallStringTest.cpp
@@ -23,7 +23,7 @@ namespace {
// Test fixture class
class SmallStringTest : public testing::Test {
protected:
- typedef SmallString<40> StringType;
+ using StringType = SmallString<40>;
StringType theString;
diff --git a/llvm/unittests/ADT/SmallVectorTest.cpp b/llvm/unittests/ADT/SmallVectorTest.cpp
index 74fc737f29335..dbc626db54482 100644
--- a/llvm/unittests/ADT/SmallVectorTest.cpp
+++ b/llvm/unittests/ADT/SmallVectorTest.cpp
@@ -226,13 +226,10 @@ class SmallVectorTest : public SmallVectorTestBase {
VectorT otherVector;
};
-
-typedef ::testing::Types<SmallVector<Constructable, 0>,
- SmallVector<Constructable, 1>,
- SmallVector<Constructable, 2>,
- SmallVector<Constructable, 4>,
- SmallVector<Constructable, 5>
- > SmallVectorTestTypes;
+using SmallVectorTestTypes = ::testing::Types<
+ SmallVector<Constructable, 0>, SmallVector<Constructable, 1>,
+ SmallVector<Constructable, 2>, SmallVector<Constructable, 4>,
+ SmallVector<Constructable, 5>>;
TYPED_TEST_SUITE(SmallVectorTest, SmallVectorTestTypes, );
// Constructor test.
@@ -537,11 +534,11 @@ TYPED_TEST(SmallVectorTest, AppendNonIterTest) {
}
struct output_iterator {
- typedef std::output_iterator_tag iterator_category;
- typedef int value_type;
- typedef int
diff erence_type;
- typedef value_type *pointer;
- typedef value_type &reference;
+ using iterator_category = std::output_iterator_tag;
+ using value_type = int;
+ using
diff erence_type = int;
+ using pointer = value_type *;
+ using reference = value_type &;
operator int() { return 2; }
operator Constructable() { return 7; }
};
@@ -896,7 +893,7 @@ class DualSmallVectorsTest<std::pair<VectorT1, VectorT2>> : public SmallVectorTe
VectorT2 otherVector;
};
-typedef ::testing::Types<
+using DualSmallVectorTestTypes = ::testing::Types<
// Small mode -> Small mode.
std::pair<SmallVector<Constructable, 4>, SmallVector<Constructable, 4>>,
// Small mode -> Big mode.
@@ -904,8 +901,7 @@ typedef ::testing::Types<
// Big mode -> Small mode.
std::pair<SmallVector<Constructable, 2>, SmallVector<Constructable, 4>>,
// Big mode -> Big mode.
- std::pair<SmallVector<Constructable, 2>, SmallVector<Constructable, 2>>
- > DualSmallVectorTestTypes;
+ std::pair<SmallVector<Constructable, 2>, SmallVector<Constructable, 2>>>;
TYPED_TEST_SUITE(DualSmallVectorsTest, DualSmallVectorTestTypes, );
diff --git a/llvm/unittests/ADT/SparseMultiSetTest.cpp b/llvm/unittests/ADT/SparseMultiSetTest.cpp
index 54f7bc99b52fa..91d37f4684b9e 100644
--- a/llvm/unittests/ADT/SparseMultiSetTest.cpp
+++ b/llvm/unittests/ADT/SparseMultiSetTest.cpp
@@ -13,7 +13,7 @@ using namespace llvm;
namespace {
-typedef SparseMultiSet<unsigned> USet;
+using USet = SparseMultiSet<unsigned>;
// Empty set tests.
TEST(SparseMultiSetTest, EmptySet) {
@@ -211,7 +211,7 @@ struct Alt {
};
TEST(SparseMultiSetTest, AltStructSet) {
- typedef SparseMultiSet<Alt> ASet;
+ using ASet = SparseMultiSet<Alt>;
ASet Set;
Set.setUniverse(10);
Set.insert(Alt(1005));
diff --git a/llvm/unittests/ADT/SparseSetTest.cpp b/llvm/unittests/ADT/SparseSetTest.cpp
index 4fbf1caa247b7..f2b932907dc38 100644
--- a/llvm/unittests/ADT/SparseSetTest.cpp
+++ b/llvm/unittests/ADT/SparseSetTest.cpp
@@ -13,7 +13,7 @@ using namespace llvm;
namespace {
-typedef SparseSet<unsigned> USet;
+using USet = SparseSet<unsigned>;
// Empty set tests.
TEST(SparseSetTest, EmptySet) {
@@ -166,7 +166,7 @@ struct Alt {
};
TEST(SparseSetTest, AltStructSet) {
- typedef SparseSet<Alt> ASet;
+ using ASet = SparseSet<Alt>;
ASet Set;
Set.setUniverse(10);
Set.insert(Alt(1005));
diff --git a/llvm/unittests/ADT/TestGraph.h b/llvm/unittests/ADT/TestGraph.h
index a59ab504f7144..bb2ec47a0d5fe 100644
--- a/llvm/unittests/ADT/TestGraph.h
+++ b/llvm/unittests/ADT/TestGraph.h
@@ -34,7 +34,7 @@ class Graph {
/// NodeSubset - A subset of the graph's nodes.
class NodeSubset {
- typedef unsigned char BitVector; // Where the limitation N <= 8 comes from.
+ using BitVector = unsigned char; // Where the limitation N <= 8 comes from.
BitVector Elements;
NodeSubset(BitVector e) : Elements(e) {}
public:
@@ -96,7 +96,7 @@ class Graph {
};
/// NodeType - Node index and set of children of the node.
- typedef std::pair<unsigned, NodeSubset> NodeType;
+ using NodeType = std::pair<unsigned, NodeSubset>;
private:
/// Nodes - The list of nodes for this graph.
@@ -233,8 +233,8 @@ class Graph {
template <unsigned N>
struct GraphTraits<Graph<N> > {
- typedef typename Graph<N>::NodeType *NodeRef;
- typedef typename Graph<N>::ChildIterator ChildIteratorType;
+ using NodeRef = typename Graph<N>::NodeType *;
+ using ChildIteratorType = typename Graph<N>::ChildIterator;
static NodeRef getEntryNode(const Graph<N> &G) { return G.AccessNode(0); }
static ChildIteratorType child_begin(NodeRef Node) {
diff --git a/llvm/unittests/ADT/TinyPtrVectorTest.cpp b/llvm/unittests/ADT/TinyPtrVectorTest.cpp
index af4ae4f4b0db9..c77721df5055c 100644
--- a/llvm/unittests/ADT/TinyPtrVectorTest.cpp
+++ b/llvm/unittests/ADT/TinyPtrVectorTest.cpp
@@ -28,14 +28,14 @@ template <typename PointerTy, unsigned IntBits, typename IntType,
typename PtrTraits, typename Info>
struct RemovePointer<
PointerIntPair<PointerTy, IntBits, IntType, PtrTraits, Info>> {
- typedef typename RemovePointer<PointerTy>::type type;
+ using type = typename RemovePointer<PointerTy>::type;
};
template <typename VectorT>
class TinyPtrVectorTest : public testing::Test {
protected:
- typedef typename VectorT::value_type PtrT;
- typedef typename RemovePointer<PtrT>::type ValueT;
+ using PtrT = typename VectorT::value_type;
+ using ValueT = typename RemovePointer<PtrT>::type;
using PtrTraits = PointerLikeTypeTraits<PtrT>;
VectorT V;
@@ -78,9 +78,9 @@ class TinyPtrVectorTest : public testing::Test {
}
};
-typedef ::testing::Types<TinyPtrVector<int *>, TinyPtrVector<double *>,
- TinyPtrVector<PointerIntPair<int *, 1>>>
- TinyPtrVectorTestTypes;
+using TinyPtrVectorTestTypes =
+ ::testing::Types<TinyPtrVector<int *>, TinyPtrVector<double *>,
+ TinyPtrVector<PointerIntPair<int *, 1>>>;
TYPED_TEST_SUITE(TinyPtrVectorTest, TinyPtrVectorTestTypes, );
TYPED_TEST(TinyPtrVectorTest, EmptyTest) {
More information about the llvm-commits
mailing list