mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-25 21:18:19 +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:
@@ -160,14 +160,17 @@ bool Linker::LinkInFile(const sys::Path &File, bool &is_native) {
|
||||
// Check for a file of name "-", which means "read standard input"
|
||||
if (File.str() == "-") {
|
||||
std::auto_ptr<Module> M;
|
||||
if (MemoryBuffer *Buffer = MemoryBuffer::getSTDIN()) {
|
||||
MemoryBuffer *Buffer = MemoryBuffer::getSTDIN();
|
||||
if (!Buffer->getBufferSize()) {
|
||||
delete Buffer;
|
||||
Error = "standard input is empty";
|
||||
} else {
|
||||
M.reset(ParseBitcodeFile(Buffer, Context, &Error));
|
||||
delete Buffer;
|
||||
if (M.get())
|
||||
if (!LinkInModule(M.get(), &Error))
|
||||
return false;
|
||||
} else
|
||||
Error = "standard input is empty";
|
||||
}
|
||||
return error("Cannot link stdin: " + Error);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user