summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-as/llvm-as.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-05-31 21:47:16 +0000
committerChris Lattner <sabre@nondot.org>2003-05-31 21:47:16 +0000
commit306f8b49340af7319b7d5e6ddb0835c9e3d86300 (patch)
tree6aa746df08cbd0aba771064fdd20d0db8284b9b1 /llvm/tools/llvm-as/llvm-as.cpp
parenta71b979201a1680b6bbb0aace3bfe8824895f9ef (diff)
downloadbcm5719-llvm-306f8b49340af7319b7d5e6ddb0835c9e3d86300.tar.gz
bcm5719-llvm-306f8b49340af7319b7d5e6ddb0835c9e3d86300.zip
Add support for: -o -
llvm-svn: 6485
Diffstat (limited to 'llvm/tools/llvm-as/llvm-as.cpp')
-rw-r--r--llvm/tools/llvm-as/llvm-as.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/llvm/tools/llvm-as/llvm-as.cpp b/llvm/tools/llvm-as/llvm-as.cpp
index d1f7406dff3..58605420200 100644
--- a/llvm/tools/llvm-as/llvm-as.cpp
+++ b/llvm/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 = "-";
OpenPOWER on IntegriCloud