[llvm] [memprof] Use a lambda instead of std::bind (NFC) (PR #144940)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 19 13:16:55 PDT 2025


kazutakahirata wrote:

> Using `std::mem_fn()` would be even shorter.

Thanks for a comment!  IIUC, with `std::mem_fn`, we would do something like:

```
Callback = [&](FrameId Id) { return std::mem_fn(&MemProfReader::idToFrame)(this, Id); };
```

At that point, it's longer than:

```
Callback = [&](FrameId Id) { return idToFrame(Id); };
```

I don't think we can "package" `this` into `std::mem_fn`.



https://github.com/llvm/llvm-project/pull/144940


More information about the llvm-commits mailing list