[lld] 53e7eef - [lld-macho][nfc] Use llvm::function_ref instead of std::function
Jez Ng via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 7 09:36:43 PST 2022
Author: Jez Ng
Date: 2022-03-07T12:36:27-05:00
New Revision: 53e7eef43f6928ff0daaed70d1a426c261621b1d
URL: https://github.com/llvm/llvm-project/commit/53e7eef43f6928ff0daaed70d1a426c261621b1d
DIFF: https://github.com/llvm/llvm-project/commit/53e7eef43f6928ff0daaed70d1a426c261621b1d.diff
LOG: [lld-macho][nfc] Use llvm::function_ref instead of std::function
Added:
Modified:
lld/MachO/ICF.cpp
Removed:
################################################################################
diff --git a/lld/MachO/ICF.cpp b/lld/MachO/ICF.cpp
index 9eed765ab6e23..b90464a771065 100644
--- a/lld/MachO/ICF.cpp
+++ b/lld/MachO/ICF.cpp
@@ -33,8 +33,8 @@ class ICF {
void segregate(size_t begin, size_t end, EqualsFn);
size_t findBoundary(size_t begin, size_t end);
void forEachClassRange(size_t begin, size_t end,
- std::function<void(size_t, size_t)> func);
- void forEachClass(std::function<void(size_t, size_t)> func);
+ llvm::function_ref<void(size_t, size_t)> func);
+ void forEachClass(llvm::function_ref<void(size_t, size_t)> func);
bool equalsConstant(const ConcatInputSection *ia,
const ConcatInputSection *ib);
@@ -225,7 +225,7 @@ size_t ICF::findBoundary(size_t begin, size_t end) {
// Invoke FUNC on subranges with matching equivalence class
void ICF::forEachClassRange(size_t begin, size_t end,
- std::function<void(size_t, size_t)> func) {
+ llvm::function_ref<void(size_t, size_t)> func) {
while (begin < end) {
size_t mid = findBoundary(begin, end);
func(begin, mid);
@@ -235,7 +235,7 @@ void ICF::forEachClassRange(size_t begin, size_t end,
// Split icfInputs into shards, then parallelize invocation of FUNC on subranges
// with matching equivalence class
-void ICF::forEachClass(std::function<void(size_t, size_t)> func) {
+void ICF::forEachClass(llvm::function_ref<void(size_t, size_t)> func) {
// Only use threads when the benefits outweigh the overhead.
const size_t threadingThreshold = 1024;
if (icfInputs.size() < threadingThreshold) {
More information about the llvm-commits
mailing list