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

Sam McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 12 00:15:27 PDT 2018


sammccall abandoned this revision.
sammccall added a comment.

In https://reviews.llvm.org/D49013#1158721, @lhames wrote:

> 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).


https://reviews.llvm.org/D49170 uses the constructor-wrapper approach, with an explicit adapter. I'll abandon this revision.
I don't think having the wrapper call `<<(Error&&)` is a good idea even with this, because it means formatv_object's `operator<<` isn't truly const (when printing twice the message is different, printing concurrently is racy, etc).
So we could still add `<<(Error&&)`, but the wrapper should call `<<(const Error&)` as it does in https://reviews.llvm.org/D49170.


Repository:
  rL LLVM

https://reviews.llvm.org/D49013





More information about the llvm-commits mailing list