Add -output-prefix option to bugpoint (to change the default output name).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81154 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp
index 5afb220..9f712e0 100644
--- a/tools/bugpoint/OptimizerDriver.cpp
+++ b/tools/bugpoint/OptimizerDriver.cpp
@@ -37,6 +37,9 @@
 #include <fstream>
 using namespace llvm;
 
+namespace llvm {
+  extern cl::opt<std::string> OutputPrefix;
+}
 
 namespace {
   // ChildOutput - This option captures the name of the child output file that
@@ -68,7 +71,7 @@
   // Output the input to the current pass to a bitcode file, emit a message
   // telling the user how to reproduce it: opt -foo blah.bc
   //
-  std::string Filename = "bugpoint-" + ID + ".bc";
+  std::string Filename = OutputPrefix + "-" + ID + ".bc";
   if (writeProgramToFile(Filename)) {
     errs() <<  "Error opening file '" << Filename << "' for writing!\n";
     return;
@@ -129,7 +132,7 @@
                           const char * const *ExtraArgs) const {
   // setup the output file name
   outs().flush();
-  sys::Path uniqueFilename("bugpoint-output.bc");
+  sys::Path uniqueFilename(OutputPrefix + "-output.bc");
   std::string ErrMsg;
   if (uniqueFilename.makeUnique(true, &ErrMsg)) {
     errs() << getToolName() << ": Error making unique filename: "
@@ -139,7 +142,7 @@
   OutputFilename = uniqueFilename.str();
 
   // set up the input file name
-  sys::Path inputFilename("bugpoint-input.bc");
+  sys::Path inputFilename(OutputPrefix + "-input.bc");
   if (inputFilename.makeUnique(true, &ErrMsg)) {
     errs() << getToolName() << ": Error making unique filename: "
            << ErrMsg << "\n";