From d628f19f5df9e4033adce5af969049e90a90ae5d Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sun, 2 Mar 2014 12:27:27 +0000 Subject: [C++11] Replace llvm::next and llvm::prior with std::next and std::prev. Remove the old functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202636 91177308-0d34-0410-b5e6-96231b3b80d8 --- unittests/ADT/TinyPtrVectorTest.cpp | 82 ++++++++++++++++++------------------- unittests/ADT/ilistTest.cpp | 6 +-- unittests/IR/InstructionsTest.cpp | 4 +- 3 files changed, 46 insertions(+), 46 deletions(-) (limited to 'unittests') diff --git a/unittests/ADT/TinyPtrVectorTest.cpp b/unittests/ADT/TinyPtrVectorTest.cpp index 3ae1ae3deb..d633f96722 100644 --- a/unittests/ADT/TinyPtrVectorTest.cpp +++ b/unittests/ADT/TinyPtrVectorTest.cpp @@ -72,9 +72,9 @@ protected: EXPECT_EQ(Values.size(), V.size()); for (size_t i = 0, e = Values.size(); i != e; ++i) { EXPECT_EQ(Values[i], V[i]); - EXPECT_EQ(Values[i], *llvm::next(V.begin(), i)); + EXPECT_EQ(Values[i], *std::next(V.begin(), i)); } - EXPECT_EQ(V.end(), llvm::next(V.begin(), Values.size())); + EXPECT_EQ(V.end(), std::next(V.begin(), Values.size())); } }; @@ -300,17 +300,17 @@ TYPED_TEST(TinyPtrVectorTest, EraseTest) { this->V.erase(this->V.begin()); this->TestPtrs.erase(this->TestPtrs.begin()); this->expectValues(this->V, this->testArray(41)); - this->V.erase(llvm::next(this->V.begin(), 1)); - this->TestPtrs.erase(llvm::next(this->TestPtrs.begin(), 1)); + this->V.erase(std::next(this->V.begin(), 1)); + this->TestPtrs.erase(std::next(this->TestPtrs.begin(), 1)); this->expectValues(this->V, this->testArray(40)); - this->V.erase(llvm::next(this->V.begin(), 2)); - this->TestPtrs.erase(llvm::next(this->TestPtrs.begin(), 2)); + this->V.erase(std::next(this->V.begin(), 2)); + this->TestPtrs.erase(std::next(this->TestPtrs.begin(), 2)); this->expectValues(this->V, this->testArray(39)); - this->V.erase(llvm::next(this->V.begin(), 5)); - this->TestPtrs.erase(llvm::next(this->TestPtrs.begin(), 5)); + this->V.erase(std::next(this->V.begin(), 5)); + this->TestPtrs.erase(std::next(this->TestPtrs.begin(), 5)); this->expectValues(this->V, this->testArray(38)); - this->V.erase(llvm::next(this->V.begin(), 13)); - this->TestPtrs.erase(llvm::next(this->TestPtrs.begin(), 13)); + this->V.erase(std::next(this->V.begin(), 13)); + this->TestPtrs.erase(std::next(this->TestPtrs.begin(), 13)); this->expectValues(this->V, this->testArray(37)); typename TypeParam::iterator I = this->V.begin(); @@ -332,27 +332,27 @@ TYPED_TEST(TinyPtrVectorTest, EraseRangeTest) { this->appendValues(this->V, this->testArray(42)); this->expectValues(this->V, this->testArray(42)); - this->V.erase(this->V.begin(), llvm::next(this->V.begin(), 1)); + this->V.erase(this->V.begin(), std::next(this->V.begin(), 1)); this->TestPtrs.erase(this->TestPtrs.begin(), - llvm::next(this->TestPtrs.begin(), 1)); + std::next(this->TestPtrs.begin(), 1)); this->expectValues(this->V, this->testArray(41)); - this->V.erase(llvm::next(this->V.begin(), 1), llvm::next(this->V.begin(), 2)); - this->TestPtrs.erase(llvm::next(this->TestPtrs.begin(), 1), - llvm::next(this->TestPtrs.begin(), 2)); + this->V.erase(std::next(this->V.begin(), 1), std::next(this->V.begin(), 2)); + this->TestPtrs.erase(std::next(this->TestPtrs.begin(), 1), + std::next(this->TestPtrs.begin(), 2)); this->expectValues(this->V, this->testArray(40)); - this->V.erase(llvm::next(this->V.begin(), 2), llvm::next(this->V.begin(), 4)); - this->TestPtrs.erase(llvm::next(this->TestPtrs.begin(), 2), - llvm::next(this->TestPtrs.begin(), 4)); + this->V.erase(std::next(this->V.begin(), 2), std::next(this->V.begin(), 4)); + this->TestPtrs.erase(std::next(this->TestPtrs.begin(), 2), + std::next(this->TestPtrs.begin(), 4)); this->expectValues(this->V, this->testArray(38)); - this->V.erase(llvm::next(this->V.begin(), 5), llvm::next(this->V.begin(), 10)); - this->TestPtrs.erase(llvm::next(this->TestPtrs.begin(), 5), - llvm::next(this->TestPtrs.begin(), 10)); + this->V.erase(std::next(this->V.begin(), 5), std::next(this->V.begin(), 10)); + this->TestPtrs.erase(std::next(this->TestPtrs.begin(), 5), + std::next(this->TestPtrs.begin(), 10)); this->expectValues(this->V, this->testArray(33)); - this->V.erase(llvm::next(this->V.begin(), 13), llvm::next(this->V.begin(), 26)); - this->TestPtrs.erase(llvm::next(this->TestPtrs.begin(), 13), - llvm::next(this->TestPtrs.begin(), 26)); + this->V.erase(std::next(this->V.begin(), 13), std::next(this->V.begin(), 26)); + this->TestPtrs.erase(std::next(this->TestPtrs.begin(), 13), + std::next(this->TestPtrs.begin(), 26)); this->expectValues(this->V, this->testArray(20)); - this->V.erase(llvm::next(this->V.begin(), 7), this->V.end()); + this->V.erase(std::next(this->V.begin(), 7), this->V.end()); this->expectValues(this->V, this->testArray(7)); this->V.erase(this->V.begin(), this->V.end()); this->expectValues(this->V, this->testArray(0)); @@ -369,8 +369,8 @@ TYPED_TEST(TinyPtrVectorTest, Insert) { this->V.insert(this->V.begin(), this->TestPtrs[42]); this->TestPtrs.insert(this->TestPtrs.begin(), this->TestPtrs[42]); this->expectValues(this->V, this->testArray(6)); - this->V.insert(llvm::next(this->V.begin(), 3), this->TestPtrs[43]); - this->TestPtrs.insert(llvm::next(this->TestPtrs.begin(), 3), + this->V.insert(std::next(this->V.begin(), 3), this->TestPtrs[43]); + this->TestPtrs.insert(std::next(this->TestPtrs.begin(), 3), this->TestPtrs[43]); this->expectValues(this->V, this->testArray(7)); } @@ -384,30 +384,30 @@ TYPED_TEST(TinyPtrVectorTest, InsertRange) { this->V.insert(this->V.end(), this->TestPtrs.end(), this->TestPtrs.end()); this->expectValues(this->V, this->testArray(0)); this->V.insert(this->V.end(), this->TestPtrs.begin(), - llvm::next(this->TestPtrs.begin())); + std::next(this->TestPtrs.begin())); this->expectValues(this->V, this->testArray(1)); this->V.clear(); this->V.insert(this->V.end(), this->TestPtrs.begin(), - llvm::next(this->TestPtrs.begin(), 2)); + std::next(this->TestPtrs.begin(), 2)); this->expectValues(this->V, this->testArray(2)); this->V.clear(); this->V.insert(this->V.end(), this->TestPtrs.begin(), - llvm::next(this->TestPtrs.begin(), 42)); + std::next(this->TestPtrs.begin(), 42)); this->expectValues(this->V, this->testArray(42)); this->V.clear(); this->V.insert(this->V.end(), - llvm::next(this->TestPtrs.begin(), 5), - llvm::next(this->TestPtrs.begin(), 13)); + std::next(this->TestPtrs.begin(), 5), + std::next(this->TestPtrs.begin(), 13)); this->V.insert(this->V.begin(), - llvm::next(this->TestPtrs.begin(), 0), - llvm::next(this->TestPtrs.begin(), 3)); - this->V.insert(llvm::next(this->V.begin(), 2), - llvm::next(this->TestPtrs.begin(), 2), - llvm::next(this->TestPtrs.begin(), 4)); - this->V.erase(llvm::next(this->V.begin(), 4)); - this->V.insert(llvm::next(this->V.begin(), 4), - llvm::next(this->TestPtrs.begin(), 4), - llvm::next(this->TestPtrs.begin(), 5)); + std::next(this->TestPtrs.begin(), 0), + std::next(this->TestPtrs.begin(), 3)); + this->V.insert(std::next(this->V.begin(), 2), + std::next(this->TestPtrs.begin(), 2), + std::next(this->TestPtrs.begin(), 4)); + this->V.erase(std::next(this->V.begin(), 4)); + this->V.insert(std::next(this->V.begin(), 4), + std::next(this->TestPtrs.begin(), 4), + std::next(this->TestPtrs.begin(), 5)); this->expectValues(this->V, this->testArray(13)); } diff --git a/unittests/ADT/ilistTest.cpp b/unittests/ADT/ilistTest.cpp index 0c0cd0fd56..134607c2fd 100644 --- a/unittests/ADT/ilistTest.cpp +++ b/unittests/ADT/ilistTest.cpp @@ -51,15 +51,15 @@ TEST(ilistTest, SpliceOne) { List.splice(List.begin(), List, List.begin()); EXPECT_EQ(1u, List.size()); EXPECT_EQ(1, List.front().Value); - EXPECT_TRUE(llvm::next(List.begin()) == List.end()); + EXPECT_TRUE(std::next(List.begin()) == List.end()); // Altenative noop. Move the first element behind itself. List.push_back(2); List.push_back(3); - List.splice(llvm::next(List.begin()), List, List.begin()); + List.splice(std::next(List.begin()), List, List.begin()); EXPECT_EQ(3u, List.size()); EXPECT_EQ(1, List.front().Value); - EXPECT_EQ(2, llvm::next(List.begin())->Value); + EXPECT_EQ(2, std::next(List.begin())->Value); EXPECT_EQ(3, List.back().Value); } diff --git a/unittests/IR/InstructionsTest.cpp b/unittests/IR/InstructionsTest.cpp index cbdf18c646..962c07eea1 100644 --- a/unittests/IR/InstructionsTest.cpp +++ b/unittests/IR/InstructionsTest.cpp @@ -65,9 +65,9 @@ TEST(InstructionsTest, BranchInst) { EXPECT_EQ(1U, b0->getNumOperands()); EXPECT_NE(b0->op_begin(), b0->op_end()); - EXPECT_EQ(b0->op_end(), llvm::next(b0->op_begin())); + EXPECT_EQ(b0->op_end(), std::next(b0->op_begin())); - EXPECT_EQ(b0->op_end(), llvm::next(b0->op_begin())); + EXPECT_EQ(b0->op_end(), std::next(b0->op_begin())); IntegerType* Int1 = IntegerType::get(C, 1); Constant* One = ConstantInt::get(Int1, 1, true); -- cgit v1.2.3