diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-12-29 22:39:45 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-12-29 22:39:45 +0000 |
commit | d8fd93c1194ba5aca9bff7b2e0e6c22b37c62fbb (patch) | |
tree | 2ce5340b9f4761f7849469becd09fac1663f97c8 /lib/CodeGen | |
parent | bbe74454da54091758409a2f2aa9680f335bd361 (diff) |
Use std::find_if instead of manual loop.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224960 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CGVTables.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/CodeGen/CGVTables.cpp b/lib/CodeGen/CGVTables.cpp index 48a93ba65d..1aff346978 100644 --- a/lib/CodeGen/CGVTables.cpp +++ b/lib/CodeGen/CGVTables.cpp @@ -159,14 +159,10 @@ void CodeGenFunction::GenerateVarArgsThunk( // with "this". llvm::Value *ThisPtr = &*AI; llvm::BasicBlock *EntryBB = Fn->begin(); - llvm::Instruction *ThisStore = nullptr; - for (llvm::BasicBlock::iterator I = EntryBB->begin(), E = EntryBB->end(); - I != E; I++) { - if (isa<llvm::StoreInst>(I) && I->getOperand(0) == ThisPtr) { - ThisStore = cast<llvm::StoreInst>(I); - break; - } - } + llvm::Instruction *ThisStore = + std::find_if(EntryBB->begin(), EntryBB->end(), [&](llvm::Instruction &I) { + return isa<llvm::StoreInst>(I) && I.getOperand(0) == ThisPtr; + }); assert(ThisStore && "Store of this should be in entry block?"); // Adjust "this", if necessary. Builder.SetInsertPoint(ThisStore); |