[PATCH] D40915: Always evaluate the second argument for CHECK() lazily.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 6 13:27:41 PST 2017


Rui Ueyama <ruiu at google.com> writes:

> On Wed, Dec 6, 2017 at 12:55 PM, Rafael Avila de Espindola <
> rafael.espindola at gmail.com> wrote:
>
>> Rui Ueyama via Phabricator <reviews at reviews.llvm.org> writes:
>>
>>
>> > -template <class T> T check(ErrorOr<T> E, const Twine &Prefix) {
>> > +template <class T> T check2(ErrorOr<T> E, std::function<std::string()>
>> Prefix) {
>>
>> Why do you need a std::function, a function_ref should work, no?
>>
>
> I guess it'd work, but why do you prefer llvm::function_ref over
> std::function?

It never allocates memory and is a lot simpler, which is nice since we
will creating a lot of those.

Cheers,
Rafael


More information about the llvm-commits mailing list