Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with error_code &ec. And fix clients.
llvm-svn: 121379
diff --git a/llvm/lib/Linker/LinkItems.cpp b/llvm/lib/Linker/LinkItems.cpp
index cbbdd4b..7716b61 100644
--- a/llvm/lib/Linker/LinkItems.cpp
+++ b/llvm/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 @@
// 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 @@
return false;
}
}
- return error("Cannot link stdin: " + Error);
+ return error("Cannot link stdin: " + ec.message());
}
// Determine what variety of file it is.