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)
.zip(&def.variants)
.map(|((_, discr), v)| {
let name = SmallCStr::new(&v.ident.as_str());
let name = v.ident.as_str();
unsafe {
Some(llvm::LLVMRustDIBuilderCreateEnumerator(
DIB(cx),
name.as_ptr(),
name.as_ptr().cast(),
name.len(),
// 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()
.variant_range(enum_def_id, cx.tcx)
.map(|variant_index| {
let name = SmallCStr::new(&substs.as_generator().variant_name(variant_index));
let name = substs.as_generator().variant_name(variant_index);
unsafe {
Some(llvm::LLVMRustDIBuilderCreateEnumerator(
DIB(cx),
name.as_ptr(),
name.as_ptr().cast(),
name.len(),
// 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(
Builder: &DIBuilder<'a>,
Name: *const c_char,
Val: u64,
NameLen: size_t,
Value: i64,
IsUnsigned: bool,
) -> &'a DIEnumerator;
pub fn LLVMRustDIBuilderCreateEnumerationType(

View File

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