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-prof | |
parent | b29b20e7deb7297f6a10b2d6922feeca8c6df055 (diff) | |
download | external_llvm-3ff9563c3e391954b2e224afcf8b2b0fcc3888aa.zip external_llvm-3ff9563c3e391954b2e224afcf8b2b0fcc3888aa.tar.gz external_llvm-3ff9563c3e391954b2e224afcf8b2b0fcc3888aa.tar.bz2 |
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-prof')
-rw-r--r-- | tools/llvm-prof/llvm-prof.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/llvm-prof/llvm-prof.cpp b/tools/llvm-prof/llvm-prof.cpp index aa9cf00..9d0b468 100644 --- a/tools/llvm-prof/llvm-prof.cpp +++ b/tools/llvm-prof/llvm-prof.cpp @@ -264,11 +264,11 @@ int main(int argc, char **argv) { // Read in the bitcode file... std::string ErrorMessage; + OwningPtr<MemoryBuffer> Buffer; error_code ec; Module *M = 0; - if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(BitcodeFile, ec)) { - M = ParseBitcodeFile(Buffer, Context, &ErrorMessage); - delete Buffer; + if (!(ec = MemoryBuffer::getFileOrSTDIN(BitcodeFile, Buffer))) { + M = ParseBitcodeFile(Buffer.get(), Context, &ErrorMessage); } else ErrorMessage = ec.message(); if (M == 0) { |