diff options
author | Chris Lattner <sabre@nondot.org> | 2003-05-31 21:47:16 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-05-31 21:47:16 +0000 |
commit | 3ce0ea8fd8b6b02acc5828cbc90f113a3cf33207 (patch) | |
tree | c1320a5e4738e21153f4cd767f4448cd4fdacc59 /tools/llvm-as | |
parent | eea93839eb5cd5c3716df8a3d64fd6ce69db9893 (diff) | |
download | external_llvm-3ce0ea8fd8b6b02acc5828cbc90f113a3cf33207.zip external_llvm-3ce0ea8fd8b6b02acc5828cbc90f113a3cf33207.tar.gz external_llvm-3ce0ea8fd8b6b02acc5828cbc90f113a3cf33207.tar.bz2 |
Add support for: -o -
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6485 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-as')
-rw-r--r-- | tools/llvm-as/as.cpp | 18 | ||||
-rw-r--r-- | tools/llvm-as/llvm-as.cpp | 18 |
2 files changed, 22 insertions, 14 deletions
diff --git a/tools/llvm-as/as.cpp b/tools/llvm-as/as.cpp index d1f7406..5860542 100644 --- a/tools/llvm-as/as.cpp +++ b/tools/llvm-as/as.cpp @@ -53,14 +53,18 @@ int main(int argc, char **argv) { if (DumpAsm) std::cerr << "Here's the assembly:\n" << M.get(); 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; + if (OutputFilename != "-") { // Not stdout? + 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()); + } else { // Specified stdout + Out = &std::cout; } - Out = new std::ofstream(OutputFilename.c_str()); } else { if (InputFilename == "-") { OutputFilename = "-"; diff --git a/tools/llvm-as/llvm-as.cpp b/tools/llvm-as/llvm-as.cpp index d1f7406..5860542 100644 --- a/tools/llvm-as/llvm-as.cpp +++ b/tools/llvm-as/llvm-as.cpp @@ -53,14 +53,18 @@ int main(int argc, char **argv) { if (DumpAsm) std::cerr << "Here's the assembly:\n" << M.get(); 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; + if (OutputFilename != "-") { // Not stdout? + 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()); + } else { // Specified stdout + Out = &std::cout; } - Out = new std::ofstream(OutputFilename.c_str()); } else { if (InputFilename == "-") { OutputFilename = "-"; |