mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
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
This commit is contained in:
@@ -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,
|
||||
/// in *ErrStr with a reason.
|
||||
static MemoryBuffer *getFileOrSTDIN(StringRef 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,
|
||||
std::string *ErrStr = 0,
|
||||
int64_t FileSize = -1) {
|
||||
return getFileOrSTDIN(FN.c_str(), ErrStr, FileSize);
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
Reference in New Issue
Block a user