diff options
| author | bors <bors@rust-lang.org> | 2016-06-10 04:50:46 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-06-10 04:50:46 -0700 |
| commit | 68241f00ad8fb90474748b37ebd68b6bd46c796b (patch) | |
| tree | e12d369a793cb9997f8063558098aeb5ec80c4cb /src/rustllvm/ArchiveWrapper.cpp | |
| parent | a9234c11e00d976e69bcab95342b8af469c82d5b (diff) | |
| parent | f3d9de4528e7be9428b5afddec25d9ed4622f305 (diff) | |
| download | rust-68241f00ad8fb90474748b37ebd68b6bd46c796b.tar.gz rust-68241f00ad8fb90474748b37ebd68b6bd46c796b.zip | |
Auto merge of #34178 - shepmaster:llvm-3.7-and-up, r=alexcrichton
Reflect supporting only LLVM 3.7+ in the LLVM wrappers Based on 12abddb06b681f5c1cb389074b5a35d3e260698f, it appears we can drop support for these older LLVM versions. Hopefully, this will make it slightly easier to support the changes needed for LLVM 3.9. r? @nagisa /cc @brson
Diffstat (limited to 'src/rustllvm/ArchiveWrapper.cpp')
| -rw-r--r-- | src/rustllvm/ArchiveWrapper.cpp | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/src/rustllvm/ArchiveWrapper.cpp b/src/rustllvm/ArchiveWrapper.cpp index d3f2907bfc3..1e7b04c814c 100644 --- a/src/rustllvm/ArchiveWrapper.cpp +++ b/src/rustllvm/ArchiveWrapper.cpp @@ -11,10 +11,7 @@ #include "rustllvm.h" #include "llvm/Object/Archive.h" - -#if LLVM_VERSION_MINOR >= 7 #include "llvm/Object/ArchiveWriter.h" -#endif using namespace llvm; using namespace llvm::object; @@ -34,13 +31,7 @@ struct LLVMRustArchiveMember { ~LLVMRustArchiveMember() {} }; -#if LLVM_VERSION_MINOR >= 6 typedef OwningBinary<Archive> RustArchive; -#define GET_ARCHIVE(a) ((a)->getBinary()) -#else -typedef Archive RustArchive; -#define GET_ARCHIVE(a) (a) -#endif extern "C" void* LLVMRustOpenArchive(char *path) { @@ -52,7 +43,6 @@ LLVMRustOpenArchive(char *path) { return nullptr; } -#if LLVM_VERSION_MINOR >= 6 ErrorOr<std::unique_ptr<Archive>> archive_or = Archive::create(buf_or.get()->getMemBufferRef()); @@ -63,14 +53,6 @@ LLVMRustOpenArchive(char *path) { OwningBinary<Archive> *ret = new OwningBinary<Archive>( std::move(archive_or.get()), std::move(buf_or.get())); -#else - std::error_code err; - Archive *ret = new Archive(std::move(buf_or.get()), err); - if (err) { - LLVMRustSetLastError(err.message().c_str()); - return nullptr; - } -#endif return ret; } @@ -87,7 +69,7 @@ struct RustArchiveIterator { extern "C" RustArchiveIterator* LLVMRustArchiveIteratorNew(RustArchive *ra) { - Archive *ar = GET_ARCHIVE(ra); + Archive *ar = ra->getBinary(); RustArchiveIterator *rai = new RustArchiveIterator(); rai->cur = ar->child_begin(); rai->end = ar->child_end(); @@ -137,16 +119,12 @@ LLVMRustArchiveChildName(const Archive::Child *child, size_t *size) { extern "C" const char* LLVMRustArchiveChildData(Archive::Child *child, size_t *size) { StringRef buf; -#if LLVM_VERSION_MINOR >= 7 ErrorOr<StringRef> buf_or_err = child->getBuffer(); if (buf_or_err.getError()) { LLVMRustSetLastError(buf_or_err.getError().message().c_str()); return NULL; } buf = buf_or_err.get(); -#else - buf = child->getBuffer(); -#endif *size = buf.size(); return buf.data(); } @@ -172,7 +150,6 @@ LLVMRustWriteArchive(char *Dst, const LLVMRustArchiveMember **NewMembers, bool WriteSymbtab, Archive::Kind Kind) { -#if LLVM_VERSION_MINOR >= 7 std::vector<NewArchiveIterator> Members; for (size_t i = 0; i < NumMembers; i++) { @@ -196,8 +173,5 @@ LLVMRustWriteArchive(char *Dst, if (!pair.second) return 0; LLVMRustSetLastError(pair.second.message().c_str()); -#else - LLVMRustSetLastError("writing archives not supported with this LLVM version"); -#endif return -1; } |
