Change DIBuilderCreateEnumerator signature to match LLVM 9

No functional changes intended.
This commit is contained in:
Tomasz Miąsko 2020-03-05 00:00:00 +00:00
parent 1e179690f8
commit e54a16cffc
3 changed files with 17 additions and 11 deletions

View File

@ -1779,13 +1779,15 @@ fn prepare_enum_metadata(
.discriminants(cx.tcx) .discriminants(cx.tcx)
.zip(&def.variants) .zip(&def.variants)
.map(|((_, discr), v)| { .map(|((_, discr), v)| {
let name = SmallCStr::new(&v.ident.as_str()); let name = v.ident.as_str();
unsafe { unsafe {
Some(llvm::LLVMRustDIBuilderCreateEnumerator( Some(llvm::LLVMRustDIBuilderCreateEnumerator(
DIB(cx), DIB(cx),
name.as_ptr(), name.as_ptr().cast(),
name.len(),
// FIXME: what if enumeration has i128 discriminant? // FIXME: what if enumeration has i128 discriminant?
discr.val as u64, discr.val as i64,
false, // FIXME: IsUnsigned.
)) ))
} }
}) })
@ -1794,13 +1796,15 @@ fn prepare_enum_metadata(
.as_generator() .as_generator()
.variant_range(enum_def_id, cx.tcx) .variant_range(enum_def_id, cx.tcx)
.map(|variant_index| { .map(|variant_index| {
let name = SmallCStr::new(&substs.as_generator().variant_name(variant_index)); let name = substs.as_generator().variant_name(variant_index);
unsafe { unsafe {
Some(llvm::LLVMRustDIBuilderCreateEnumerator( Some(llvm::LLVMRustDIBuilderCreateEnumerator(
DIB(cx), DIB(cx),
name.as_ptr(), name.as_ptr().cast(),
name.len(),
// FIXME: what if enumeration has i128 discriminant? // FIXME: what if enumeration has i128 discriminant?
variant_index.as_usize() as u64, variant_index.as_usize() as i64,
false, // FIXME: IsUnsigned.
)) ))
} }
}) })

View File

@ -1776,7 +1776,9 @@ extern "C" {
pub fn LLVMRustDIBuilderCreateEnumerator( pub fn LLVMRustDIBuilderCreateEnumerator(
Builder: &DIBuilder<'a>, Builder: &DIBuilder<'a>,
Name: *const c_char, Name: *const c_char,
Val: u64, NameLen: size_t,
Value: i64,
IsUnsigned: bool,
) -> &'a DIEnumerator; ) -> &'a DIEnumerator;
pub fn LLVMRustDIBuilderCreateEnumerationType( pub fn LLVMRustDIBuilderCreateEnumerationType(

View File

@ -891,10 +891,10 @@ extern "C" LLVMValueRef LLVMRustDIBuilderInsertDeclareAtEnd(
unwrap(InsertAtEnd))); unwrap(InsertAtEnd)));
} }
extern "C" LLVMMetadataRef extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateEnumerator(
LLVMRustDIBuilderCreateEnumerator(LLVMRustDIBuilderRef Builder, LLVMRustDIBuilderRef Builder, const char *Name, size_t NameLen,
const char *Name, uint64_t Val) { int64_t Value, bool IsUnsigned) {
return wrap(Builder->createEnumerator(Name, Val)); return wrap(Builder->createEnumerator({Name, NameLen}, Value, IsUnsigned));
} }
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateEnumerationType( extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateEnumerationType(