[PATCH] D54813: [Common] Threads: use function_ref instead of std::function

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 26 16:19:31 PST 2018


MaskRay added a comment.

In D54813#1308421 <https://reviews.llvm.org/D54813#1308421>, @ruiu wrote:

> What is a benefit of doing this?


a) Performance (very minor): it removes a heap allocation of the function constructor (`template<class F> function(F f)`)
b) Clarity: it suggests that the callable's lifetime should end after the callee returns. Such callback is widely used in llvm. lld also uses it a lot (at least 17 times).


Repository:
  rLLD LLVM Linker

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54813/new/

https://reviews.llvm.org/D54813





More information about the llvm-commits mailing list