@@ -54,7 +54,7 @@ impl<'ctx> Builder<'ctx> {
54
54
/// let entry = context.append_basic_block(fn_value, "entry");
55
55
/// let i32_arg = fn_value.get_first_param().unwrap();
56
56
///
57
- /// builder.position_at_end(& entry);
57
+ /// builder.position_at_end(entry);
58
58
/// builder.build_return(Some(&i32_arg));
59
59
/// ```
60
60
pub fn build_return ( & self , value : Option < & dyn BasicValue < ' ctx > > ) -> InstructionValue < ' ctx > {
@@ -85,7 +85,7 @@ impl<'ctx> Builder<'ctx> {
85
85
/// let fn_value = module.add_function("ret", fn_type, None);
86
86
/// let entry = context.append_basic_block(fn_value, "entry");
87
87
///
88
- /// builder.position_at_end(& entry);
88
+ /// builder.position_at_end(entry);
89
89
/// builder.build_aggregate_return(&[i32_three.into(), i32_seven.into()]);
90
90
/// ```
91
91
pub fn build_aggregate_return ( & self , values : & [ BasicValueEnum < ' ctx > ] ) -> InstructionValue < ' ctx > {
@@ -118,7 +118,7 @@ impl<'ctx> Builder<'ctx> {
118
118
/// let entry = context.append_basic_block(fn_value, "entry");
119
119
/// let i32_arg = fn_value.get_first_param().unwrap();
120
120
///
121
- /// builder.position_at_end(& entry);
121
+ /// builder.position_at_end(entry);
122
122
///
123
123
/// let ret_val = builder.build_call(fn_value, &[i32_arg], "call")
124
124
/// .try_as_basic_value()
@@ -228,7 +228,7 @@ impl<'ctx> Builder<'ctx> {
228
228
/// let i32_ptr_param1 = fn_value.get_first_param().unwrap().into_pointer_value();
229
229
/// let i32_ptr_param2 = fn_value.get_nth_param(1).unwrap().into_pointer_value();
230
230
///
231
- /// builder.position_at_end(& entry);
231
+ /// builder.position_at_end(entry);
232
232
/// builder.build_ptr_diff(i32_ptr_param1, i32_ptr_param2, "diff");
233
233
/// builder.build_return(None);
234
234
/// ```
@@ -278,7 +278,7 @@ impl<'ctx> Builder<'ctx> {
278
278
/// let entry = context.append_basic_block(fn_value, "entry");
279
279
/// let i32_ptr_param = fn_value.get_first_param().unwrap().into_pointer_value();
280
280
///
281
- /// builder.position_at_end(& entry);
281
+ /// builder.position_at_end(entry);
282
282
/// builder.build_store(i32_ptr_param, i32_seven);
283
283
/// builder.build_return(None);
284
284
/// ```
@@ -309,7 +309,7 @@ impl<'ctx> Builder<'ctx> {
309
309
/// let entry = context.append_basic_block(fn_value, "entry");
310
310
/// let i32_ptr_param = fn_value.get_first_param().unwrap().into_pointer_value();
311
311
///
312
- /// builder.position_at_end(& entry);
312
+ /// builder.position_at_end(entry);
313
313
///
314
314
/// let pointee = builder.build_load(i32_ptr_param, "load");
315
315
///
@@ -524,7 +524,7 @@ impl<'ctx> Builder<'ctx> {
524
524
/// let entry = context.append_basic_block(fn_value, "entry");
525
525
/// let i32_arg = fn_value.get_first_param().unwrap();
526
526
///
527
- /// builder.position_at_end(& entry);
527
+ /// builder.position_at_end(entry);
528
528
///
529
529
/// builder.build_bitcast(i32_arg, f32_type, "i32tof32");
530
530
/// builder.build_return(None);
@@ -834,7 +834,7 @@ impl<'ctx> Builder<'ctx> {
834
834
/// let n = function.get_nth_param(1).unwrap().into_int_value();
835
835
/// let entry_block = context.append_basic_block(function, "entry");
836
836
///
837
- /// builder.position_at_end(& entry_block);
837
+ /// builder.position_at_end(entry_block);
838
838
///
839
839
/// let shift = builder.build_left_shift(value, n, "left_shift"); // value << n
840
840
///
@@ -906,7 +906,7 @@ impl<'ctx> Builder<'ctx> {
906
906
/// let n = function.get_nth_param(1).unwrap().into_int_value();
907
907
/// let entry_block = context.append_basic_block(function, "entry");
908
908
///
909
- /// builder.position_at_end(& entry_block);
909
+ /// builder.position_at_end(entry_block);
910
910
///
911
911
/// // Whether or not your right shift is sign extended (true) or logical (false) depends
912
912
/// // on the boolean input parameter:
@@ -1078,7 +1078,7 @@ impl<'ctx> Builder<'ctx> {
1078
1078
<<T :: BaseType as FloatMathType >:: MathConvType as IntMathType >:: ValueType :: new ( value)
1079
1079
}
1080
1080
1081
- pub fn build_unconditional_branch ( & self , destination_block : & BasicBlock ) -> InstructionValue < ' ctx > {
1081
+ pub fn build_unconditional_branch ( & self , destination_block : BasicBlock ) -> InstructionValue < ' ctx > {
1082
1082
let value = unsafe {
1083
1083
LLVMBuildBr ( self . builder , destination_block. basic_block )
1084
1084
} ;
@@ -1089,8 +1089,8 @@ impl<'ctx> Builder<'ctx> {
1089
1089
pub fn build_conditional_branch (
1090
1090
& self ,
1091
1091
comparison : IntValue < ' ctx > ,
1092
- then_block : & BasicBlock ,
1093
- else_block : & BasicBlock ,
1092
+ then_block : BasicBlock ,
1093
+ else_block : BasicBlock ,
1094
1094
) -> InstructionValue < ' ctx > {
1095
1095
let value = unsafe {
1096
1096
LLVMBuildCondBr ( self . builder , comparison. as_value_ref ( ) , then_block. basic_block , else_block. basic_block )
@@ -1102,7 +1102,7 @@ impl<'ctx> Builder<'ctx> {
1102
1102
pub fn build_indirect_branch < BV : BasicValue < ' ctx > > (
1103
1103
& self ,
1104
1104
address : BV ,
1105
- destinations : & [ & BasicBlock ] ,
1105
+ destinations : & [ BasicBlock ] ,
1106
1106
) -> InstructionValue < ' ctx > {
1107
1107
let value = unsafe {
1108
1108
LLVMBuildIndirectBr ( self . builder , address. as_value_ref ( ) , destinations. len ( ) as u32 )
@@ -1175,7 +1175,7 @@ impl<'ctx> Builder<'ctx> {
1175
1175
1176
1176
// REVIEW: What if instruction and basic_block are completely unrelated?
1177
1177
// It'd be great if we could get the BB from the instruction behind the scenes
1178
- pub fn position_at ( & self , basic_block : & BasicBlock , instruction : & InstructionValue < ' ctx > ) {
1178
+ pub fn position_at ( & self , basic_block : BasicBlock , instruction : & InstructionValue < ' ctx > ) {
1179
1179
unsafe {
1180
1180
LLVMPositionBuilder ( self . builder , basic_block. basic_block , instruction. as_value_ref ( ) )
1181
1181
}
@@ -1187,7 +1187,7 @@ impl<'ctx> Builder<'ctx> {
1187
1187
}
1188
1188
}
1189
1189
1190
- pub fn position_at_end ( & self , basic_block : & BasicBlock ) {
1190
+ pub fn position_at_end ( & self , basic_block : BasicBlock ) {
1191
1191
unsafe {
1192
1192
LLVMPositionBuilderAtEnd ( self . builder , basic_block. basic_block ) ;
1193
1193
}
@@ -1213,7 +1213,7 @@ impl<'ctx> Builder<'ctx> {
1213
1213
/// let builder = context.create_builder();
1214
1214
/// let entry = context.append_basic_block(fn_value, "entry");
1215
1215
///
1216
- /// builder.position_at_end(& entry);
1216
+ /// builder.position_at_end(entry);
1217
1217
///
1218
1218
/// let array_alloca = builder.build_alloca(array_type, "array_alloca");
1219
1219
/// let array = builder.build_load(array_alloca, "array_load").into_array_value();
@@ -1275,7 +1275,7 @@ impl<'ctx> Builder<'ctx> {
1275
1275
/// let builder = context.create_builder();
1276
1276
/// let entry = context.append_basic_block(fn_value, "entry");
1277
1277
///
1278
- /// builder.position_at_end(& entry);
1278
+ /// builder.position_at_end(entry);
1279
1279
///
1280
1280
/// let array_alloca = builder.build_alloca(array_type, "array_alloca");
1281
1281
/// let array = builder.build_load(array_alloca, "array_load").into_array_value();
@@ -1329,7 +1329,7 @@ impl<'ctx> Builder<'ctx> {
1329
1329
/// let entry = context.append_basic_block(fn_value, "entry");
1330
1330
/// let vector_param = fn_value.get_first_param().unwrap().into_vector_value();
1331
1331
///
1332
- /// builder.position_at_end(& entry);
1332
+ /// builder.position_at_end(entry);
1333
1333
///
1334
1334
/// let extracted = builder.build_extract_element(vector_param, i32_zero, "insert");
1335
1335
///
@@ -1366,7 +1366,7 @@ impl<'ctx> Builder<'ctx> {
1366
1366
/// let entry = context.append_basic_block(fn_value, "entry");
1367
1367
/// let vector_param = fn_value.get_first_param().unwrap().into_vector_value();
1368
1368
///
1369
- /// builder.position_at_end(& entry);
1369
+ /// builder.position_at_end(entry);
1370
1370
/// builder.build_insert_element(vector_param, i32_seven, i32_zero, "insert");
1371
1371
/// builder.build_return(None);
1372
1372
/// ```
@@ -1464,7 +1464,7 @@ impl<'ctx> Builder<'ctx> {
1464
1464
// REVIEW: Returning InstructionValue is the safe move here; but if the value means something
1465
1465
// (IE the result of the switch) it should probably return BasicValueEnum?
1466
1466
// SubTypes: I think value and case values must be the same subtype (maybe). Case value might need to be constants
1467
- pub fn build_switch ( & self , value : IntValue < ' ctx > , else_block : & BasicBlock , cases : & [ ( IntValue < ' ctx > , & BasicBlock ) ] ) -> InstructionValue < ' ctx > {
1467
+ pub fn build_switch ( & self , value : IntValue < ' ctx > , else_block : BasicBlock , cases : & [ ( IntValue < ' ctx > , BasicBlock ) ] ) -> InstructionValue < ' ctx > {
1468
1468
let switch_value = unsafe {
1469
1469
LLVMBuildSwitch ( self . builder , value. as_value_ref ( ) , else_block. basic_block , cases. len ( ) as u32 )
1470
1470
} ;
@@ -1550,7 +1550,7 @@ impl<'ctx> Builder<'ctx> {
1550
1550
/// let entry = context.append_basic_block(fn_value, "entry");
1551
1551
/// let i32_ptr_param = fn_value.get_first_param().unwrap().into_pointer_value();
1552
1552
/// let builder = context.create_builder();
1553
- /// builder.position_at_end(& entry);
1553
+ /// builder.position_at_end(entry);
1554
1554
/// builder.build_atomicrmw(AtomicRMWBinOp::Add, i32_ptr_param, i32_seven, AtomicOrdering::Unordered);
1555
1555
/// builder.build_return(None);
1556
1556
/// ```
@@ -1599,7 +1599,7 @@ impl<'ctx> Builder<'ctx> {
1599
1599
/// let i32_eight = i32_type.const_int(8, false);
1600
1600
/// let entry = context.append_basic_block(fn_value, "entry");
1601
1601
/// let builder = context.create_builder();
1602
- /// builder.position_at_end(& entry);
1602
+ /// builder.position_at_end(entry);
1603
1603
/// builder.build_cmpxchg(i32_ptr_param, i32_seven, i32_eight, AtomicOrdering::AcquireRelease, AtomicOrdering::Monotonic);
1604
1604
/// builder.build_return(None);
1605
1605
/// ```
0 commit comments