diff options
author | dim <dim@FreeBSD.org> | 2011-02-20 12:57:14 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-02-20 12:57:14 +0000 |
commit | cbb70ce070d220642b038ea101d9c0f9fbf860d6 (patch) | |
tree | d2b61ce94e654cb01a254d2195259db5f9cc3f3c /lib/Linker/Linker.cpp | |
parent | 4ace901e87dac5bbbac78ed325e75462e48e386e (diff) | |
download | FreeBSD-src-cbb70ce070d220642b038ea101d9c0f9fbf860d6.zip FreeBSD-src-cbb70ce070d220642b038ea101d9c0f9fbf860d6.tar.gz |
Vendor import of llvm trunk r126079:
http://llvm.org/svn/llvm-project/llvm/trunk@126079
Diffstat (limited to 'lib/Linker/Linker.cpp')
-rw-r--r-- | lib/Linker/Linker.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/Linker/Linker.cpp b/lib/Linker/Linker.cpp index 32aa0f9..fba91da 100644 --- a/lib/Linker/Linker.cpp +++ b/lib/Linker/Linker.cpp @@ -14,10 +14,11 @@ #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/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, @@ -97,13 +98,14 @@ std::auto_ptr<Module> Linker::LoadObject(const sys::Path &FN) { std::string ParseErrorMessage; Module *Result = 0; - - std::auto_ptr<MemoryBuffer> Buffer(MemoryBuffer::getFileOrSTDIN(FN.c_str())); - if (Buffer.get()) - Result = ParseBitcodeFile(Buffer.get(), Context, &ParseErrorMessage); + + OwningPtr<MemoryBuffer> Buffer; + if (error_code ec = MemoryBuffer::getFileOrSTDIN(FN.c_str(), Buffer)) + ParseErrorMessage = "Error reading file '" + FN.str() + "'" + ": " + + ec.message(); else - ParseErrorMessage = "Error reading file '" + FN.str() + "'"; - + Result = ParseBitcodeFile(Buffer.get(), Context, &ParseErrorMessage); + if (Result) return std::auto_ptr<Module>(Result); Error = "Bitcode file '" + FN.str() + "' could not be loaded"; @@ -133,7 +135,7 @@ static inline sys::Path IsLibrary(StringRef Name, // Try the libX.so (or .dylib) form FullPath.eraseSuffix(); - FullPath.appendSuffix(&(LTDL_SHLIB_EXT[1])); + FullPath.appendSuffix(sys::Path::GetDLLSuffix()); if (FullPath.isDynamicLibrary()) // Native shared library? return FullPath; if (FullPath.isBitcodeFile()) // .so file containing bitcode? |