[PATCH] D70287: Fix Incorrect Stream in LLD ErrorHandler

Erik McClure via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 14 18:26:15 PST 2019


blackhole12 created this revision.
blackhole12 added projects: lld, LLVM.

LLD's ErrorHandler accepts a stream parameter that output may be redirected to. This can be used by programs to capture log output or redirect it somewhere else. For some reason, `message()` does not use this parameter, and simply outputs directly to std::cout no matter what. This patch ensure it uses the stream parameter like all the other error handling functions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70287

Files:
  lld/Common/ErrorHandler.cpp


Index: lld/Common/ErrorHandler.cpp
===================================================================
--- lld/Common/ErrorHandler.cpp
+++ lld/Common/ErrorHandler.cpp
@@ -139,8 +139,8 @@
 
 void ErrorHandler::message(const Twine &msg) {
   std::lock_guard<std::mutex> lock(mu);
-  outs() << msg << "\n";
-  outs().flush();
+  *errorOS << msg << "\n";
+  errorOS->flush();
 }
 
 void ErrorHandler::warn(const Twine &msg) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70287.229435.patch
Type: text/x-patch
Size: 422 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191115/7b33107e/attachment.bin>


More information about the llvm-commits mailing list