summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2016-02-19 00:18:46 +0000
committerJustin Lebar <jlebar@google.com>2016-02-19 00:18:46 +0000
commitc75d566f566c10cf417c81051c152e77b2515eee (patch)
tree38322b8fdca9f4130913b21c677a63348e199696 /llvm/lib/Support
parent54f82bfb802093d2f3790db8320a4712c657794e (diff)
downloadbcm5719-llvm-c75d566f566c10cf417c81051c152e77b2515eee.tar.gz
bcm5719-llvm-c75d566f566c10cf417c81051c152e77b2515eee.zip
When printing MIR, output to errs() rather than outs().
Summary: Without this, this command $ llvm-run llc -stop-after machine-cp -o - <( echo '' ) outputs an error, because we close stdout twice -- once when closing the file opened for "-o", and again when closing outs(). Also clarify in the outs() definition that you can't ever call it if you want to open your own raw_fd_ostream on stdout. Reviewers: jroelofs, tstellarAMD Subscribers: jholewinski, qcolombet, dsanders, llvm-commits Differential Revision: http://reviews.llvm.org/D17422 llvm-svn: 261286
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/raw_ostream.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp
index f5a3162e2ba..07497fcd731 100644
--- a/llvm/lib/Support/raw_ostream.cpp
+++ b/llvm/lib/Support/raw_ostream.cpp
@@ -715,9 +715,10 @@ bool raw_fd_ostream::has_colors() const {
/// outs() - This returns a reference to a raw_ostream for standard output.
/// Use it like: outs() << "foo" << "bar";
raw_ostream &llvm::outs() {
- // Set buffer settings to model stdout behavior.
- // Delete the file descriptor when the program exits, forcing error
- // detection. If you don't want this behavior, don't use outs().
+ // Set buffer settings to model stdout behavior. Delete the file descriptor
+ // when the program exits, forcing error detection. This means that if you
+ // ever call outs(), you can't open another raw_fd_ostream on stdout, as we'll
+ // close stdout twice and print an error the second time.
std::error_code EC;
static raw_fd_ostream S("-", EC, sys::fs::F_None);
assert(!EC);
OpenPOWER on IntegriCloud