[PATCH] D49013: [Support] Allow formatv() to consume llvm::Error by-value without crashing.

Lang Hames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 11 07:35:03 PDT 2018


lhames added a comment.

In https://reviews.llvm.org/D49013#1157490, @dblaikie wrote:

> That seems plausible (op<< for Error) - but does that handle the case
>  mentioned above "we may not actually want to produce the string (eg: if the
>  Logger implementation decides to filter out the formatv_object_base based
>  on level)" - is op<< still called even with this filtering? (seems like if
>  it was, then it wouldn't avoid the stringification costs? but if it doesn't
>  call the op<< then it'll still fail the consume semantic requirement of
>  llvm::Error)


Would it be reasonable to have the wrapper for an Error value call consumeError in its destructor? That way a filtered value would silently consume the error. A printed value would consume it twice, but that should be safe (if it isn't already then we can make it safe).


Repository:
  rL LLVM

https://reviews.llvm.org/D49013





More information about the llvm-commits mailing list