Frontend: Simplify handling of non-seeking streams in CompilerInstance, NFC
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 15 Dec 2020 01:46:11 +0000 (17:46 -0800)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 26 Jan 2021 23:20:43 +0000 (15:20 -0800)
commit2f721476d10c1cc7a5336650a85012f78c94d33a
tree3d57a648621def8e4b24e73102024f94a318d985
parentf36007e8110174ea10294f6fa546f3c64f0e548a
Frontend: Simplify handling of non-seeking streams in CompilerInstance, NFC

Add a new `raw_pwrite_ostream` variant, `buffer_unique_ostream`, which
is like `buffer_ostream` but with unique ownership of the stream it's
wrapping. Use this in CompilerInstance to simplify the ownership of
non-seeking output streams, avoiding logic sprawled around to deal with
them specially.

This also simplifies future work to encapsulate output files in a
different class.

Differential Revision: https://reviews.llvm.org/D93260
clang/include/clang/Frontend/CompilerInstance.h
clang/lib/Frontend/CompilerInstance.cpp
llvm/include/llvm/Support/raw_ostream.h
llvm/lib/Support/raw_ostream.cpp