summaryrefslogtreecommitdiff
path: root/tools/llvm-dis/llvm-dis.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-05-06 23:45:49 +0000
committerChris Lattner <sabre@nondot.org>2007-05-06 23:45:49 +0000
commit065344dfd5a7b3502098810b981eb0077e5d81f3 (patch)
tree6521b00f224a62ade1e796532e30c6cba5d36633 /tools/llvm-dis/llvm-dis.cpp
parent5499da88331a31a9dcc24dc160f58b411fb0d34a (diff)
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
Diffstat (limited to 'tools/llvm-dis/llvm-dis.cpp')
-rw-r--r--tools/llvm-dis/llvm-dis.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/tools/llvm-dis/llvm-dis.cpp b/tools/llvm-dis/llvm-dis.cpp
index 6321551446a..97ec4c73061 100644
--- a/tools/llvm-dis/llvm-dis.cpp
+++ b/tools/llvm-dis/llvm-dis.cpp
@@ -54,14 +54,11 @@ int main(int argc, char **argv) {
std::auto_ptr<Module> M;
- MemoryBuffer *Buffer
- = MemoryBuffer::getFileOrSTDIN(&InputFilename[0], InputFilename.size());
-
- if (Buffer == 0)
- ErrorMessage = "Error reading file '" + InputFilename + "'";
- else
+ if (MemoryBuffer *Buffer
+ = MemoryBuffer::getFileOrSTDIN(InputFilename, &ErrorMessage)) {
M.reset(ParseBitcodeFile(Buffer, &ErrorMessage));
- delete Buffer;
+ delete Buffer;
+ }
if (M.get() == 0) {
cerr << argv[0] << ": ";