[PATCH] D35149: llvm-profdata: Reduce memory usage by using Error callback rather than member

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 9 18:17:41 PDT 2017


On Sun, Jul 9, 2017 at 6:14 AM David Li via Phabricator <
reviews at reviews.llvm.org> wrote:

> davidxl added a comment.
>
> It feels weird that the error handling is the first parameter of the
> interfaces.


Not sure it's too different - but clang-format does have a special case for
lambdas as the last argument to a function, so it's a bit nicer that way -
done!


> Also is it possible to provide a default error handling ?
>

Not sure - I don't think there's any reasonable default for handling errors
(or pseudo errors, more like guidelines/warnings in this case). Certainly
llvm-profdata's the only user right now & doesn't want to ignore errors,
for example.


>
>
>
> ================
> Comment at: tools/llvm-profdata/llvm-profdata.cpp:164
> +    WC->Writer.addRecord(
> +        [&](Error E) {
> +          if (Reported) {
> ----------------
> creating a named lambda is more readable IMO.
>

Is it more readable now that it's formatted differently by having the
lambda as the last argument? It's pretty rare to name lambdas used only
once & should have quite similar formatting now (without the extra
indentation).


>
>
> https://reviews.llvm.org/D35149
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170710/0a6afa5c/attachment.html>


More information about the llvm-commits mailing list