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/lli/lli.cpp b/tools/lli/lli.cpp
index a1caf11..fdb5f4a 100644
--- a/tools/lli/lli.cpp
+++ b/tools/lli/lli.cpp
@@ -77,11 +77,7 @@
   // Load the bytecode...
   std::string ErrorMsg;
   ModuleProvider *MP = 0;
-  MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(&InputFile[0],
-                                                      InputFile.size());
-  if (Buffer == 0)
-    ErrorMsg = "Error reading file '" + InputFile + "'";
-  else {
+  if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(InputFile,&ErrorMsg)){
     MP = getBitcodeModuleProvider(Buffer, &ErrorMsg);
     if (!MP) delete Buffer;
   }