[llvm-branch-commits] [llvm] 171c5fd - [llvm] Use llvm::erase_value and llvm::erase_if (NFC)
Kazu Hirata via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sat Jan 2 09:28:55 PST 2021
Author: Kazu Hirata
Date: 2021-01-02T09:24:15-08:00
New Revision: 171c5fd43ecf46d5798b402c8cafccab07060e10
URL: https://github.com/llvm/llvm-project/commit/171c5fd43ecf46d5798b402c8cafccab07060e10
DIFF: https://github.com/llvm/llvm-project/commit/171c5fd43ecf46d5798b402c8cafccab07060e10.diff
LOG: [llvm] Use llvm::erase_value and llvm::erase_if (NFC)
Added:
Modified:
llvm/lib/CodeGen/WinEHPrepare.cpp
llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp
llvm/tools/llvm-yaml-numeric-parser-fuzzer/yaml-numeric-parser-fuzzer.cpp
llvm/tools/llvm-yaml-parser-fuzzer/yaml-parser-fuzzer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp
index 5a25234ba850..96d256ba57a3 100644
--- a/llvm/lib/CodeGen/WinEHPrepare.cpp
+++ b/llvm/lib/CodeGen/WinEHPrepare.cpp
@@ -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()
diff --git a/llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp b/llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp
index 39945ac3b1c1..b6763fd9aef0 100644
--- a/llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp
+++ b/llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp
@@ -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());
diff --git a/llvm/tools/llvm-yaml-numeric-parser-fuzzer/yaml-numeric-parser-fuzzer.cpp b/llvm/tools/llvm-yaml-numeric-parser-fuzzer/yaml-numeric-parser-fuzzer.cpp
index 3f50d60bc12c..7ffc75e66a52 100644
--- a/llvm/tools/llvm-yaml-numeric-parser-fuzzer/yaml-numeric-parser-fuzzer.cpp
+++ b/llvm/tools/llvm-yaml-numeric-parser-fuzzer/yaml-numeric-parser-fuzzer.cpp
@@ -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;
diff --git a/llvm/tools/llvm-yaml-parser-fuzzer/yaml-parser-fuzzer.cpp b/llvm/tools/llvm-yaml-parser-fuzzer/yaml-parser-fuzzer.cpp
index 3aeaf02f3e75..007769fd047a 100644
--- a/llvm/tools/llvm-yaml-parser-fuzzer/yaml-parser-fuzzer.cpp
+++ b/llvm/tools/llvm-yaml-parser-fuzzer/yaml-parser-fuzzer.cpp
@@ -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());
More information about the llvm-branch-commits
mailing list