1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

opening "-" automatically yields stdout.

llvm-svn: 54863
This commit is contained in:
Chris Lattner 2008-08-17 03:53:23 +00:00
parent eef022091c
commit c9c1d50446

View File

@ -34,6 +34,13 @@ void raw_ostream::handle() {}
/// information about the error is put into ErrorInfo, and the stream should
/// be immediately destroyed.
raw_fd_ostream::raw_fd_ostream(const char *Filename, std::string &ErrorInfo) {
// Handle "-" as stdout.
if (Filename[0] == '-' && Filename[1] == 0) {
FD = STDOUT_FILENO;
ShouldClose = false;
return;
}
FD = open(Filename, O_WRONLY|O_CREAT|O_TRUNC, 0644);
if (FD < 0) {
ErrorInfo = "Error opening output file '" + std::string(Filename) + "'";