[llvm] r297657 - Revert "Fix crash when multiple raw_fd_ostreams to stdout are created."

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 13 12:38:32 PDT 2017


Author: rafael
Date: Mon Mar 13 14:38:32 2017
New Revision: 297657

URL: http://llvm.org/viewvc/llvm-project?rev=297657&view=rev
Log:
Revert "Fix crash when multiple raw_fd_ostreams to stdout are created."

This reverts commit r297624.
It was failing on the bots.

Removed:
    llvm/trunk/test/Other/writing-to-stdout.ll
Modified:
    llvm/trunk/lib/Support/raw_ostream.cpp
    llvm/trunk/unittests/Support/raw_ostream_test.cpp

Modified: llvm/trunk/lib/Support/raw_ostream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=297657&r1=297656&r2=297657&view=diff
==============================================================================
--- llvm/trunk/lib/Support/raw_ostream.cpp (original)
+++ llvm/trunk/lib/Support/raw_ostream.cpp Mon Mar 13 14:38:32 2017
@@ -473,7 +473,7 @@ static int getFD(StringRef Filename, std
     // possible.
     if (!(Flags & sys::fs::F_Text))
       sys::ChangeStdoutToBinary();
-    return dup(STDOUT_FILENO);
+    return STDOUT_FILENO;
   }
 
   int FD;

Removed: llvm/trunk/test/Other/writing-to-stdout.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/writing-to-stdout.ll?rev=297656&view=auto
==============================================================================
--- llvm/trunk/test/Other/writing-to-stdout.ll (original)
+++ llvm/trunk/test/Other/writing-to-stdout.ll (removed)
@@ -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
-}

Modified: llvm/trunk/unittests/Support/raw_ostream_test.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/raw_ostream_test.cpp?rev=297657&r1=297656&r2=297657&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/raw_ostream_test.cpp (original)
+++ llvm/trunk/unittests/Support/raw_ostream_test.cpp Mon Mar 13 14:38:32 2017
@@ -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); }
-}
 }




More information about the llvm-commits mailing list