mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
Fix the Linker testcase regressions, by making MemoryBuffer::getFileOrSTDIN return
a valid but empty buffer if stdin is empty. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44219 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4ce0df6108
commit
2b1f1066ac
@ -88,14 +88,11 @@ public:
|
|||||||
|
|
||||||
/// getFileOrSTDIN - Open the specified file as a MemoryBuffer, or open stdin
|
/// getFileOrSTDIN - Open the specified file as a MemoryBuffer, or open stdin
|
||||||
/// if the Filename is "-". If an error occurs, this returns null and fills
|
/// if the Filename is "-". If an error occurs, this returns null and fills
|
||||||
/// in *ErrStr with a reason.
|
/// in *ErrStr with a reason. If stdin is empty, this API (unlike getSTDIN)
|
||||||
|
/// returns an empty buffer.
|
||||||
static MemoryBuffer *getFileOrSTDIN(const char *FilenameStart,unsigned FnSize,
|
static MemoryBuffer *getFileOrSTDIN(const char *FilenameStart,unsigned FnSize,
|
||||||
std::string *ErrStr = 0,
|
std::string *ErrStr = 0,
|
||||||
int64_t FileSize = -1) {
|
int64_t FileSize = -1);
|
||||||
if (FnSize == 1 && FilenameStart[0] == '-')
|
|
||||||
return getSTDIN();
|
|
||||||
return getFile(FilenameStart, FnSize, ErrStr, FileSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// getFileOrSTDIN - Open the specified file as a MemoryBuffer, or open stdin
|
/// getFileOrSTDIN - Open the specified file as a MemoryBuffer, or open stdin
|
||||||
/// if the Filename is "-". If an error occurs, this returns null and fills
|
/// if the Filename is "-". If an error occurs, this returns null and fills
|
||||||
|
@ -117,6 +117,24 @@ MemoryBuffer *MemoryBuffer::getNewMemBuffer(unsigned Size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// 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.
|
||||||
|
MemoryBuffer *MemoryBuffer::getFileOrSTDIN(const char *FilenameStart,
|
||||||
|
unsigned FnSize,
|
||||||
|
std::string *ErrStr,
|
||||||
|
int64_t FileSize) {
|
||||||
|
if (FnSize != 1 || FilenameStart[0] != '-')
|
||||||
|
return getFile(FilenameStart, FnSize, ErrStr, FileSize);
|
||||||
|
MemoryBuffer *M = getSTDIN();
|
||||||
|
if (M) return M;
|
||||||
|
|
||||||
|
// If stdin was empty, M is null. Cons up an empty memory buffer now.
|
||||||
|
const char *EmptyStr = "";
|
||||||
|
return MemoryBuffer::getMemBuffer(EmptyStr, EmptyStr, "<stdin>");
|
||||||
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// MemoryBufferMMapFile implementation.
|
// MemoryBufferMMapFile implementation.
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
Loading…
Reference in New Issue
Block a user