labath added a comment.

In https://reviews.llvm.org/D27459#614549, @zturner wrote:

> A couple comments:
>
> 1. If we're going to use `formatv` (yay!) then let's standardize.  No point 
> mising `formatv` and streaming, especially when the former will almost always 
> be less verbose.


In this change, I deliberately tried to mix styles, to show different ways of 
doing things. I also wanted to avoid prescribing the right API to use, as I've 
found llvm::formatv to be longer in the simple cases. However, hiding it in a 
macro is a good idea, and would remove that problem.

> 
> 
> 2. One of the concerns that came up last time was that of evaluating the 
> arguments to the logging functions even in the case where it didn't get 
> logged, because sometimes just calling the function to evaluate the parameter 
> can be expensive.  To get around that you could pass the arguments directly 
> to the macro instead of streaming them, and the macro could wrap everything 
> in a lambda.

The macro expands to something like `if (!log) /*do nothing*/; else log << 
whatever`, so the streaming part only gets executed if logging is actually 
enabled. That said, I like the API you propose as well (and it could probably 
use something similar under the hood, to avoid messing around with lambdas).


https://reviews.llvm.org/D27459



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to