aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/ADT
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/ADT')
-rw-r--r--llvm/unittests/ADT/APFloatTest.cpp2
-rw-r--r--llvm/unittests/ADT/BitVectorTest.cpp4
-rw-r--r--llvm/unittests/ADT/BreadthFirstIteratorTest.cpp6
-rw-r--r--llvm/unittests/ADT/ConcurrentHashtableTest.cpp2
-rw-r--r--llvm/unittests/ADT/DAGDeltaAlgorithmTest.cpp2
-rw-r--r--llvm/unittests/ADT/DenseMapTest.cpp23
-rw-r--r--llvm/unittests/ADT/DenseSetTest.cpp14
-rw-r--r--llvm/unittests/ADT/DepthFirstIteratorTest.cpp8
-rw-r--r--llvm/unittests/ADT/DirectedGraphTest.cpp2
-rw-r--r--llvm/unittests/ADT/IListBaseTest.cpp25
-rw-r--r--llvm/unittests/ADT/IListIteratorBitsTest.cpp6
-rw-r--r--llvm/unittests/ADT/IListIteratorTest.cpp8
-rw-r--r--llvm/unittests/ADT/IListNodeBaseTest.cpp8
-rw-r--r--llvm/unittests/ADT/IListSentinelTest.cpp15
-rw-r--r--llvm/unittests/ADT/IListTest.cpp2
-rw-r--r--llvm/unittests/ADT/IntervalMapTest.cpp10
-rw-r--r--llvm/unittests/ADT/IntrusiveRefCntPtrTest.cpp6
-rw-r--r--llvm/unittests/ADT/IteratorTest.cpp18
-rw-r--r--llvm/unittests/ADT/PointerSumTypeTest.cpp7
-rw-r--r--llvm/unittests/ADT/PointerUnionTest.cpp12
-rw-r--r--llvm/unittests/ADT/PostOrderIteratorTest.cpp4
-rw-r--r--llvm/unittests/ADT/PriorityWorklistTest.cpp4
-rw-r--r--llvm/unittests/ADT/RangeAdapterTest.cpp30
-rw-r--r--llvm/unittests/ADT/SCCIteratorTest.cpp2
-rw-r--r--llvm/unittests/ADT/STLExtrasTest.cpp8
-rw-r--r--llvm/unittests/ADT/SimpleIListTest.cpp8
-rw-r--r--llvm/unittests/ADT/SmallPtrSetTest.cpp2
-rw-r--r--llvm/unittests/ADT/SmallStringTest.cpp2
-rw-r--r--llvm/unittests/ADT/SmallVectorTest.cpp28
-rw-r--r--llvm/unittests/ADT/SparseMultiSetTest.cpp4
-rw-r--r--llvm/unittests/ADT/SparseSetTest.cpp4
-rw-r--r--llvm/unittests/ADT/StringMapTest.cpp2
-rw-r--r--llvm/unittests/ADT/StringSwitchTest.cpp17
-rw-r--r--llvm/unittests/ADT/TestGraph.h8
-rw-r--r--llvm/unittests/ADT/TinyPtrVectorTest.cpp12
-rw-r--r--llvm/unittests/ADT/TypeSwitchTest.cpp2
36 files changed, 163 insertions, 154 deletions
diff --git a/llvm/unittests/ADT/APFloatTest.cpp b/llvm/unittests/ADT/APFloatTest.cpp
index fbe96bb..99cc38b 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 12ba004..e13523b 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 0cd7fd3..571e4d2 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);
@@ -78,7 +78,7 @@ TEST(BreadthFristIteratorTest, Cycle) {
static_assert(
std::is_convertible_v<decltype(*std::declval<bf_iterator<Graph<3>>>()),
- typename bf_iterator<Graph<3>>::reference>);
+ bf_iterator<Graph<3>>::reference>);
// bf_iterator should be (at-least) a forward-iterator
static_assert(std::is_base_of_v<std::forward_iterator_tag,
diff --git a/llvm/unittests/ADT/ConcurrentHashtableTest.cpp b/llvm/unittests/ADT/ConcurrentHashtableTest.cpp
index ee1ee41..1b82df1 100644
--- a/llvm/unittests/ADT/ConcurrentHashtableTest.cpp
+++ b/llvm/unittests/ADT/ConcurrentHashtableTest.cpp
@@ -21,7 +21,7 @@ using namespace parallel;
namespace {
class String {
public:
- String() {}
+ String() = default;
const std::string &getKey() const { return Data; }
template <typename AllocatorTy>
diff --git a/llvm/unittests/ADT/DAGDeltaAlgorithmTest.cpp b/llvm/unittests/ADT/DAGDeltaAlgorithmTest.cpp
index f5439478..918a2e6 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 aceb4f3..273ee09 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 a24f99b..a2a062b 100644
--- a/llvm/unittests/ADT/DenseSetTest.cpp
+++ b/llvm/unittests/ADT/DenseSetTest.cpp
@@ -96,13 +96,13 @@ private:
};
// 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 95923b8..00312ca 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 @@ public:
};
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);
@@ -59,7 +59,7 @@ TEST(DepthFirstIteratorTest, ActuallyUpdateIterator) {
static_assert(
std::is_convertible_v<decltype(*std::declval<df_iterator<Graph<3>>>()),
- typename df_iterator<Graph<3>>::reference>);
+ df_iterator<Graph<3>>::reference>);
// df_iterator should be (at-least) a forward-iterator
static_assert(std::is_base_of_v<std::forward_iterator_tag,
diff --git a/llvm/unittests/ADT/DirectedGraphTest.cpp b/llvm/unittests/ADT/DirectedGraphTest.cpp
index 49ccf06..82a631b 100644
--- a/llvm/unittests/ADT/DirectedGraphTest.cpp
+++ b/llvm/unittests/ADT/DirectedGraphTest.cpp
@@ -43,7 +43,7 @@ public:
class DGTestGraph : public DGTestBase {
public:
DGTestGraph() = default;
- ~DGTestGraph(){};
+ ~DGTestGraph() = default;
};
using EdgeListTy = SmallVector<DGTestEdge *, 2>;
diff --git a/llvm/unittests/ADT/IListBaseTest.cpp b/llvm/unittests/ADT/IListBaseTest.cpp
index bd91568..eeed488 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/IListIteratorBitsTest.cpp b/llvm/unittests/ADT/IListIteratorBitsTest.cpp
index 97c14265..b430bcb 100644
--- a/llvm/unittests/ADT/IListIteratorBitsTest.cpp
+++ b/llvm/unittests/ADT/IListIteratorBitsTest.cpp
@@ -93,8 +93,8 @@ TEST(IListIteratorBitsTest, ConsAndAssignment) {
class dummy {
// Test that we get an ilist_iterator_w_bits out of the node given that the
// options are enabled.
- using node_options = typename ilist_detail::compute_node_options<
- Node, ilist_iterator_bits<true>>::type;
+ using node_options =
+ ilist_detail::compute_node_options<Node, ilist_iterator_bits<true>>::type;
static_assert(std::is_same<Node::self_iterator,
llvm::ilist_iterator_w_bits<node_options, false,
false>>::value);
@@ -102,7 +102,7 @@ class dummy {
// Now test that a plain node, without the option, gets a plain
// ilist_iterator.
using plain_node_options =
- typename ilist_detail::compute_node_options<PlainNode>::type;
+ ilist_detail::compute_node_options<PlainNode>::type;
static_assert(std::is_same<
PlainNode::self_iterator,
llvm::ilist_iterator<plain_node_options, false, false>>::value);
diff --git a/llvm/unittests/ADT/IListIteratorTest.cpp b/llvm/unittests/ADT/IListIteratorTest.cpp
index 4e5b847b..54a42582 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 ef90c71..393f83a 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 1f4a831..709a1a4 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/IListTest.cpp b/llvm/unittests/ADT/IListTest.cpp
index 2fdc8e1..984014f 100644
--- a/llvm/unittests/ADT/IListTest.cpp
+++ b/llvm/unittests/ADT/IListTest.cpp
@@ -19,7 +19,7 @@ namespace {
struct Node : ilist_node<Node> {
int Value;
- Node() {}
+ Node() = default;
Node(int Value) : Value(Value) {}
Node(const Node&) = default;
~Node() { Value = -1; }
diff --git a/llvm/unittests/ADT/IntervalMapTest.cpp b/llvm/unittests/ADT/IntervalMapTest.cpp
index 99a93ab..38f397f 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 f4f2083..6da4227 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 691fbce..9dd8c1a 100644
--- a/llvm/unittests/ADT/IteratorTest.cpp
+++ b/llvm/unittests/ADT/IteratorTest.cpp
@@ -48,11 +48,10 @@ struct AdaptedIter : iterator_adaptor_base<AdaptedIter, WeirdIter> {};
// Test that iterator_adaptor_base forwards typedefs, if value_type is
// unchanged.
-static_assert(std::is_same_v<typename AdaptedIter::value_type, Shadow<0>>, "");
-static_assert(std::is_same_v<typename AdaptedIter::difference_type, Shadow<1>>,
- "");
-static_assert(std::is_same_v<typename AdaptedIter::pointer, Shadow<2>>, "");
-static_assert(std::is_same_v<typename AdaptedIter::reference, Shadow<3>>, "");
+static_assert(std::is_same_v<AdaptedIter::value_type, Shadow<0>>, "");
+static_assert(std::is_same_v<AdaptedIter::difference_type, Shadow<1>>, "");
+static_assert(std::is_same_v<AdaptedIter::pointer, Shadow<2>>, "");
+static_assert(std::is_same_v<AdaptedIter::reference, Shadow<3>>, "");
// Ensure that pointe{e,r}_iterator adaptors correctly forward the category of
// the underlying iterator.
@@ -178,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();
@@ -219,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 fbf59f3..11e657a 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 acddb78..d8ac3ae 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 4c2a66e..e875dd6 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;
@@ -44,7 +44,7 @@ TEST(PostOrderIteratorTest, Compiles) {
static_assert(
std::is_convertible_v<decltype(*std::declval<po_iterator<Graph<3>>>()),
- typename po_iterator<Graph<3>>::reference>);
+ po_iterator<Graph<3>>::reference>);
// Test post-order and reverse post-order traversals for simple graph type.
TEST(PostOrderIteratorTest, PostOrderAndReversePostOrderTraverrsal) {
diff --git a/llvm/unittests/ADT/PriorityWorklistTest.cpp b/llvm/unittests/ADT/PriorityWorklistTest.cpp
index f12d32a..08a4773 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 c1a8a98..6849ccbc 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 4835095..5f08829 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 966b1f0..8556777 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 different 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 c2992ba..cf3df8c 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 a627091..fe7a827 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 2f4df8a..db85824 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 1a01f30..dbc626d 100644
--- a/llvm/unittests/ADT/SmallVectorTest.cpp
+++ b/llvm/unittests/ADT/SmallVectorTest.cpp
@@ -159,7 +159,7 @@ int Constructable::numCopyAssignmentCalls;
int Constructable::numMoveAssignmentCalls;
struct NonCopyable {
- NonCopyable() {}
+ NonCopyable() = default;
NonCopyable(NonCopyable &&) {}
NonCopyable &operator=(NonCopyable &&) { return *this; }
private:
@@ -226,13 +226,10 @@ protected:
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 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 @@ protected:
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 54f7bc99..91d37f4 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 4fbf1ca..f2b9329 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/StringMapTest.cpp b/llvm/unittests/ADT/StringMapTest.cpp
index 92ae364..1d92de4 100644
--- a/llvm/unittests/ADT/StringMapTest.cpp
+++ b/llvm/unittests/ADT/StringMapTest.cpp
@@ -367,7 +367,7 @@ TEST_F(StringMapTest, NonDefaultConstructable) {
}
struct Immovable {
- Immovable() {}
+ Immovable() = default;
Immovable(Immovable &&) = delete; // will disable the other special members
};
diff --git a/llvm/unittests/ADT/StringSwitchTest.cpp b/llvm/unittests/ADT/StringSwitchTest.cpp
index c94feb5..75d50f4 100644
--- a/llvm/unittests/ADT/StringSwitchTest.cpp
+++ b/llvm/unittests/ADT/StringSwitchTest.cpp
@@ -240,6 +240,23 @@ TEST(StringSwitchTest, CasesCopies) {
EXPECT_EQ(NumCopies, 1u);
}
+TEST(StringSwitchTest, StringSwitchMultipleMatches) {
+ auto Translate = [](StringRef S) {
+ return llvm::StringSwitch<int>(S)
+ .CaseLower("A", 0)
+ .Case("b", 1)
+ .Case("a", 2)
+ .CasesLower({"a", "b"}, 3)
+ .DefaultUnreachable();
+ };
+
+ // Check that the value of the first match is returned.
+ EXPECT_EQ(0, Translate("A"));
+ EXPECT_EQ(0, Translate("a"));
+ EXPECT_EQ(3, Translate("B"));
+ EXPECT_EQ(1, Translate("b"));
+}
+
TEST(StringSwitchTest, DefaultUnreachable) {
auto Translate = [](StringRef S) {
return llvm::StringSwitch<int>(S)
diff --git a/llvm/unittests/ADT/TestGraph.h b/llvm/unittests/ADT/TestGraph.h
index a59ab50..bb2ec47 100644
--- a/llvm/unittests/ADT/TestGraph.h
+++ b/llvm/unittests/ADT/TestGraph.h
@@ -34,7 +34,7 @@ public:
/// 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 @@ public:
};
/// 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 @@ public:
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 af4ae4f..c77721d 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 @@ protected:
}
};
-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) {
diff --git a/llvm/unittests/ADT/TypeSwitchTest.cpp b/llvm/unittests/ADT/TypeSwitchTest.cpp
index b801228..0a92717 100644
--- a/llvm/unittests/ADT/TypeSwitchTest.cpp
+++ b/llvm/unittests/ADT/TypeSwitchTest.cpp
@@ -167,7 +167,7 @@ TEST(TypeSwitchTest, DefaultNullptr) {
TEST(TypeSwitchTest, DefaultNullptrForPointerLike) {
struct Value {
void *ptr;
- Value(const Value &other) : ptr(other.ptr) {}
+ Value(const Value &other) = default;
Value(std::nullptr_t) : ptr(nullptr) {}
Value() : Value(nullptr) {}
};