]> granicus.if.org Git - llvm/commit
raw_ostream: add operator<< overload for std::error_code
authorPavel Labath <pavel@labath.sk>
Wed, 14 Aug 2019 13:33:28 +0000 (13:33 +0000)
committerPavel Labath <pavel@labath.sk>
Wed, 14 Aug 2019 13:33:28 +0000 (13:33 +0000)
commitc9850460b726c1764a6bbd18eca5219f10a28133
tree6ce85f73093b593cdc86101610fef11bbbf8b2ab
parentc567852d276b30dde50ae380d4e1d6665aebd112
raw_ostream: add operator<< overload for std::error_code

Summary:
The main motivation for this is unit tests, which contain a large macro
for pretty-printing std::error_code, and this macro is duplicated in
every file that needs to do this. However, the functionality may be
useful elsewhere too.

In this patch I have reimplemented the existing ASSERT_NO_ERROR macros
to reuse the new functionality, but I have kept the macro (as a
one-liner) as it is slightly more readable than ASSERT_EQ(...,
std::error_code()).

Reviewers: sammccall, ilya-biryukov

Subscribers: zturner, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D65643

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368849 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/raw_ostream.h
lib/Support/raw_ostream.cpp
unittests/BinaryFormat/TestFileMagic.cpp
unittests/Support/ErrorTest.cpp
unittests/Support/FileOutputBufferTest.cpp
unittests/Support/Host.cpp
unittests/Support/Path.cpp
unittests/Support/ProgramTest.cpp
unittests/Support/ReplaceFileTest.cpp
unittests/Support/raw_pwrite_stream_test.cpp