use the new MemoryBuffer interfaces to simplify error reporting in clients.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36900 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/bugpoint/BugDriver.cpp b/tools/bugpoint/BugDriver.cpp
index 00dfc32..7ce1e68 100644
--- a/tools/bugpoint/BugDriver.cpp
+++ b/tools/bugpoint/BugDriver.cpp
@@ -72,18 +72,18 @@
 /// ParseInputFile - Given a bytecode or assembly input filename, parse and
 /// return it, or return null if not possible.
 ///
-Module *llvm::ParseInputFile(const std::string &InputFilename) {
-  std::auto_ptr<MemoryBuffer> Buffer(
-       MemoryBuffer::getFileOrSTDIN(&InputFilename[0], InputFilename.size()));
+Module *llvm::ParseInputFile(const std::string &Filename) {
+  std::auto_ptr<MemoryBuffer> Buffer(MemoryBuffer::getFileOrSTDIN(Filename));
   Module *Result = 0;
   if (Buffer.get())
     Result = ParseBitcodeFile(Buffer.get());
   
   ParseError Err;
-  if (!Result && !(Result = ParseAssemblyFile(InputFilename,&Err))) {
+  if (!Result && !(Result = ParseAssemblyFile(Filename, &Err))) {
     std::cerr << "bugpoint: " << Err.getMessage() << "\n"; 
     Result = 0;
   }
+  
   return Result;
 }
 
@@ -100,6 +100,7 @@
     // Load the first input file.
     Program = ParseInputFile(Filenames[0]);
     if (Program == 0) return true;
+    
     if (!run_as_child)
       std::cout << "Read input file      : '" << Filenames[0] << "'\n";