Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with error_code &ec...
[oota-llvm.git] / lib / Linker / LinkItems.cpp
index cbbdd4ba1013b86467a5a80f24fdfb55fbf5b641..7716b61a79456b118560e63d70b837c113c97709 100644 (file)
@@ -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.