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 /include/llvm/Support/MemoryBuffer.h | |
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 'include/llvm/Support/MemoryBuffer.h')
-rw-r--r-- | include/llvm/Support/MemoryBuffer.h | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/include/llvm/Support/MemoryBuffer.h b/include/llvm/Support/MemoryBuffer.h index e33483c..fa19423 100644 --- a/include/llvm/Support/MemoryBuffer.h +++ b/include/llvm/Support/MemoryBuffer.h @@ -20,6 +20,7 @@ namespace llvm { class error_code; +template<class T> class OwningPtr; /// MemoryBuffer - This interface provides simple read-only access to a block /// of memory, and provides simple methods for reading files and standard input @@ -61,17 +62,18 @@ public: /// MemoryBuffer if successful, otherwise returning null. If FileSize is /// specified, this means that the client knows that the file exists and that /// it has the specified size. - static MemoryBuffer *getFile(StringRef Filename, error_code &ec, - int64_t FileSize = -1); - static MemoryBuffer *getFile(const char *Filename, error_code &ec, - int64_t FileSize = -1); + static error_code getFile(StringRef Filename, OwningPtr<MemoryBuffer> &result, + int64_t FileSize = -1); + static error_code getFile(const char *Filename, + OwningPtr<MemoryBuffer> &result, + int64_t FileSize = -1); /// getOpenFile - Given an already-open file descriptor, read the file and /// return a MemoryBuffer. This takes ownership of the descriptor, /// immediately closing it after reading the file. - static MemoryBuffer *getOpenFile(int FD, const char *Filename, - error_code &ec, - int64_t FileSize = -1); + static error_code getOpenFile(int FD, const char *Filename, + OwningPtr<MemoryBuffer> &result, + int64_t FileSize = -1); /// getMemBuffer - Open the specified memory range as a MemoryBuffer. Note /// that InputData must be null terminated. @@ -99,18 +101,18 @@ public: /// getSTDIN - Read all of stdin into a file buffer, and return it. /// If an error occurs, this returns null and sets ec. - static MemoryBuffer *getSTDIN(error_code &ec); + static error_code getSTDIN(OwningPtr<MemoryBuffer> &result); /// getFileOrSTDIN - Open the specified file as a MemoryBuffer, or open stdin /// if the Filename is "-". If an error occurs, this returns null and sets /// ec. - static MemoryBuffer *getFileOrSTDIN(StringRef Filename, - error_code &ec, - int64_t FileSize = -1); - static MemoryBuffer *getFileOrSTDIN(const char *Filename, - error_code &ec, - int64_t FileSize = -1); + static error_code getFileOrSTDIN(StringRef Filename, + OwningPtr<MemoryBuffer> &result, + int64_t FileSize = -1); + static error_code getFileOrSTDIN(const char *Filename, + OwningPtr<MemoryBuffer> &result, + int64_t FileSize = -1); }; } // end namespace llvm |