diff options
Diffstat (limited to 'lib/Linker')
-rw-r--r-- | lib/Linker/LinkItems.cpp | 6 | ||||
-rw-r--r-- | lib/Linker/Linker.cpp | 8 |
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/Linker/LinkItems.cpp b/lib/Linker/LinkItems.cpp index cbbdd4b..7716b61 100644 --- a/lib/Linker/LinkItems.cpp +++ b/lib/Linker/LinkItems.cpp @@ -18,6 +18,7 @@ #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,7 +161,8 @@ 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(&Error)) { + error_code ec; + if (MemoryBuffer *Buffer = MemoryBuffer::getSTDIN(ec)) { if (!Buffer->getBufferSize()) { delete Buffer; Error = "standard input is empty"; @@ -172,7 +174,7 @@ bool Linker::LinkInFile(const sys::Path &File, bool &is_native) { return false; } } - return error("Cannot link stdin: " + Error); + return error("Cannot link stdin: " + ec.message()); } // Determine what variety of file it is. diff --git a/lib/Linker/Linker.cpp b/lib/Linker/Linker.cpp index 6e27fda..9606d06 100644 --- a/lib/Linker/Linker.cpp +++ b/lib/Linker/Linker.cpp @@ -18,6 +18,7 @@ #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Config/config.h" +#include "llvm/Support/system_error.h" using namespace llvm; Linker::Linker(StringRef progname, StringRef modname, @@ -98,11 +99,14 @@ Linker::LoadObject(const sys::Path &FN) { std::string ParseErrorMessage; Module *Result = 0; - std::auto_ptr<MemoryBuffer> Buffer(MemoryBuffer::getFileOrSTDIN(FN.c_str())); + error_code ec; + std::auto_ptr<MemoryBuffer> Buffer( + MemoryBuffer::getFileOrSTDIN(FN.c_str(), ec)); if (Buffer.get()) Result = ParseBitcodeFile(Buffer.get(), Context, &ParseErrorMessage); else - ParseErrorMessage = "Error reading file '" + FN.str() + "'"; + ParseErrorMessage = "Error reading file '" + FN.str() + "'" + ": " + + ec.message(); if (Result) return std::auto_ptr<Module>(Result); |