@@ -61,7 +61,7 @@ impl<'ctx> BasicBlock<'ctx> {
61
61
///
62
62
/// assert!(basic_block.get_parent().is_none());
63
63
/// ```
64
- pub fn get_parent ( & self ) -> Option < FunctionValue < ' ctx > > {
64
+ pub fn get_parent ( self ) -> Option < FunctionValue < ' ctx > > {
65
65
let value = unsafe {
66
66
LLVMGetBasicBlockParent ( self . basic_block )
67
67
} ;
@@ -95,7 +95,7 @@ impl<'ctx> BasicBlock<'ctx> {
95
95
/// assert!(basic_block2.get_previous_basic_block().is_none());
96
96
/// assert_eq!(basic_block3.get_previous_basic_block().unwrap(), basic_block2);
97
97
/// ```
98
- pub fn get_previous_basic_block ( & self ) -> Option < BasicBlock < ' ctx > > {
98
+ pub fn get_previous_basic_block ( self ) -> Option < BasicBlock < ' ctx > > {
99
99
self . get_parent ( ) ?;
100
100
101
101
let bb = unsafe {
@@ -132,7 +132,7 @@ impl<'ctx> BasicBlock<'ctx> {
132
132
/// assert_eq!(basic_block2.get_next_basic_block().unwrap(), basic_block3);
133
133
/// assert!(basic_block3.get_next_basic_block().is_none());
134
134
/// ```
135
- pub fn get_next_basic_block ( & self ) -> Option < BasicBlock < ' ctx > > {
135
+ pub fn get_next_basic_block ( self ) -> Option < BasicBlock < ' ctx > > {
136
136
self . get_parent ( ) ?;
137
137
138
138
let bb = unsafe {
@@ -166,7 +166,7 @@ impl<'ctx> BasicBlock<'ctx> {
166
166
/// assert_eq!(basic_block2.get_next_basic_block().unwrap(), basic_block1);
167
167
/// ```
168
168
// REVIEW: What happens if blocks are from different scopes?
169
- pub fn move_before ( & self , basic_block : BasicBlock < ' ctx > ) -> Result < ( ) , ( ) > {
169
+ pub fn move_before ( self , basic_block : BasicBlock < ' ctx > ) -> Result < ( ) , ( ) > {
170
170
// This method is UB if the parent no longer exists, so we must check for parent (or encode into type system)
171
171
if self . get_parent ( ) . is_none ( ) || basic_block. get_parent ( ) . is_none ( ) {
172
172
return Err ( ( ) ) ;
@@ -203,7 +203,7 @@ impl<'ctx> BasicBlock<'ctx> {
203
203
/// assert_eq!(basic_block2.get_next_basic_block().unwrap(), basic_block1);
204
204
/// ```
205
205
// REVIEW: What happens if blocks are from different scopes?
206
- pub fn move_after ( & self , basic_block : BasicBlock < ' ctx > ) -> Result < ( ) , ( ) > {
206
+ pub fn move_after ( self , basic_block : BasicBlock < ' ctx > ) -> Result < ( ) , ( ) > {
207
207
// This method is UB if the parent no longer exists, so we must check for parent (or encode into type system)
208
208
if self . get_parent ( ) . is_none ( ) || basic_block. get_parent ( ) . is_none ( ) {
209
209
return Err ( ( ) ) ;
@@ -238,7 +238,7 @@ impl<'ctx> BasicBlock<'ctx> {
238
238
///
239
239
/// assert_eq!(basic_block.get_first_instruction().unwrap().get_opcode(), InstructionOpcode::Return);
240
240
/// ```
241
- pub fn get_first_instruction ( & self ) -> Option < InstructionValue < ' ctx > > {
241
+ pub fn get_first_instruction ( self ) -> Option < InstructionValue < ' ctx > > {
242
242
let value = unsafe {
243
243
LLVMGetFirstInstruction ( self . basic_block )
244
244
} ;
@@ -272,7 +272,7 @@ impl<'ctx> BasicBlock<'ctx> {
272
272
///
273
273
/// assert_eq!(basic_block.get_last_instruction().unwrap().get_opcode(), InstructionOpcode::Return);
274
274
/// ```
275
- pub fn get_last_instruction ( & self ) -> Option < InstructionValue < ' ctx > > {
275
+ pub fn get_last_instruction ( self ) -> Option < InstructionValue < ' ctx > > {
276
276
let value = unsafe {
277
277
LLVMGetLastInstruction ( self . basic_block )
278
278
} ;
@@ -310,7 +310,7 @@ impl<'ctx> BasicBlock<'ctx> {
310
310
// if getting a value over an instruction is preferable
311
311
// TODOC: Every BB must have a terminating instruction or else it is invalid
312
312
// REVIEW: Unclear how this differs from get_last_instruction
313
- pub fn get_terminator ( & self ) -> Option < InstructionValue < ' ctx > > {
313
+ pub fn get_terminator ( self ) -> Option < InstructionValue < ' ctx > > {
314
314
let value = unsafe {
315
315
LLVMGetBasicBlockTerminator ( self . basic_block )
316
316
} ;
@@ -348,7 +348,7 @@ impl<'ctx> BasicBlock<'ctx> {
348
348
// by taking ownership of self (though BasicBlock's are not uniquely obtained...)
349
349
// might have to make some methods do something like -> Result<..., BasicBlock<Orphan>> for BasicBlock<HasParent>
350
350
// and would move_before/after make it no longer orphaned? etc..
351
- pub fn remove_from_function ( & self ) -> Result < ( ) , ( ) > {
351
+ pub fn remove_from_function ( self ) -> Result < ( ) , ( ) > {
352
352
// This method is UB if the parent no longer exists, so we must check for parent (or encode into type system)
353
353
if self . get_parent ( ) . is_none ( ) {
354
354
return Err ( ( ) ) ;
@@ -410,7 +410,7 @@ impl<'ctx> BasicBlock<'ctx> {
410
410
///
411
411
/// assert_eq!(context, *basic_block.get_context());
412
412
/// ```
413
- pub fn get_context ( & self ) -> ContextRef < ' ctx > {
413
+ pub fn get_context ( self ) -> ContextRef < ' ctx > {
414
414
let context = unsafe {
415
415
LLVMGetTypeContext ( LLVMTypeOf ( LLVMBasicBlockAsValue ( self . basic_block ) ) )
416
416
} ;
@@ -470,7 +470,7 @@ impl<'ctx> BasicBlock<'ctx> {
470
470
///
471
471
/// assert_eq!(branch_inst.get_operand(0).unwrap().right().unwrap(), bb2);
472
472
/// ```
473
- pub fn replace_all_uses_with ( & self , other : & BasicBlock < ' ctx > ) {
473
+ pub fn replace_all_uses_with ( self , other : & BasicBlock < ' ctx > ) {
474
474
let value = unsafe { LLVMBasicBlockAsValue ( self . basic_block ) } ;
475
475
let other = unsafe { LLVMBasicBlockAsValue ( other. basic_block ) } ;
476
476
@@ -506,7 +506,7 @@ impl<'ctx> BasicBlock<'ctx> {
506
506
/// assert!(bb2.get_first_use().is_none());
507
507
/// assert!(bb1.get_first_use().is_some());
508
508
/// ```
509
- pub fn get_first_use ( & self ) -> Option < BasicValueUse > {
509
+ pub fn get_first_use ( self ) -> Option < BasicValueUse < ' ctx > > {
510
510
let use_ = unsafe {
511
511
LLVMGetFirstUse ( LLVMBasicBlockAsValue ( self . basic_block ) )
512
512
} ;
0 commit comments