[PATCH] D65643: raw_ostream: add operator<< overload for std::error_code
Sam McCall via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 12 06:00:12 PDT 2019
sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.
Thanks! I actually like the ASSERT_NO_ERROR macros, `std::error_code()` meaning success is pretty obscure to write everywhere.
================
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();
----------------
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?
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