From 5ce1a585df6749b168be4bc9b719b1abdfc98207 Mon Sep 17 00:00:00 2001 From: Brian Gaeke Date: Wed, 18 Jun 2003 21:43:33 +0000 Subject: [PATCH] tools/llc/llc.cpp: Make "-o -" work. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6780 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llc/llc.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp index 636779f56d4..d3bb7ee3dc6 100644 --- a/tools/llc/llc.cpp +++ b/tools/llc/llc.cpp @@ -118,19 +118,23 @@ main(int argc, char **argv) // Figure out where we are going to send the output... std::ostream *Out = 0; if (OutputFilename != "") { - // Specified an output filename? - if (!Force && std::ifstream(OutputFilename.c_str())) { - // If force is not specified, make sure not to overwrite a file! - std::cerr << argv[0] << ": error opening '" << OutputFilename - << "': file exists!\n" - << "Use -f command line argument to force output\n"; - return 1; - } - Out = new std::ofstream(OutputFilename.c_str()); + if (OutputFilename != "-") { + // Specified an output filename? + if (!Force && std::ifstream(OutputFilename.c_str())) { + // If force is not specified, make sure not to overwrite a file! + std::cerr << argv[0] << ": error opening '" << OutputFilename + << "': file exists!\n" + << "Use -f command line argument to force output\n"; + return 1; + } + Out = new std::ofstream(OutputFilename.c_str()); - // Make sure that the Out file gets unlink'd from the disk if we get a - // SIGINT - RemoveFileOnSignal(OutputFilename); + // Make sure that the Out file gets unlink'd from the disk if we get a + // SIGINT + RemoveFileOnSignal(OutputFilename); + } else { + Out = &std::cout; + } } else { if (InputFilename == "-") { OutputFilename = "-";