aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2010-12-16 03:29:14 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2010-12-16 03:29:14 +0000
commit3ff9563c3e391954b2e224afcf8b2b0fcc3888aa (patch)
treecccde9111a73ba5895f6cefbfb280290fa6c469d /lib/VMCore
parentb29b20e7deb7297f6a10b2d6922feeca8c6df055 (diff)
downloadexternal_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.cpp10
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;
}