Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1797,12 +1797,12 @@ impl<'ctx> Builder<'ctx> {
///
/// builder.position_at_end(entry);
///
/// builder.build_bitcast(i32_arg, f32_type, "i32tof32").unwrap();
/// builder.build_bit_cast(i32_arg, f32_type, "i32tof32").unwrap();
/// builder.build_return(None).unwrap();
///
/// assert!(module.verify().is_ok());
/// ```
pub fn build_bitcast<T, V>(&self, val: V, ty: T, name: &str) -> Result<BasicValueEnum<'ctx>, BuilderError>
pub fn build_bit_cast<T, V>(&self, val: V, ty: T, name: &str) -> Result<BasicValueEnum<'ctx>, BuilderError>
where
T: BasicType<'ctx>,
V: BasicValue<'ctx>,
Expand Down
12 changes: 6 additions & 6 deletions tests/all/test_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,7 @@ fn test_memset() {
}

#[test]
fn test_bitcast() {
fn test_bit_cast() {
use inkwell::values::BasicValue;

let context = Context::create();
Expand Down Expand Up @@ -1562,11 +1562,11 @@ fn test_bitcast() {

builder.position_at_end(entry);

let cast = builder.build_bitcast(i32_arg, f32_type, "i32tof32").unwrap();
let cast = builder.build_bit_cast(i32_arg, f32_type, "i32tof32").unwrap();

builder.build_bitcast(f32_arg, f32_type, "f32tof32").unwrap();
builder.build_bitcast(i32_vec_arg, i64_type, "2xi32toi64").unwrap();
builder.build_bitcast(i32_ptr_arg, i64_ptr_type, "i32*toi64*").unwrap();
builder.build_bit_cast(f32_arg, f32_type, "f32tof32").unwrap();
builder.build_bit_cast(i32_vec_arg, i64_type, "2xi32toi64").unwrap();
builder.build_bit_cast(i32_ptr_arg, i64_ptr_type, "i32*toi64*").unwrap();

builder.build_return(None).unwrap();

Expand All @@ -1575,7 +1575,7 @@ fn test_bitcast() {
let first_iv = cast.as_instruction_value().unwrap();

builder.position_before(&first_iv);
builder.build_bitcast(f64_arg, i64_type, "f64toi64").unwrap();
builder.build_bit_cast(f64_arg, i64_type, "f64toi64").unwrap();

assert!(module.verify().is_ok());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/all/test_instruction_values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ fn test_operands() {
assert!(return_instruction.get_operand(2).is_none());

// Test Uses
let bitcast_use_value = free_operand0_instruction
let bit_cast_use_value = free_operand0_instruction
.get_first_use()
.unwrap()
.get_used_value()
.left()
.unwrap();
let free_call_param = free_instruction.get_operand(0).unwrap().left().unwrap();

assert_eq!(bitcast_use_value, free_call_param);
assert_eq!(bit_cast_use_value, free_call_param);

// These instructions/calls don't return any ir value so they aren't used anywhere
assert!(store_instruction.get_first_use().is_none());
Expand Down