diff options
| author | bors <bors@rust-lang.org> | 2014-10-05 04:57:11 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-10-05 04:57:11 +0000 |
| commit | 3b8c528d083b2e1f6b34eceb518d60c5efdb4ef4 (patch) | |
| tree | 0ffee9636a89d46fae239565cb8f17b648350faa /src/rustllvm/RustWrapper.cpp | |
| parent | 026206695af8355d0b52000ca0f491a1ab5b051d (diff) | |
| parent | 4b22178d325704d81522c15570498b7467b3152d (diff) | |
| download | rust-3b8c528d083b2e1f6b34eceb518d60c5efdb4ef4.tar.gz rust-3b8c528d083b2e1f6b34eceb518d60c5efdb4ef4.zip | |
auto merge of #17776 : luqmana/rust/ul, r=alexcrichton
Update our LLVM snapshot to master (as of ~ Wed Oct 1 18:49:58 2014 +0000). Since my patches have landed upstream this fixes #13429 and #7298.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
| -rw-r--r-- | src/rustllvm/RustWrapper.cpp | 45 |
1 files changed, 40 insertions, 5 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index 1fdaa548ebe..9fda05431db 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -393,13 +393,12 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateLexicalBlock( LLVMValueRef Scope, LLVMValueRef File, unsigned Line, - unsigned Col, - unsigned Discriminator) { + unsigned Col) { return wrap(Builder->createLexicalBlock( unwrapDI<DIDescriptor>(Scope), unwrapDI<DIFile>(File), Line, Col -#if LLVM_VERSION_MINOR >= 5 - , Discriminator +#if LLVM_VERSION_MINOR == 5 + , 0 #endif )); } @@ -415,7 +414,11 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateStaticVariable( bool isLocalToUnit, LLVMValueRef Val, LLVMValueRef Decl = NULL) { +#if LLVM_VERSION_MINOR == 6 + return wrap(Builder->createGlobalVariable(unwrapDI<DIDescriptor>(Context), +#else return wrap(Builder->createStaticVariable(unwrapDI<DIDescriptor>(Context), +#endif Name, LinkageName, unwrapDI<DIFile>(File), @@ -665,11 +668,18 @@ extern "C" void LLVMWriteValueToString(LLVMValueRef Value, RustStringRef str) { extern "C" bool LLVMRustLinkInExternalBitcode(LLVMModuleRef dst, char *bc, size_t len) { Module *Dst = unwrap(dst); +#if LLVM_VERSION_MINOR == 5 MemoryBuffer* buf = MemoryBuffer::getMemBufferCopy(StringRef(bc, len)); ErrorOr<Module *> Src = llvm::getLazyBitcodeModule(buf, Dst->getContext()); +#else + std::unique_ptr<MemoryBuffer> buf = MemoryBuffer::getMemBufferCopy(StringRef(bc, len)); + ErrorOr<Module *> Src = llvm::getLazyBitcodeModule(std::move(buf), Dst->getContext()); +#endif if (!Src) { LLVMRustSetLastError(Src.getError().message().c_str()); +#if LLVM_VERSION_MINOR == 5 delete buf; +#endif return false; } @@ -712,12 +722,26 @@ LLVMRustOpenArchive(char *path) { return nullptr; } +#if LLVM_VERSION_MINOR >= 6 + ErrorOr<std::unique_ptr<Archive>> archive_or = + Archive::create(buf_or.get()->getMemBufferRef()); + + if (!archive_or) { + LLVMRustSetLastError(archive_or.getError().message().c_str()); + return nullptr; + } + + 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 NULL; + return nullptr; } +#endif + return ret; } #else @@ -739,7 +763,14 @@ LLVMRustOpenArchive(char *path) { #endif extern "C" const char* +#if LLVM_VERSION_MINOR >= 6 +LLVMRustArchiveReadSection(OwningBinary<Archive> *ob, char *name, size_t *size) { + + std::unique_ptr<Archive> &ar = ob->getBinary(); +#else LLVMRustArchiveReadSection(Archive *ar, char *name, size_t *size) { +#endif + #if LLVM_VERSION_MINOR >= 5 Archive::child_iterator child = ar->child_begin(), end = ar->child_end(); @@ -765,7 +796,11 @@ LLVMRustArchiveReadSection(Archive *ar, char *name, size_t *size) { } extern "C" void +#if LLVM_VERSION_MINOR >= 6 +LLVMRustDestroyArchive(OwningBinary<Archive> *ar) { +#else LLVMRustDestroyArchive(Archive *ar) { +#endif delete ar; } |
