[llvm-commits] [llvm] r121387 - in /llvm/trunk/tools/lto: LTOCodeGenerator.cpp LTOModule.cpp

Michael J. Spencer bigcheesegs at gmail.com
Thu Dec 9 10:06:07 PST 2010


Author: mspencer
Date: Thu Dec  9 12:06:07 2010
New Revision: 121387

URL: http://llvm.org/viewvc/llvm-project?rev=121387&view=rev
Log:
More code not compiled by CMake. :(.

Modified:
    llvm/trunk/tools/lto/LTOCodeGenerator.cpp
    llvm/trunk/tools/lto/LTOModule.cpp

Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=121387&r1=121386&r2=121387&view=diff
==============================================================================
--- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original)
+++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Thu Dec  9 12:06:07 2010
@@ -43,6 +43,7 @@
 #include "llvm/Support/Host.h"
 #include "llvm/Support/Program.h"
 #include "llvm/Support/Signals.h"
+#include "llvm/Support/system_error.h"
 #include "llvm/Config/config.h"
 #include <cstdlib>
 #include <unistd.h>
@@ -221,9 +222,12 @@
     if ( !asmResult ) {
         // remove old buffer if compile() called twice
         delete _nativeObjectFile;
-        
+
         // read .o file into memory buffer
-        _nativeObjectFile = MemoryBuffer::getFile(uniqueObjStr.c_str(),&errMsg);
+        error_code ec;
+        _nativeObjectFile = MemoryBuffer::getFile(uniqueObjStr.c_str(), ec);
+        if (ec)
+          errMsg = ec.message();
     }
 
     // remove temp files

Modified: llvm/trunk/tools/lto/LTOModule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOModule.cpp?rev=121387&r1=121386&r2=121387&view=diff
==============================================================================
--- llvm/trunk/tools/lto/LTOModule.cpp (original)
+++ llvm/trunk/tools/lto/LTOModule.cpp Thu Dec  9 12:06:07 2010
@@ -26,6 +26,7 @@
 #include "llvm/Support/Host.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Process.h"
+#include "llvm/Support/system_error.h"
 #include "llvm/Target/Mangler.h"
 #include "llvm/Target/SubtargetFeature.h"
 #include "llvm/MC/MCAsmInfo.h"
@@ -56,7 +57,8 @@
 
 bool LTOModule::isBitcodeFileForTarget(const char *path,
                                        const char *triplePrefix) {
-  MemoryBuffer *buffer = MemoryBuffer::getFile(path);
+  error_code ec;
+  MemoryBuffer *buffer = MemoryBuffer::getFile(path, ec);
   if (buffer == NULL)
     return false;
   return isTargetMatch(buffer, triplePrefix);
@@ -78,9 +80,12 @@
 
 LTOModule *LTOModule::makeLTOModule(const char *path,
                                     std::string &errMsg) {
-  OwningPtr<MemoryBuffer> buffer(MemoryBuffer::getFile(path, &errMsg));
-  if (!buffer)
+  error_code ec;
+  OwningPtr<MemoryBuffer> buffer(MemoryBuffer::getFile(path, ec));
+  if (!buffer) {
+    errMsg = ec.message();
     return NULL;
+  }
   return makeLTOModule(buffer.get(), errMsg);
 }
 





More information about the llvm-commits mailing list