From cbb70ce070d220642b038ea101d9c0f9fbf860d6 Mon Sep 17 00:00:00 2001 From: dim Date: Sun, 20 Feb 2011 12:57:14 +0000 Subject: Vendor import of llvm trunk r126079: http://llvm.org/svn/llvm-project/llvm/trunk@126079 --- lib/Linker/LinkItems.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib/Linker/LinkItems.cpp') diff --git a/lib/Linker/LinkItems.cpp b/lib/Linker/LinkItems.cpp index 1be2bec..52a0d17 100644 --- a/lib/Linker/LinkItems.cpp +++ b/lib/Linker/LinkItems.cpp @@ -15,9 +15,10 @@ #include "llvm/Linker.h" #include "llvm/Module.h" #include "llvm/Bitcode/ReaderWriter.h" -#include "llvm/System/Path.h" +#include "llvm/Support/Path.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MemoryBuffer.h" +#include "llvm/Support/system_error.h" using namespace llvm; // LinkItems - This function is the main entry point into linking. It takes a @@ -160,19 +161,19 @@ 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 M; - if (MemoryBuffer *Buffer = MemoryBuffer::getSTDIN(&Error)) { + OwningPtr Buffer; + error_code ec; + if (!(ec = MemoryBuffer::getSTDIN(Buffer))) { if (!Buffer->getBufferSize()) { - delete Buffer; Error = "standard input is empty"; } else { - M.reset(ParseBitcodeFile(Buffer, Context, &Error)); - delete Buffer; + M.reset(ParseBitcodeFile(Buffer.get(), Context, &Error)); if (M.get()) if (!LinkInModule(M.get(), &Error)) return false; } } - return error("Cannot link stdin: " + Error); + return error("Cannot link stdin: " + ec.message()); } // Determine what variety of file it is. -- cgit v1.1