[PATCH] D65643: raw_ostream: add operator<< overload for std::error_code
Pavel Labath via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 14 06:29:17 PDT 2019
labath marked 2 inline comments as done.
labath added a comment.
In D65643#1625108 <https://reviews.llvm.org/D65643#1625108>, @sammccall wrote:
> Thanks! I actually like the ASSERT_NO_ERROR macros, `std::error_code()` meaning success is pretty obscure to write everywhere.
Yeah, I see what you mean. The thing that really annoyed me was pasting the large macro everywhere, but a one-liner is not that much of a big deal.
================
Comment at: lib/Support/raw_ostream.cpp:143
+raw_ostream &raw_ostream::operator<<(std::error_code EC) {
+ return *this << EC.category().name() << ':' << EC.value() << ' '
+ << EC.message();
----------------
sammccall wrote:
> Looks like typical output is `system:2 address already in use`
>
> This reads a little oddly to me: the colon is easily mistaken for (english) punctuation, but that leads to misreading the text. And the category/number are first, but I think usually less relevant than the description.
>
> Maybe consider `address already in use (system:2)` or so?
Done.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65643/new/
https://reviews.llvm.org/D65643
More information about the llvm-commits
mailing list