Give verbose error messages if bytecode file cannot be parsed


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5789 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index 803f4c6..6633dd1 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -76,11 +76,16 @@
   std::auto_ptr<TargetMachine> target;
 
   TargetMachine* TM = NULL;
+  std::string ErrorMessage;
 
   // Load the input module...
-  std::auto_ptr<Module> M(ParseBytecodeFile(InputFilename));
+  std::auto_ptr<Module> M(ParseBytecodeFile(InputFilename, &ErrorMessage));
   if (M.get() == 0) {
-    cerr << argv[0] << ": bytecode didn't read correctly.\n";
+    cerr << argv[0] << ": ";
+    if (ErrorMessage.size())
+      cerr << ErrorMessage << "\n";
+    else
+      cerr << "bytecode didn't read correctly.\n";
     return 1;
   }