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::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 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 const_set_bits_iterator; - typedef const_set_bits_iterator set_iterator; + using const_set_bits_iterator = const_set_bits_iterator_impl; + 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 class DominatorTreeBase; template 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 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::difference_type difference_type; + using difference_type = + typename std::iterator_traits::difference_type; for (auto size = last - first; size > 1; ++first, (void)--size) { difference_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 struct ilist_traits {}; /// list. template 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::difference_type difference_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 difference_type = typename base_list_type::difference_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 struct explicitness { static const bool is_explicit = IsExplicit; }; -typedef explicitness is_explicit; -typedef explicitness is_implicit; +using is_explicit = explicitness; +using is_implicit = explicitness; /// Check whether an option is valid. /// @@ -103,12 +103,12 @@ struct is_valid_option> template struct extract_tag; template struct extract_tag, Options...> { - typedef Tag type; + using type = Tag; }; template struct extract_tag : extract_tag {}; template <> struct extract_tag<> { - typedef void type; + using type = void; }; template struct is_valid_option> : std::true_type {}; @@ -134,11 +134,13 @@ struct is_valid_option> : std::true_type {}; template struct extract_parent; template struct extract_parent, Options...> { - typedef ParentTy type; + using type = ParentTy; }; template struct extract_parent : extract_parent {}; -template <> struct extract_parent<> { typedef void type; }; +template <> struct extract_parent<> { + using type = void; +}; template struct is_valid_option> : std::true_type {}; @@ -154,28 +156,27 @@ struct check_options : std::conjunction...> {}; template 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 node_base_type; - typedef ilist_base list_base_type; + using tag = TagT; + using parent_ty = ParentTy; + using node_base_type = ilist_node_base; + using list_base_type = ilist_base; }; template struct compute_node_options { - typedef node_options::value, - extract_sentinel_tracking::is_explicit, - typename extract_tag::type, - extract_iterator_bits::value, - typename extract_parent::type> - type; + using type = node_options::value, + extract_sentinel_tracking::is_explicit, + typename extract_tag::type, + extract_iterator_bits::value, + typename extract_parent::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 class BitVectorTest : public ::testing::Test { }; // Test both BitVector and SmallBitVector with the same suite of tests. -typedef ::testing::Types BitVectorTestTypes; +using BitVectorTestTypes = ::testing::Types; 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> RangeList; +using RangeList = std::vector>; template 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> BFIter; + using BFIter = bf_iterator>; Graph<4> G; G.AddEdge(0, 1); @@ -46,7 +46,7 @@ TEST(BreadthFristIteratorTest, Basic) { } TEST(BreadthFristIteratorTest, Cycle) { - typedef bf_iterator> BFIter; + using BFIter = bf_iterator>; 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::dummy_value_ptr = nullptr; // Register these types for testing. // clang-format off -typedef ::testing::Types, - DenseMap, - DenseMap, - DenseMap, - DenseMap, uint32_t>, - SmallDenseMap, - SmallDenseMap, - SmallDenseMap, - SmallDenseMap, - SmallDenseMap, uint32_t> - > DenseMapTestTypes; +using DenseMapTestTypes = ::testing::Types< + DenseMap, + DenseMap, + DenseMap, + DenseMap, + DenseMap, uint32_t>, + SmallDenseMap, + SmallDenseMap, + SmallDenseMap, + SmallDenseMap, + SmallDenseMap, 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 class DenseSetTest : public testing::Test { }; // Register these types for testing. -typedef ::testing::Types, - const DenseSet, - SmallDenseSet, - SmallDenseSet, - const SmallDenseSet, - SmallDenseSet> - DenseSetTestTypes; +using DenseSetTestTypes = + ::testing::Types, + const DenseSet, + SmallDenseSet, + SmallDenseSet, + const SmallDenseSet, + SmallDenseSet>; 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 struct CountedSet { - typedef typename SmallPtrSet::iterator iterator; + using iterator = typename SmallPtrSet::iterator; SmallPtrSet S; int InsertVisited = 0; @@ -44,8 +44,8 @@ template class df_iterator_storage, true> { }; TEST(DepthFirstIteratorTest, ActuallyUpdateIterator) { - typedef CountedSet::NodeType *> StorageT; - typedef df_iterator, StorageT, true> DFIter; + using StorageT = CountedSet::NodeType *>; + using DFIter = df_iterator, 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 class IListBaseTest : public ::testing::Test {}; class Parent; // Test variants with the same test. -typedef ::testing::Types, ilist_base, ilist_base, ilist_base> - IListBaseTestTypes; +using IListBaseTestTypes = + ::testing::Types, ilist_base, + ilist_base, ilist_base>; 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::iterator iterator; - typedef simple_ilist::reverse_iterator reverse_iterator; - typedef simple_ilist::const_iterator const_iterator; - typedef simple_ilist::const_reverse_iterator const_reverse_iterator; + using iterator = simple_ilist::iterator; + using reverse_iterator = simple_ilist::reverse_iterator; + using const_iterator = simple_ilist::const_iterator; + using const_reverse_iterator = simple_ilist::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 RawNode; -typedef ilist_node_base TrackingNode; -typedef ilist_node_base ParentNode; -typedef ilist_node_base ParentTrackingNode; +using RawNode = ilist_node_base; +using TrackingNode = ilist_node_base; +using ParentNode = ilist_node_base; +using ParentTrackingNode = ilist_node_base; 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 struct PickSentinel { - typedef ilist_sentinel< - typename ilist_detail::compute_node_options::type> - type; + using type = ilist_sentinel< + typename ilist_detail::compute_node_options::type>; }; class Node : public ilist_node {}; class TrackingNode : public ilist_node> {}; -typedef PickSentinel::type Sentinel; -typedef PickSentinel>::type - TrackingSentinel; -typedef PickSentinel>::type - NoTrackingSentinel; +using Sentinel = PickSentinel::type; +using TrackingSentinel = + PickSentinel>::type; +using NoTrackingSentinel = + PickSentinel>::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 UUMap; -typedef IntervalMap> UUHalfOpenMap; +using UUMap = IntervalMap; +using UUHalfOpenMap = + IntervalMap>; // Empty map tests TEST(IntervalMapTest, EmptyMap) { @@ -713,7 +713,7 @@ TEST(IntervalMapTest, OverlapsHalfOpen) { } TEST(IntervalMapOverlapsTest, SmallMaps) { - typedef IntervalMapOverlaps UUOverlaps; + using UUOverlaps = IntervalMapOverlaps; UUMap::Allocator allocator; UUMap mapA(allocator); UUMap mapB(allocator); @@ -757,7 +757,7 @@ TEST(IntervalMapOverlapsTest, SmallMaps) { } TEST(IntervalMapOverlapsTest, BigMaps) { - typedef IntervalMapOverlaps UUOverlaps; + using UUOverlaps = IntervalMapOverlaps; 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> { template struct IntrusiveRefCntPtrTest : testing::Test {}; -typedef ::testing::Types, - SimpleRefCounted> - IntrusiveRefCntTypes; +using IntrusiveRefCntTypes = + ::testing::Types, + SimpleRefCounted>; 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::const_iterator> - test_iterator; + using test_iterator = + pointee_iterator::const_iterator>; test_iterator Begin, End; Begin = V.begin(); @@ -218,9 +218,8 @@ TEST(PointeeIteratorTest, SmartPointer) { V.push_back(std::make_unique(3)); V.push_back(std::make_unique(4)); - typedef pointee_iterator< - SmallVectorImpl>::const_iterator> - test_iterator; + using test_iterator = + pointee_iterator>::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, - PointerSumTypeMember, - PointerSumTypeMember> - SumType; + using SumType = PointerSumType, + PointerSumTypeMember, + PointerSumTypeMember>; 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 PU; -typedef PointerUnion PU3; -typedef PointerUnion PU4; +using PU = PointerUnion; +using PU3 = PointerUnion; +using PU4 = PointerUnion; struct PointerUnionTest : public testing::Test { float f; @@ -116,9 +116,9 @@ TEST_F(PointerUnionTest, Get) { template struct alignas(8) Aligned {}; -typedef PointerUnion *, Aligned<1> *, Aligned<2> *, Aligned<3> *, - Aligned<4> *, Aligned<5> *, Aligned<6> *, Aligned<7> *> - PU8; +using PU8 = + PointerUnion *, 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 ExtSetTy; + using ExtSetTy = SmallPtrSet; // 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 class PriorityWorklistTest : public ::testing::Test {}; -typedef ::testing::Types, SmallPriorityWorklist> - TestTypes; +using TestTypes = + ::testing::Types, SmallPriorityWorklist>; 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 list) : Vec(list) {} - typedef std::vector::reverse_iterator reverse_iterator; - typedef std::vector::const_reverse_iterator const_reverse_iterator; + using reverse_iterator = std::vector::reverse_iterator; + using const_reverse_iterator = std::vector::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 list) : Vec(list) {} - typedef std::vector::iterator iterator; + using iterator = std::vector::iterator; iterator begin() const; iterator end() const; - typedef std::vector::reverse_iterator reverse_iterator; + using reverse_iterator = std::vector::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 list) : Vec(list) {} - typedef std::vector::iterator iterator; - typedef std::vector::const_iterator const_iterator; + using iterator = std::vector::iterator; + using const_iterator = std::vector::const_iterator; iterator begin(); iterator end(); const_iterator begin() const; const_iterator end() const; - typedef std::vector::reverse_iterator reverse_iterator; - typedef std::vector::const_reverse_iterator const_reverse_iterator; + using reverse_iterator = std::vector::reverse_iterator; + using const_reverse_iterator = std::vector::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 list) : V(list) {} - typedef std::vector::iterator iterator; + using iterator = std::vector::iterator; class reverse_iterator { std::vector::iterator I; @@ -126,8 +126,8 @@ template void TestRev(const R &r) { // Test fixture template class RangeAdapterLValueTest : public ::testing::Test {}; -typedef ::testing::Types, std::list, int[4]> - RangeAdapterLValueTestTypes; +using RangeAdapterLValueTestTypes = + ::testing::Types, std::list, int[4]>; TYPED_TEST_SUITE(RangeAdapterLValueTest, RangeAdapterLValueTestTypes, ); TYPED_TEST(RangeAdapterLValueTest, TrivialOperation) { @@ -140,10 +140,10 @@ TYPED_TEST(RangeAdapterLValueTest, TrivialOperation) { template struct RangeAdapterRValueTest : testing::Test {}; -typedef ::testing::Types, std::list, CustomIteratorVector, - ReverseOnlyVector, BidirectionalVector, - BidirectionalVectorConsts> - RangeAdapterRValueTestTypes; +using RangeAdapterRValueTestTypes = + ::testing::Types, std::list, 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 GT; + using GT = Graph; /// 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 foo = {'a', 'b', 'c'}; - typedef std::pair CharPairType; + using CharPairType = std::pair; std::vector CharResults; for (auto [index, value] : llvm::enumerate(foo)) { @@ -72,7 +72,7 @@ TEST(STLExtrasTest, EnumerateLValue) { CharPairType(2u, 'c'))); // Test a const range of a different type. - typedef std::pair IntPairType; + using IntPairType = std::pair; std::vector IntResults; const std::vector 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 PairType; + using PairType = std::pair; std::vector Results; auto Enumerator = llvm::enumerate(std::vector{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 PairType; + using PairType = std::pair; std::vector Results; for (auto X : llvm::enumerate(std::vector{'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>, ilist_node> { - typedef ilist_node> Node1Type; - typedef ilist_node> Node2Type; + using Node1Type = ilist_node>; + using Node2Type = ilist_node>; Node1Type::self_iterator getIterator1() { return Node1Type::getIterator(); } Node2Type::self_iterator getIterator2() { return Node2Type::getIterator(); } @@ -617,8 +617,8 @@ struct DoubleNode : ilist_node>, return Node2Type::getIterator(); } }; -typedef simple_ilist> TaggedList1Type; -typedef simple_ilist> TaggedList2Type; +using TaggedList1Type = simple_ilist>; +using TaggedList2Type = simple_ilist>; 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 s; - typedef SmallPtrSet::iterator iter; + using iter = SmallPtrSet::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, - SmallVector, - SmallVector, - SmallVector - > SmallVectorTestTypes; +using SmallVectorTestTypes = ::testing::Types< + SmallVector, SmallVector, + SmallVector, SmallVector, + SmallVector>; 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 difference_type; - typedef value_type *pointer; - typedef value_type &reference; + using iterator_category = std::output_iterator_tag; + using value_type = int; + using difference_type = int; + using pointer = value_type *; + using reference = value_type &; operator int() { return 2; } operator Constructable() { return 7; } }; @@ -896,7 +893,7 @@ class DualSmallVectorsTest> : public SmallVectorTe VectorT2 otherVector; }; -typedef ::testing::Types< +using DualSmallVectorTestTypes = ::testing::Types< // Small mode -> Small mode. std::pair, SmallVector>, // Small mode -> Big mode. @@ -904,8 +901,7 @@ typedef ::testing::Types< // Big mode -> Small mode. std::pair, SmallVector>, // Big mode -> Big mode. - std::pair, SmallVector> - > DualSmallVectorTestTypes; + std::pair, SmallVector>>; 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 USet; +using USet = SparseMultiSet; // Empty set tests. TEST(SparseMultiSetTest, EmptySet) { @@ -211,7 +211,7 @@ struct Alt { }; TEST(SparseMultiSetTest, AltStructSet) { - typedef SparseMultiSet ASet; + using ASet = SparseMultiSet; 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 USet; +using USet = SparseSet; // Empty set tests. TEST(SparseSetTest, EmptySet) { @@ -166,7 +166,7 @@ struct Alt { }; TEST(SparseSetTest, AltStructSet) { - typedef SparseSet ASet; + using ASet = SparseSet; 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 NodeType; + using NodeType = std::pair; private: /// Nodes - The list of nodes for this graph. @@ -233,8 +233,8 @@ class Graph { template struct GraphTraits > { - typedef typename Graph::NodeType *NodeRef; - typedef typename Graph::ChildIterator ChildIteratorType; + using NodeRef = typename Graph::NodeType *; + using ChildIteratorType = typename Graph::ChildIterator; static NodeRef getEntryNode(const Graph &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 struct RemovePointer< PointerIntPair> { - typedef typename RemovePointer::type type; + using type = typename RemovePointer::type; }; template class TinyPtrVectorTest : public testing::Test { protected: - typedef typename VectorT::value_type PtrT; - typedef typename RemovePointer::type ValueT; + using PtrT = typename VectorT::value_type; + using ValueT = typename RemovePointer::type; using PtrTraits = PointerLikeTypeTraits; VectorT V; @@ -78,9 +78,9 @@ class TinyPtrVectorTest : public testing::Test { } }; -typedef ::testing::Types, TinyPtrVector, - TinyPtrVector>> - TinyPtrVectorTestTypes; +using TinyPtrVectorTestTypes = + ::testing::Types, TinyPtrVector, + TinyPtrVector>>; TYPED_TEST_SUITE(TinyPtrVectorTest, TinyPtrVectorTestTypes, ); TYPED_TEST(TinyPtrVectorTest, EmptyTest) {