diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-12-16 03:29:14 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-12-16 03:29:14 +0000 |
commit | 3ff9563c3e391954b2e224afcf8b2b0fcc3888aa (patch) | |
tree | cccde9111a73ba5895f6cefbfb280290fa6c469d /tools/llvm-dis | |
parent | b29b20e7deb7297f6a10b2d6922feeca8c6df055 (diff) |
MemoryBuffer now return an error_code and returns a OwningPtr<MemoryBuffer> via an out parm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121958 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-dis')
-rw-r--r-- | tools/llvm-dis/llvm-dis.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/llvm-dis/llvm-dis.cpp b/tools/llvm-dis/llvm-dis.cpp index 781bca95ea..7a72cec753 100644 --- a/tools/llvm-dis/llvm-dis.cpp +++ b/tools/llvm-dis/llvm-dis.cpp @@ -81,12 +81,13 @@ int main(int argc, char **argv) { std::string ErrorMessage; error_code ec; std::auto_ptr<Module> M; + OwningPtr<MemoryBuffer> BufferPtr; - if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(InputFilename, ec)) { - M.reset(ParseBitcodeFile(Buffer, Context, &ErrorMessage)); - delete Buffer; - } else + if (ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr)) ErrorMessage = ec.message(); + else + M.reset(ParseBitcodeFile(BufferPtr.get(), Context, &ErrorMessage)); + MemoryBuffer *Buffer = BufferPtr.take(); if (M.get() == 0) { errs() << argv[0] << ": "; |