[llvm] b809d5e - [ProfileData] Use lambdas instead of std::bind (NFC) (#146625)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 1 22:50:07 PDT 2025
Author: Kazu Hirata
Date: 2025-07-01T22:50:04-07:00
New Revision: b809d5e2ac8db8f1ec6e77cbc30fd5640426f82f
URL: https://github.com/llvm/llvm-project/commit/b809d5e2ac8db8f1ec6e77cbc30fd5640426f82f
DIFF: https://github.com/llvm/llvm-project/commit/b809d5e2ac8db8f1ec6e77cbc30fd5640426f82f.diff
LOG: [ProfileData] Use lambdas instead of std::bind (NFC) (#146625)
Lambdas are a lot shorter than std::bind here.
Added:
Modified:
llvm/lib/ProfileData/InstrProf.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ProfileData/InstrProf.cpp b/llvm/lib/ProfileData/InstrProf.cpp
index 9a8b4cfc81f6a..bd3964ce127fd 100644
--- a/llvm/lib/ProfileData/InstrProf.cpp
+++ b/llvm/lib/ProfileData/InstrProf.cpp
@@ -617,28 +617,24 @@ Error readAndDecodeStrings(StringRef NameStrings,
}
Error InstrProfSymtab::create(StringRef NameStrings) {
- return readAndDecodeStrings(
- NameStrings,
- std::bind(&InstrProfSymtab::addFuncName, this, std::placeholders::_1));
+ return readAndDecodeStrings(NameStrings,
+ [&](StringRef S) { return addFuncName(S); });
}
Error InstrProfSymtab::create(StringRef FuncNameStrings,
StringRef VTableNameStrings) {
- if (Error E = readAndDecodeStrings(FuncNameStrings,
- std::bind(&InstrProfSymtab::addFuncName,
- this, std::placeholders::_1)))
+ if (Error E = readAndDecodeStrings(
+ FuncNameStrings, [&](StringRef S) { return addFuncName(S); }))
return E;
- return readAndDecodeStrings(
- VTableNameStrings,
- std::bind(&InstrProfSymtab::addVTableName, this, std::placeholders::_1));
+ return readAndDecodeStrings(VTableNameStrings,
+ [&](StringRef S) { return addVTableName(S); });
}
Error InstrProfSymtab::initVTableNamesFromCompressedStrings(
StringRef CompressedVTableStrings) {
- return readAndDecodeStrings(
- CompressedVTableStrings,
- std::bind(&InstrProfSymtab::addVTableName, this, std::placeholders::_1));
+ return readAndDecodeStrings(CompressedVTableStrings,
+ [&](StringRef S) { return addVTableName(S); });
}
StringRef InstrProfSymtab::getCanonicalName(StringRef PGOName) {
More information about the llvm-commits
mailing list