[llvm-commits] CVS: llvm/tools/llc/llc.cpp

Brian Gaeke gaeke at cs.uiuc.edu
Wed Jun 18 16:44:05 PDT 2003


Changes in directory llvm/tools/llc:

llc.cpp updated: 1.75 -> 1.76

---
Log message:

tools/llc/llc.cpp: Make "-o -" work.


---
Diffs of the changes:

Index: llvm/tools/llc/llc.cpp
diff -u llvm/tools/llc/llc.cpp:1.75 llvm/tools/llc/llc.cpp:1.76
--- llvm/tools/llc/llc.cpp:1.75	Wed Jun 18 16:14:23 2003
+++ llvm/tools/llc/llc.cpp	Wed Jun 18 16:43:33 2003
@@ -118,19 +118,23 @@
   // 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 = "-";





More information about the llvm-commits mailing list