Refactor and clean up a bunch more code.  No major functionality changes.
 * Make several methods of bugdriver global functions (ParseInputFile, PrintFunctionList)
 * Make PrintFunctionList truncate the output after 10 entries, like the crash debugger
   did.  This allows code sharing.
 * Add a couple of methods to BugDriver that allows us to eliminate some friends
 * Improve comments in ExtractFunction.cpp
 * Make classes that used to be friends up bugdriver now live in anon namespaces
 * Rip a bunch of functionality in the miscompilation tester into a new
   TestMergedProgram function for future code sharing.
 * Fix a bug in the miscompilation tester induced in my last checkin


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12393 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/bugpoint/BugDriver.cpp b/tools/bugpoint/BugDriver.cpp
index 2c5cf24..aca03fc 100644
--- a/tools/bugpoint/BugDriver.cpp
+++ b/tools/bugpoint/BugDriver.cpp
@@ -68,16 +68,16 @@
 /// ParseInputFile - Given a bytecode or assembly input filename, parse and
 /// return it, or return null if not possible.
 ///
-Module *BugDriver::ParseInputFile(const std::string &InputFilename) const {
+Module *llvm::ParseInputFile(const std::string &InputFilename) {
   Module *Result = 0;
   try {
     Result = ParseBytecodeFile(InputFilename);
     if (!Result && !(Result = ParseAssemblyFile(InputFilename))){
-      std::cerr << ToolName << ": could not read input file '"
+      std::cerr << "bugpoint: could not read input file '"
                 << InputFilename << "'!\n";
     }
   } catch (const ParseException &E) {
-    std::cerr << ToolName << ": " << E.getMessage() << "\n";
+    std::cerr << "bugpoint: " << E.getMessage() << "\n";
     Result = 0;
   }
   return Result;
@@ -199,11 +199,12 @@
   }
 }
 
-void BugDriver::PrintFunctionList(const std::vector<Function*> &Funcs) {
-  for (unsigned i = 0, e = Funcs.size(); i != e; ++i) {
-    if (i) std::cout << ", ";
-    std::cout << Funcs[i]->getName();
-  }
+void llvm::PrintFunctionList(const std::vector<Function*> &Funcs) {
+  unsigned NumPrint = Funcs.size();
+  if (NumPrint > 10) NumPrint = 10;
+  for (unsigned i = 0; i != NumPrint; ++i)
+    std::cout << " " << Funcs[i]->getName();
+  if (NumPrint < Funcs.size())
+    std::cout << "... <" << Funcs.size() << " total>";
   std::cout << std::flush;
 }
-