[llvm] r250843 - unittests: Remove implicit ilist iterator conversions, NFC
Duncan P. N. Exon Smith via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 20 11:30:21 PDT 2015
Author: dexonsmith
Date: Tue Oct 20 13:30:20 2015
New Revision: 250843
URL: http://llvm.org/viewvc/llvm-project?rev=250843&view=rev
Log:
unittests: Remove implicit ilist iterator conversions, NFC
Modified:
llvm/trunk/unittests/ADT/ilistTest.cpp
llvm/trunk/unittests/Analysis/CFGTest.cpp
llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITTestBase.h
llvm/trunk/unittests/IR/DominatorTreeTest.cpp
llvm/trunk/unittests/IR/IRBuilderTest.cpp
llvm/trunk/unittests/IR/LegacyPassManagerTest.cpp
llvm/trunk/unittests/IR/ValueTest.cpp
llvm/trunk/unittests/Linker/LinkModulesTest.cpp
llvm/trunk/unittests/Transforms/Utils/Cloning.cpp
llvm/trunk/unittests/Transforms/Utils/IntegerDivision.cpp
Modified: llvm/trunk/unittests/ADT/ilistTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/ilistTest.cpp?rev=250843&r1=250842&r2=250843&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/ilistTest.cpp (original)
+++ llvm/trunk/unittests/ADT/ilistTest.cpp Tue Oct 20 13:30:20 2015
@@ -81,7 +81,7 @@ TEST(ilistTest, UnsafeClear) {
// List with contents.
List.push_back(1);
ASSERT_EQ(1u, List.size());
- Node *N = List.begin();
+ Node *N = &*List.begin();
EXPECT_EQ(1, N->Value);
List.clearAndLeakNodesUnsafely();
EXPECT_EQ(0u, List.size());
Modified: llvm/trunk/unittests/Analysis/CFGTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Analysis/CFGTest.cpp?rev=250843&r1=250842&r2=250843&view=diff
==============================================================================
--- llvm/trunk/unittests/Analysis/CFGTest.cpp (original)
+++ llvm/trunk/unittests/Analysis/CFGTest.cpp Tue Oct 20 13:30:20 2015
@@ -378,7 +378,7 @@ TEST_F(IsPotentiallyReachableTest, Branc
TEST_F(IsPotentiallyReachableTest, ModifyTest) {
ParseAssembly(BranchInsideLoopIR);
- succ_iterator S = succ_begin(++M->getFunction("test")->begin());
+ succ_iterator S = succ_begin(&*++M->getFunction("test")->begin());
BasicBlock *OldBB = S[0];
S[0] = S[1];
ExpectPath(false);
Modified: llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITTestBase.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITTestBase.h?rev=250843&r1=250842&r2=250843&view=diff
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITTestBase.h (original)
+++ llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITTestBase.h Tue Oct 20 13:30:20 2015
@@ -69,9 +69,8 @@ protected:
SmallVector<Value*, 1> CallArgs;
- Function::arg_iterator arg_iter = Result->arg_begin();
- for(;arg_iter != Result->arg_end(); ++arg_iter)
- CallArgs.push_back(arg_iter);
+ for (Argument &A : Result->args())
+ CallArgs.push_back(&A);
Value *ReturnCode = Builder.CreateCall(Callee, CallArgs);
Builder.CreateRet(ReturnCode);
@@ -97,8 +96,8 @@ protected:
Function *Result = startFunction<int32_t(int32_t, int32_t)>(M, Name);
Function::arg_iterator args = Result->arg_begin();
- Value *Arg1 = args;
- Value *Arg2 = ++args;
+ Value *Arg1 = &*args;
+ Value *Arg2 = &*++args;
Value *AddResult = Builder.CreateAdd(Arg1, Arg2);
endFunctionWithRet(Result, AddResult);
@@ -169,7 +168,7 @@ protected:
BasicBlock *RecursiveCase = BasicBlock::Create(Context, "", Result);
// if (num == 0)
- Value *Param = Result->arg_begin();
+ Value *Param = &*Result->arg_begin();
Value *Zero = ConstantInt::get(Context, APInt(32, 0));
Builder.CreateCondBr(Builder.CreateICmpEQ(Param, Zero),
BaseCase, RecursiveCase);
Modified: llvm/trunk/unittests/IR/DominatorTreeTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/DominatorTreeTest.cpp?rev=250843&r1=250842&r2=250843&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/DominatorTreeTest.cpp (original)
+++ llvm/trunk/unittests/IR/DominatorTreeTest.cpp Tue Oct 20 13:30:20 2015
@@ -32,29 +32,29 @@ namespace llvm {
PostDominatorTree *PDT = &getAnalysis<PostDominatorTree>();
Function::iterator FI = F.begin();
- BasicBlock *BB0 = FI++;
+ BasicBlock *BB0 = &*FI++;
BasicBlock::iterator BBI = BB0->begin();
- Instruction *Y1 = BBI++;
- Instruction *Y2 = BBI++;
- Instruction *Y3 = BBI++;
+ Instruction *Y1 = &*BBI++;
+ Instruction *Y2 = &*BBI++;
+ Instruction *Y3 = &*BBI++;
- BasicBlock *BB1 = FI++;
+ BasicBlock *BB1 = &*FI++;
BBI = BB1->begin();
- Instruction *Y4 = BBI++;
+ Instruction *Y4 = &*BBI++;
- BasicBlock *BB2 = FI++;
+ BasicBlock *BB2 = &*FI++;
BBI = BB2->begin();
- Instruction *Y5 = BBI++;
+ Instruction *Y5 = &*BBI++;
- BasicBlock *BB3 = FI++;
+ BasicBlock *BB3 = &*FI++;
BBI = BB3->begin();
- Instruction *Y6 = BBI++;
- Instruction *Y7 = BBI++;
+ Instruction *Y6 = &*BBI++;
+ Instruction *Y7 = &*BBI++;
- BasicBlock *BB4 = FI++;
+ BasicBlock *BB4 = &*FI++;
BBI = BB4->begin();
- Instruction *Y8 = BBI++;
- Instruction *Y9 = BBI++;
+ Instruction *Y8 = &*BBI++;
+ Instruction *Y9 = &*BBI++;
// Reachability
EXPECT_TRUE(DT->isReachableFromEntry(BB0));
Modified: llvm/trunk/unittests/IR/IRBuilderTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/IRBuilderTest.cpp?rev=250843&r1=250842&r2=250843&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/IRBuilderTest.cpp (original)
+++ llvm/trunk/unittests/IR/IRBuilderTest.cpp Tue Oct 20 13:30:20 2015
@@ -299,7 +299,7 @@ TEST_F(IRBuilderTest, RAIIHelpersTest) {
{
IRBuilder<>::InsertPointGuard Guard(Builder);
Builder.SetInsertPoint(cast<Instruction>(F));
- EXPECT_EQ(F, Builder.GetInsertPoint());
+ EXPECT_EQ(F, &*Builder.GetInsertPoint());
}
EXPECT_EQ(BB->end(), Builder.GetInsertPoint());
@@ -379,7 +379,7 @@ TEST_F(IRBuilderTest, DebugLoc) {
EXPECT_EQ(DL1, Call1->getDebugLoc());
Call1->setDebugLoc(DL2);
- Builder.SetInsertPoint(Call1->getParent(), Call1);
+ Builder.SetInsertPoint(Call1->getParent(), Call1->getIterator());
EXPECT_EQ(DL2, Builder.getCurrentDebugLocation());
auto Call2 = Builder.CreateCall(Callee, None);
EXPECT_EQ(DL2, Call2->getDebugLoc());
Modified: llvm/trunk/unittests/IR/LegacyPassManagerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/LegacyPassManagerTest.cpp?rev=250843&r1=250842&r2=250843&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/LegacyPassManagerTest.cpp (original)
+++ llvm/trunk/unittests/IR/LegacyPassManagerTest.cpp Tue Oct 20 13:30:20 2015
@@ -510,7 +510,7 @@ namespace llvm {
// Function: test4 (func_test4)
{
Function::arg_iterator args = func_test4->arg_begin();
- Value* int1_f = args++;
+ Value *int1_f = &*args++;
int1_f->setName("f");
BasicBlock* label_entry_11 = BasicBlock::Create(getGlobalContext(), "entry",func_test4,nullptr);
Modified: llvm/trunk/unittests/IR/ValueTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/ValueTest.cpp?rev=250843&r1=250842&r2=250843&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/ValueTest.cpp (original)
+++ llvm/trunk/unittests/IR/ValueTest.cpp Tue Oct 20 13:30:20 2015
@@ -39,9 +39,9 @@ TEST(ValueTest, UsedInBasicBlock) {
Function *F = M->getFunction("f");
- EXPECT_FALSE(F->isUsedInBasicBlock(F->begin()));
- EXPECT_TRUE((++F->arg_begin())->isUsedInBasicBlock(F->begin()));
- EXPECT_TRUE(F->arg_begin()->isUsedInBasicBlock(F->begin()));
+ EXPECT_FALSE(F->isUsedInBasicBlock(&F->front()));
+ EXPECT_TRUE((++F->arg_begin())->isUsedInBasicBlock(&F->front()));
+ EXPECT_TRUE(F->arg_begin()->isUsedInBasicBlock(&F->front()));
}
TEST(GlobalTest, CreateAddressSpace) {
@@ -127,9 +127,9 @@ TEST(ValueTest, printSlots) {
BasicBlock &BB = F->getEntryBlock();
ASSERT_EQ(3u, BB.size());
- Instruction *I0 = BB.begin();
+ Instruction *I0 = &*BB.begin();
ASSERT_TRUE(I0);
- Instruction *I1 = ++BB.begin();
+ Instruction *I1 = &*++BB.begin();
ASSERT_TRUE(I1);
ModuleSlotTracker MST(M.get());
@@ -194,12 +194,12 @@ TEST(ValueTest, getLocalSlots) {
ASSERT_FALSE(F->empty());
BasicBlock &EntryBB = F->getEntryBlock();
ASSERT_EQ(3u, EntryBB.size());
- BasicBlock *BB2 = ++F->begin();
+ BasicBlock *BB2 = &*++F->begin();
ASSERT_TRUE(BB2);
- Instruction *I0 = EntryBB.begin();
+ Instruction *I0 = &*EntryBB.begin();
ASSERT_TRUE(I0);
- Instruction *I1 = ++EntryBB.begin();
+ Instruction *I1 = &*++EntryBB.begin();
ASSERT_TRUE(I1);
ModuleSlotTracker MST(M.get());
@@ -227,7 +227,7 @@ TEST(ValueTest, getLocalSlotDeath) {
Function *F = M->getFunction("f");
ASSERT_TRUE(F);
ASSERT_FALSE(F->empty());
- BasicBlock *BB2 = ++F->begin();
+ BasicBlock *BB2 = &*++F->begin();
ASSERT_TRUE(BB2);
ModuleSlotTracker MST(M.get());
Modified: llvm/trunk/unittests/Linker/LinkModulesTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Linker/LinkModulesTest.cpp?rev=250843&r1=250842&r2=250843&view=diff
==============================================================================
--- llvm/trunk/unittests/Linker/LinkModulesTest.cpp (original)
+++ llvm/trunk/unittests/Linker/LinkModulesTest.cpp Tue Oct 20 13:30:20 2015
@@ -76,7 +76,7 @@ TEST_F(LinkModuleTest, BlockAddress) {
std::vector<Value *> GEPIndices;
GEPIndices.push_back(ConstantInt::get(Type::getInt32Ty(Ctx), 0));
- GEPIndices.push_back(F->arg_begin());
+ GEPIndices.push_back(&*F->arg_begin());
Value *GEP = Builder.CreateGEP(AT, GV, GEPIndices, "switch.gep");
Value *Load = Builder.CreateLoad(GEP, "switch.load");
Modified: llvm/trunk/unittests/Transforms/Utils/Cloning.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Transforms/Utils/Cloning.cpp?rev=250843&r1=250842&r2=250843&view=diff
==============================================================================
--- llvm/trunk/unittests/Transforms/Utils/Cloning.cpp (original)
+++ llvm/trunk/unittests/Transforms/Utils/Cloning.cpp Tue Oct 20 13:30:20 2015
@@ -165,7 +165,7 @@ TEST_F(CloneInstruction, Attributes) {
Attribute::AttrKind AK[] = { Attribute::NoCapture };
AttributeSet AS = AttributeSet::get(context, 0, AK);
- Argument *A = F1->arg_begin();
+ Argument *A = &*F1->arg_begin();
A->addAttr(AS);
SmallVector<ReturnInst*, 4> Returns;
@@ -193,7 +193,7 @@ TEST_F(CloneInstruction, CallingConventi
SmallVector<ReturnInst*, 4> Returns;
ValueToValueMapTy VMap;
- VMap[F1->arg_begin()] = F2->arg_begin();
+ VMap[&*F1->arg_begin()] = &*F2->arg_begin();
CloneFunctionInto(F2, F1, VMap, false, Returns);
EXPECT_EQ(CallingConv::Cold, F2->getCallingConv());
Modified: llvm/trunk/unittests/Transforms/Utils/IntegerDivision.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Transforms/Utils/IntegerDivision.cpp?rev=250843&r1=250842&r2=250843&view=diff
==============================================================================
--- llvm/trunk/unittests/Transforms/Utils/IntegerDivision.cpp (original)
+++ llvm/trunk/unittests/Transforms/Utils/IntegerDivision.cpp Tue Oct 20 13:30:20 2015
@@ -35,8 +35,8 @@ TEST(IntegerDivision, SDiv) {
Builder.SetInsertPoint(BB);
Function::arg_iterator AI = F->arg_begin();
- Value *A = AI++;
- Value *B = AI++;
+ Value *A = &*AI++;
+ Value *B = &*AI++;
Value *Div = Builder.CreateSDiv(A, B);
EXPECT_TRUE(BB->front().getOpcode() == Instruction::SDiv);
@@ -65,8 +65,8 @@ TEST(IntegerDivision, UDiv) {
Builder.SetInsertPoint(BB);
Function::arg_iterator AI = F->arg_begin();
- Value *A = AI++;
- Value *B = AI++;
+ Value *A = &*AI++;
+ Value *B = &*AI++;
Value *Div = Builder.CreateUDiv(A, B);
EXPECT_TRUE(BB->front().getOpcode() == Instruction::UDiv);
@@ -95,8 +95,8 @@ TEST(IntegerDivision, SRem) {
Builder.SetInsertPoint(BB);
Function::arg_iterator AI = F->arg_begin();
- Value *A = AI++;
- Value *B = AI++;
+ Value *A = &*AI++;
+ Value *B = &*AI++;
Value *Rem = Builder.CreateSRem(A, B);
EXPECT_TRUE(BB->front().getOpcode() == Instruction::SRem);
@@ -125,8 +125,8 @@ TEST(IntegerDivision, URem) {
Builder.SetInsertPoint(BB);
Function::arg_iterator AI = F->arg_begin();
- Value *A = AI++;
- Value *B = AI++;
+ Value *A = &*AI++;
+ Value *B = &*AI++;
Value *Rem = Builder.CreateURem(A, B);
EXPECT_TRUE(BB->front().getOpcode() == Instruction::URem);
@@ -156,8 +156,8 @@ TEST(IntegerDivision, SDiv64) {
Builder.SetInsertPoint(BB);
Function::arg_iterator AI = F->arg_begin();
- Value *A = AI++;
- Value *B = AI++;
+ Value *A = &*AI++;
+ Value *B = &*AI++;
Value *Div = Builder.CreateSDiv(A, B);
EXPECT_TRUE(BB->front().getOpcode() == Instruction::SDiv);
@@ -186,8 +186,8 @@ TEST(IntegerDivision, UDiv64) {
Builder.SetInsertPoint(BB);
Function::arg_iterator AI = F->arg_begin();
- Value *A = AI++;
- Value *B = AI++;
+ Value *A = &*AI++;
+ Value *B = &*AI++;
Value *Div = Builder.CreateUDiv(A, B);
EXPECT_TRUE(BB->front().getOpcode() == Instruction::UDiv);
@@ -216,8 +216,8 @@ TEST(IntegerDivision, SRem64) {
Builder.SetInsertPoint(BB);
Function::arg_iterator AI = F->arg_begin();
- Value *A = AI++;
- Value *B = AI++;
+ Value *A = &*AI++;
+ Value *B = &*AI++;
Value *Rem = Builder.CreateSRem(A, B);
EXPECT_TRUE(BB->front().getOpcode() == Instruction::SRem);
@@ -246,8 +246,8 @@ TEST(IntegerDivision, URem64) {
Builder.SetInsertPoint(BB);
Function::arg_iterator AI = F->arg_begin();
- Value *A = AI++;
- Value *B = AI++;
+ Value *A = &*AI++;
+ Value *B = &*AI++;
Value *Rem = Builder.CreateURem(A, B);
EXPECT_TRUE(BB->front().getOpcode() == Instruction::URem);
More information about the llvm-commits
mailing list