From d8fd93c1194ba5aca9bff7b2e0e6c22b37c62fbb Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Mon, 29 Dec 2014 22:39:45 +0000 Subject: 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 --- lib/CodeGen/CGVTables.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'lib/CodeGen') 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(I) && I->getOperand(0) == ThisPtr) { - ThisStore = cast(I); - break; - } - } + llvm::Instruction *ThisStore = + std::find_if(EntryBB->begin(), EntryBB->end(), [&](llvm::Instruction &I) { + return isa(I) && I.getOperand(0) == ThisPtr; + }); assert(ThisStore && "Store of this should be in entry block?"); // Adjust "this", if necessary. Builder.SetInsertPoint(ThisStore); -- cgit v1.2.3