aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2017-03-13 19:38:32 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2017-03-13 19:38:32 +0000
commit3978b877d7773c77577353239158941e208bbfea (patch)
tree7011d818d6358bdb2cdff81bd93e19f4716bcb76
parent35f96eca4bf43b2583499fc3f977d4690b18158d (diff)
downloadllvm-3978b877d7773c77577353239158941e208bbfea.zip
llvm-3978b877d7773c77577353239158941e208bbfea.tar.gz
llvm-3978b877d7773c77577353239158941e208bbfea.tar.bz2
Revert "Fix crash when multiple raw_fd_ostreams to stdout are created."
This reverts commit r297624. It was failing on the bots. llvm-svn: 297657
-rw-r--r--llvm/lib/Support/raw_ostream.cpp2
-rw-r--r--llvm/test/Other/writing-to-stdout.ll14
-rw-r--r--llvm/unittests/Support/raw_ostream_test.cpp8
3 files changed, 1 insertions, 23 deletions
diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp
index 5deab5d..d073802 100644
--- a/llvm/lib/Support/raw_ostream.cpp
+++ b/llvm/lib/Support/raw_ostream.cpp
@@ -473,7 +473,7 @@ static int getFD(StringRef Filename, std::error_code &EC,
// possible.
if (!(Flags & sys::fs::F_Text))
sys::ChangeStdoutToBinary();
- return dup(STDOUT_FILENO);
+ return STDOUT_FILENO;
}
int FD;
diff --git a/llvm/test/Other/writing-to-stdout.ll b/llvm/test/Other/writing-to-stdout.ll
deleted file mode 100644
index 701a687..0000000
--- a/llvm/test/Other/writing-to-stdout.ll
+++ /dev/null
@@ -1,14 +0,0 @@
-; Often LLVM tools use "-" to indicate that output should be written to stdout
-; instead of a file. This behaviour is implemented by the raw_fd_ostream class.
-; This test verifies that when doing so multiple times we don't try to access a
-; closed STDOUT_FILENO. The exact options used in this test are unimportant, as
-; long as they write to stdout using raw_fd_ostream.
-; RUN: llc %s -o=- -pass-remarks-output=- -filetype=asm | FileCheck %s
-; foobar should appear as a function somewhere in the assembly file.
-; CHECK: foobar
-; !Analysis appears at the start of pass-remarks-output.
-; CHECK: !Analysis
-
-define void @foobar() {
- ret void
-}
diff --git a/llvm/unittests/Support/raw_ostream_test.cpp b/llvm/unittests/Support/raw_ostream_test.cpp
index 777e555..f87d2f6 100644
--- a/llvm/unittests/Support/raw_ostream_test.cpp
+++ b/llvm/unittests/Support/raw_ostream_test.cpp
@@ -9,7 +9,6 @@
#include "gtest/gtest.h"
#include "llvm/ADT/SmallString.h"
-#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
@@ -331,11 +330,4 @@ TEST(raw_ostreamTest, FormattedHexBytes) {
"0007: 68 69 6a 6b 6c |hijkl|",
format_bytes_with_ascii_str(B.take_front(12), 0, 7, 1));
}
-
-TEST(raw_fd_ostreamTest, multiple_raw_fd_ostream_to_stdout) {
- std::error_code EC;
-
- { raw_fd_ostream("-", EC, sys::fs::OpenFlags::F_None); }
- { raw_fd_ostream("-", EC, sys::fs::OpenFlags::F_None); }
-}
}