llvm.org GIT mirror llvm / 5682e3e
Revert "Fix crash when multiple raw_fd_ostreams to stdout are created." 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 Rafael Espindola 3 years ago
3 changed file(s) with 2 addition(s) and 24 deletion(s). Raw diff Collapse all Expand all
472472 // possible.
473473 if (!(Flags & sys::fs::F_Text))
474474 sys::ChangeStdoutToBinary();
475 return dup(STDOUT_FILENO);
475 return STDOUT_FILENO;
476476 }
477477
478478 int FD;
+0
-14
test/Other/writing-to-stdout.ll less more
None ; Often LLVM tools use "-" to indicate that output should be written to stdout
1 ; instead of a file. This behaviour is implemented by the raw_fd_ostream class.
2 ; This test verifies that when doing so multiple times we don't try to access a
3 ; closed STDOUT_FILENO. The exact options used in this test are unimportant, as
4 ; long as they write to stdout using raw_fd_ostream.
5 ; RUN: llc %s -o=- -pass-remarks-output=- -filetype=asm | FileCheck %s
6 ; foobar should appear as a function somewhere in the assembly file.
7 ; CHECK: foobar
8 ; !Analysis appears at the start of pass-remarks-output.
9 ; CHECK: !Analysis
10
11 define void @foobar() {
12 ret void
13 }
88
99 #include "gtest/gtest.h"
1010 #include "llvm/ADT/SmallString.h"
11 #include "llvm/Support/FileSystem.h"
1211 #include "llvm/Support/Format.h"
1312 #include "llvm/Support/raw_ostream.h"
1413
330329 "0007: 68 69 6a 6b 6c |hijkl|",
331330 format_bytes_with_ascii_str(B.take_front(12), 0, 7, 1));
332331 }
333
334 TEST(raw_fd_ostreamTest, multiple_raw_fd_ostream_to_stdout) {
335 std::error_code EC;
336
337 { raw_fd_ostream("-", EC, sys::fs::OpenFlags::F_None); }
338 { raw_fd_ostream("-", EC, sys::fs::OpenFlags::F_None); }
339 }
340 }
332 }