[PATCH] D51033: [DWARF] Move error printing from DWARF classes to Support library. NFC.

Victor Leschuk via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 21 08:49:39 PDT 2018


vleschuk added inline comments.


================
Comment at: lib/Support/Error.cpp:127
+void dumpError(Error Error) {
+  dumpMessage(WithColor::error(), std::move(Error));
+}
----------------
vleschuk wrote:
> Actually it appears that this code is invalid:
> 
> WithColor::error() and friends can be used only in-place. If you pass it as param:
> 
> ```
> void foo(raw_ostream& OS) { OS << "test\n"; }
> void bar() { foo(WithColor::error()); }
> ```
> 
> Will result in two lines:
> 
> error: test
> error:
> 
> What can we do here? The easiest way is duplicate the call to handleAllErrors() in each of 3 functions. But I don't like it.
> 
Actually the code looks correct to me, but the actual behavior looks strange.


https://reviews.llvm.org/D51033





More information about the llvm-commits mailing list