// 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());
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);
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);
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);
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);
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));
{
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());
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());
// 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);
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) {
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());
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());
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());
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");
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;
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());
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);
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);
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);
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);
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);
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);
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);
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);