Skip to content

Commit 09356ef

Browse files
committed
use count_if
1 parent d295ede commit 09356ef

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lld/wasm/InputChunks.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "lld/Common/LLVM.h"
1515
#include "llvm/Support/LEB128.h"
1616
#include "llvm/Support/xxhash.h"
17+
#include <algorithm>
1718

1819
#define DEBUG_TYPE "lld"
1920

@@ -173,12 +174,10 @@ static bool relocIsLive(const WasmRelocation &rel, ObjFile *file) {
173174
}
174175

175176
size_t InputChunk::getNumLiveRelocations() const {
176-
size_t result = 0;
177-
for (const WasmRelocation &rel : relocations) {
178-
if (relocIsLive(rel, file))
179-
result++;
180-
}
181-
return result;
177+
return std::count_if(relocations.begin(), relocations.end(),
178+
[this](const WasmRelocation &rel) {
179+
return relocIsLive(rel, file);
180+
});
182181
}
183182

184183
// Copy relocation entries to a given output stream.

0 commit comments

Comments
 (0)