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

Chris Lattner lattner at cs.uiuc.edu
Thu Apr 1 23:08:01 PST 2004


Changes in directory llvm/tools/opt:

opt.cpp updated: 1.88 -> 1.89

---
Log message:

Fix wonky header
Address PR305: http://llvm.cs.uiuc.edu/PR305 : LLVM tools will happily spew bytecode onto your terminal



---
Diffs of the changes:  (+14 -2)

Index: llvm/tools/opt/opt.cpp
diff -u llvm/tools/opt/opt.cpp:1.88 llvm/tools/opt/opt.cpp:1.89
--- llvm/tools/opt/opt.cpp:1.88	Thu Feb 19 14:32:08 2004
+++ llvm/tools/opt/opt.cpp	Thu Apr  1 23:06:57 2004
@@ -1,4 +1,4 @@
-//===----------------------------------------------------------------------===//
+//===- opt.cpp - The LLVM Modular Optimizer -------------------------------===//
 // 
 //                     The LLVM Compiler Infrastructure
 //
@@ -6,7 +6,6 @@
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
 // 
 //===----------------------------------------------------------------------===//
-// LLVM Modular Optimizer Utility: opt
 //
 // Optimizations may be specified an arbitrary number of times on the command
 // line, they are run in the order specified.
@@ -23,6 +22,7 @@
 #include "llvm/Target/TargetMachineImpls.h"
 #include "llvm/Support/PassNameParser.h"
 #include "Support/Signals.h"
+#include "Support/SystemUtils.h"
 #include <fstream>
 #include <memory>
 #include <algorithm>
@@ -112,6 +112,18 @@
     // Make sure that the Output file gets unlinked from the disk if we get a
     // SIGINT
     RemoveFileOnSignal(OutputFilename);
+  }
+
+  // If the output is set to be emitted to standard out, and standard out is a
+  // console, print out a warning message and refuse to do it.  We don't impress
+  // anyone by spewing tons of binary goo to a terminal.
+  if (Out == &std::cout && isStandardOutAConsole() && !Force && !NoOutput) {
+    std::cerr << "WARNING: It looks like you're attempting to print out a "
+              << "bytecode file.  I'm\ngoing to pretend you didn't ask me to do"
+              << " this (for your own good).  If you\nREALLY want to taste LLVM"
+              << " bytecode first hand, you can force output with the\n'-f'"
+              << " option.\n\n";
+    NoOutput = true;
   }
 
   // Create a PassManager to hold and optimize the collection of passes we are





More information about the llvm-commits mailing list