[PATCH] D81078: [Support] Use outs() in ToolOutputFile

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 08:44:56 PDT 2020


MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

LGTM.



================
Comment at: llvm/include/llvm/Support/raw_ostream.h:501
+/// like: outs() << "foo" << "bar";
+raw_fd_ostream &outs();
 
----------------
jhenderson wrote:
> I'm not sure I'm following the reason for changing from the base class here? I'm guessing it's to fit in well with `ToolOutputFile`'s usage, but coudl that be changed to store a pointer to and return a `raw_ostream` easily?
`&outs()` is stored to `raw_fd_ostream *ToolOutputFile::OS`.

Some `ToolOutputFile::os()` call sites (`lib/LTO/LTOCodeGenerator.cpp`) use `clear_error()`, `error()`, etc, which requires a `raw_fd_ostream`

I think changing the return type to `raw_fd_ostream &` is fine.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81078/new/

https://reviews.llvm.org/D81078





More information about the llvm-commits mailing list