[llvm] Use llvm::erase_value and llvm::erase_if (NFC)

This commit is contained in:
Kazu Hirata 2021-01-02 09:24:15 -08:00
parent f7f42e64df
commit 171c5fd43e
4 changed files with 5 additions and 9 deletions

View File

@ -804,13 +804,9 @@ void WinEHPrepare::cloneCommonBlocks(Function &F) {
<< "\' to block \'" << NewBlock->getName()
<< "\'.\n");
BlocksInFunclet.erase(
std::remove(BlocksInFunclet.begin(), BlocksInFunclet.end(), OldBlock),
BlocksInFunclet.end());
llvm::erase_value(BlocksInFunclet, OldBlock);
ColorVector &OldColors = BlockColors[OldBlock];
OldColors.erase(
std::remove(OldColors.begin(), OldColors.end(), FuncletPadBB),
OldColors.end());
llvm::erase_value(OldColors, FuncletPadBB);
DEBUG_WITH_TYPE("winehprepare-coloring",
dbgs() << " Removed color \'" << FuncletPadBB->getName()

View File

@ -997,7 +997,7 @@ OperandMatchResultTy HexagonAsmParser::tryParseRegister(unsigned &RegNo,
NeededWorkaround = NeededWorkaround || (Again && !(Contigious && Type));
}
std::string Collapsed = std::string(RawString);
Collapsed.erase(llvm::remove_if(Collapsed, isSpace), Collapsed.end());
llvm::erase_if(Collapsed, isSpace);
StringRef FullString = Collapsed;
std::pair<StringRef, StringRef> DotSplit = FullString.split('.');
unsigned DotReg = matchRegister(DotSplit.first.lower());

View File

@ -39,7 +39,7 @@ inline bool isNumericRegex(llvm::StringRef S) {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
std::string Input(reinterpret_cast<const char *>(Data), Size);
Input.erase(std::remove(Input.begin(), Input.end(), 0), Input.end());
llvm::erase_value(Input, 0);
if (!Input.empty() && llvm::yaml::isNumeric(Input) != isNumericRegex(Input))
LLVM_BUILTIN_TRAP;
return 0;

View File

@ -25,7 +25,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
isValidYaml(Input.data(), Input.size());
// Ensure we don't crash on byte strings with no null characters.
Input.erase(std::remove(Input.begin(), Input.end(), 0), Input.end());
llvm::erase_value(Input, 0);
Input.shrink_to_fit();
bool IsValidWithout0s = isValidYaml(Input.data(), Input.size());