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 /lib/VMCore | |
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 'lib/VMCore')
-rw-r--r-- | lib/VMCore/Core.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp index a4c77a2..6bad2f3 100644 --- a/lib/VMCore/Core.cpp +++ b/lib/VMCore/Core.cpp @@ -2221,9 +2221,10 @@ LLVMBool LLVMCreateMemoryBufferWithContentsOfFile( LLVMMemoryBufferRef *OutMemBuf, char **OutMessage) { + OwningPtr<MemoryBuffer> MB; error_code ec; - if (MemoryBuffer *MB = MemoryBuffer::getFile(Path, ec)) { - *OutMemBuf = wrap(MB); + if (!(ec = MemoryBuffer::getFile(Path, MB))) { + *OutMemBuf = wrap(MB.take()); return 0; } @@ -2233,9 +2234,10 @@ LLVMBool LLVMCreateMemoryBufferWithContentsOfFile( LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf, char **OutMessage) { + OwningPtr<MemoryBuffer> MB; error_code ec; - if (MemoryBuffer *MB = MemoryBuffer::getSTDIN(ec)) { - *OutMemBuf = wrap(MB); + if (!(ec = MemoryBuffer::getSTDIN(MB))) { + *OutMemBuf = wrap(MB.take()); return 0; } |