Use llvm::erase_value (NFC)

This commit is contained in:
Kazu Hirata 2022-08-13 12:55:50 -07:00
parent 2febc32c9c
commit 448c466636
4 changed files with 4 additions and 10 deletions

View File

@ -122,8 +122,7 @@ llvm::StringRef HostInfoLinux::GetDistributionId() {
if (strstr(distribution_id, distributor_id_key)) {
// strip newlines
std::string id_string(distribution_id + strlen(distributor_id_key));
id_string.erase(std::remove(id_string.begin(), id_string.end(), '\n'),
id_string.end());
llvm::erase_value(id_string, '\n');
// lower case it and convert whitespace to underscores
std::transform(

View File

@ -24,9 +24,7 @@ void JITLoaderList::Append(const JITLoaderSP &jit_loader_sp) {
void JITLoaderList::Remove(const JITLoaderSP &jit_loader_sp) {
std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
m_jit_loaders_vec.erase(std::remove(m_jit_loaders_vec.begin(),
m_jit_loaders_vec.end(), jit_loader_sp),
m_jit_loaders_vec.end());
llvm::erase_value(m_jit_loaders_vec, jit_loader_sp);
}
size_t JITLoaderList::GetSize() const { return m_jit_loaders_vec.size(); }

View File

@ -1383,9 +1383,7 @@ bool DataFlowSanitizer::runImpl(Module &M) {
assert(isa<Function>(C) && "Personality routine is not a function!");
Function *F = cast<Function>(C);
if (!isInstrumented(F))
FnsToInstrument.erase(
std::remove(FnsToInstrument.begin(), FnsToInstrument.end(), F),
FnsToInstrument.end());
llvm::erase_value(FnsToInstrument, F);
}
}

View File

@ -827,8 +827,7 @@ private:
}
// Remove chain From from the list of active chains
auto Iter = std::remove(HotChains.begin(), HotChains.end(), From);
HotChains.erase(Iter, HotChains.end());
llvm::erase_value(HotChains, From);
// Invalidate caches
for (auto EdgeIter : Into->edges()) {