Skip to content

Commit

Permalink
[lld-macho][nfc] Use llvm::function_ref instead of std::function
Browse files Browse the repository at this point in the history
  • Loading branch information
int3 committed Mar 7, 2022
1 parent c416f3f commit 53e7eef
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lld/MachO/ICF.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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) {
Expand Down

0 comments on commit 53e7eef

Please sign in to comment.