1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00

[llvm-objcopy] Use llvm::erase_if (NFC)

This commit is contained in:
Kazu Hirata 2020-12-25 10:13:18 -08:00
parent 950b351780
commit 5dfa98f2df
3 changed files with 10 additions and 17 deletions

View File

@ -40,17 +40,14 @@ const Symbol *Object::findSymbol(size_t UniqueId) const {
Error Object::removeSymbols(
function_ref<Expected<bool>(const Symbol &)> ToRemove) {
Error Errs = Error::success();
Symbols.erase(std::remove_if(std::begin(Symbols), std::end(Symbols),
[ToRemove, &Errs](const Symbol &Sym) {
Expected<bool> ShouldRemove = ToRemove(Sym);
if (!ShouldRemove) {
Errs = joinErrors(std::move(Errs),
ShouldRemove.takeError());
return false;
}
return *ShouldRemove;
}),
std::end(Symbols));
llvm::erase_if(Symbols, [ToRemove, &Errs](const Symbol &Sym) {
Expected<bool> ShouldRemove = ToRemove(Sym);
if (!ShouldRemove) {
Errs = joinErrors(std::move(Errs), ShouldRemove.takeError());
return false;
}
return *ShouldRemove;
});
updateSymbols();
return Errs;

View File

@ -26,9 +26,7 @@ SymbolEntry *SymbolTable::getSymbolByIndex(uint32_t Index) {
void SymbolTable::removeSymbols(
function_ref<bool(const std::unique_ptr<SymbolEntry> &)> ToRemove) {
Symbols.erase(
std::remove_if(std::begin(Symbols), std::end(Symbols), ToRemove),
std::end(Symbols));
llvm::erase_if(Symbols, ToRemove);
}
void Object::updateLoadCommandIndexes() {

View File

@ -26,9 +26,7 @@ void Object::addSectionWithOwnedContents(
void Object::removeSections(function_ref<bool(const Section &)> ToRemove) {
// TODO: remove reloc sections for the removed section, handle symbols, etc.
Sections.erase(
std::remove_if(std::begin(Sections), std::end(Sections), ToRemove),
std::end(Sections));
llvm::erase_if(Sections, ToRemove);
}
} // end namespace wasm