diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-12-09 17:36:48 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-12-09 17:36:48 +0000 |
commit | 333fb04506233255f10d8095c9e2de5e5f0fdc6f (patch) | |
tree | 29b15348801de3482b07a438b1fb1f2ba094d3d2 /lib/VMCore/Core.cpp | |
parent | 908b6ddad6dac40c4c0453d690f0db9422b48b10 (diff) | |
download | llvm-333fb04506233255f10d8095c9e2de5e5f0fdc6f.tar.gz llvm-333fb04506233255f10d8095c9e2de5e5f0fdc6f.tar.bz2 llvm-333fb04506233255f10d8095c9e2de5e5f0fdc6f.tar.xz |
Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with error_code &ec. And fix clients.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121379 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Core.cpp')
-rw-r--r-- | lib/VMCore/Core.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp index 858f49cdf5..a4c77a2670 100644 --- a/lib/VMCore/Core.cpp +++ b/lib/VMCore/Core.cpp @@ -28,6 +28,7 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Support/system_error.h" #include <cassert> #include <cstdlib> #include <cstring> @@ -2220,25 +2221,25 @@ LLVMBool LLVMCreateMemoryBufferWithContentsOfFile( LLVMMemoryBufferRef *OutMemBuf, char **OutMessage) { - std::string Error; - if (MemoryBuffer *MB = MemoryBuffer::getFile(Path, &Error)) { + error_code ec; + if (MemoryBuffer *MB = MemoryBuffer::getFile(Path, ec)) { *OutMemBuf = wrap(MB); return 0; } - - *OutMessage = strdup(Error.c_str()); + + *OutMessage = strdup(ec.message().c_str()); return 1; } LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf, char **OutMessage) { - std::string Error; - if (MemoryBuffer *MB = MemoryBuffer::getSTDIN(&Error)) { + error_code ec; + if (MemoryBuffer *MB = MemoryBuffer::getSTDIN(ec)) { *OutMemBuf = wrap(MB); return 0; } - *OutMessage = strdup(Error.c_str()); + *OutMessage = strdup(ec.message().c_str()); return 1; } |