]> granicus.if.org Git - llvm/commitdiff
Revert "Fix crash when multiple raw_fd_ostreams to stdout are created."
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 13 Mar 2017 19:38:32 +0000 (19:38 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 13 Mar 2017 19:38:32 +0000 (19:38 +0000)
This reverts commit r297624.
It was failing on the bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297657 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/raw_ostream.cpp
test/Other/writing-to-stdout.ll [deleted file]
unittests/Support/raw_ostream_test.cpp

index 5deab5de4f6a583f60bc81511b093cb15c56df56..d073802db932095b308a89707a1157bf77b7fa5f 100644 (file)
@@ -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/test/Other/writing-to-stdout.ll b/test/Other/writing-to-stdout.ll
deleted file mode 100644 (file)
index 701a687..0000000
+++ /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
-}
index 777e555949eedb2047c7509903f18a79b6e6c5fe..f87d2f60d169e855a4c6cd73420306dfbcf6ba23 100644 (file)
@@ -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); }
-}
 }