Update LLVM.
This commit is contained in:
parent
20f4c45bad
commit
4b22178d32
8 changed files with 61 additions and 21 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue