aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Support/MemoryBuffer.h
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-11-10 00:43:58 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-11-10 00:43:58 +0000
commitd65267ee625bb9cf8dc655a0c0409760e2b76c71 (patch)
tree50e8a65a2608845d4b1ea618b68a672d452fb725 /include/llvm/Support/MemoryBuffer.h
parent0855dee564f80160abf95497475306af38ab7f84 (diff)
downloadexternal_llvm-d65267ee625bb9cf8dc655a0c0409760e2b76c71.zip
external_llvm-d65267ee625bb9cf8dc655a0c0409760e2b76c71.tar.gz
external_llvm-d65267ee625bb9cf8dc655a0c0409760e2b76c71.tar.bz2
Fix MemoryBuffer::getSTDIN to *not* return null if stdin is empty, this is a lame API.
Also, Stringrefify some more MemoryBuffer functions, and add two performance FIXMEs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86630 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/MemoryBuffer.h')
-rw-r--r--include/llvm/Support/MemoryBuffer.h21
1 files changed, 5 insertions, 16 deletions
diff --git a/include/llvm/Support/MemoryBuffer.h b/include/llvm/Support/MemoryBuffer.h
index f9a4d6d..95d0d3d 100644
--- a/include/llvm/Support/MemoryBuffer.h
+++ b/include/llvm/Support/MemoryBuffer.h
@@ -57,7 +57,7 @@ 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(const char *Filename,
+ static MemoryBuffer *getFile(StringRef Filename,
std::string *ErrStr = 0,
int64_t FileSize = -1);
@@ -84,29 +84,18 @@ public:
/// memory allocated by this method. The memory is owned by the MemoryBuffer
/// object.
static MemoryBuffer *getNewUninitMemBuffer(size_t Size,
- const char *BufferName = "");
+ StringRef BufferName = "");
- /// getSTDIN - Read all of stdin into a file buffer, and return it. This
- /// returns null if stdin is empty.
+ /// getSTDIN - Read all of stdin into a file buffer, and return it.
static MemoryBuffer *getSTDIN();
/// getFileOrSTDIN - Open the specified file as a MemoryBuffer, or open stdin
/// if the Filename is "-". If an error occurs, this returns null and fills
- /// in *ErrStr with a reason. If stdin is empty, this API (unlike getSTDIN)
- /// returns an empty buffer.
- static MemoryBuffer *getFileOrSTDIN(const char *Filename,
- std::string *ErrStr = 0,
- int64_t FileSize = -1);
-
- /// getFileOrSTDIN - Open the specified file as a MemoryBuffer, or open stdin
- /// if the Filename is "-". If an error occurs, this returns null and fills
/// in *ErrStr with a reason.
- static MemoryBuffer *getFileOrSTDIN(const std::string &FN,
+ static MemoryBuffer *getFileOrSTDIN(StringRef Filename,
std::string *ErrStr = 0,
- int64_t FileSize = -1) {
- return getFileOrSTDIN(FN.c_str(), ErrStr, FileSize);
- }
+ int64_t FileSize = -1);
};
} // end namespace llvm