[PATCH] D78795: [Support] Add raw_ostream_iterator: ostream_iterator for raw_ostream.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 23:08:58 PDT 2020


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

Maybe some more test coverage (empty range at least) but otherwise looks good.

Maybe hold of on committing this until some of the rest of the patch sequence has been reviewed/approved, in case it doesn't end up being needed.



================
Comment at: llvm/include/llvm/Support/raw_ostream.h:637
+  raw_ostream_iterator(raw_ostream &Stream)
+      : OutStream(Stream), Delim(nullptr) {}
+
----------------
Could use a non-static data member initializer for Delim = nullptr, and not bother initializing it here, perhaps? (I don't feel super strongly about this)


================
Comment at: llvm/unittests/Support/raw_ostream_test.cpp:358-360
+  raw_string_ostream Str(S);
+  std::copy(First, Last, raw_ostream_iterator<T>(Str));
+  Str.flush();
----------------
FWIW (again, don't feel strongly) I'd probably use an explicit scope rather than an explicit call to flush here. *shrug*


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

https://reviews.llvm.org/D78795





More information about the llvm-commits mailing list