Skip to content

Commit 08e404d

Browse files
committed
feat(rvalue): Add set_location() method to allow location updates
1 parent 4581640 commit 08e404d

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

gccjit_sys/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,4 +666,8 @@ extern {
666666

667667
#[cfg(feature="master")]
668668
pub fn gcc_jit_function_new_temp(func: *mut gcc_jit_function, loc: *mut gcc_jit_location, ty: *mut gcc_jit_type) -> *mut gcc_jit_lvalue;
669+
670+
#[cfg(feature="master")]
671+
pub fn gcc_jit_rvalue_set_location(rvalue: *mut gcc_jit_rvalue,
672+
loc: *mut gcc_jit_location);
669673
}

src/rvalue.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ impl<'ctx> RValue<'ctx> {
101101
}
102102
}
103103

104+
/// Sets the location of this RValue.
105+
#[cfg(feature="master")]
106+
pub unsafe fn set_location(&self, loc: Location) {
107+
unsafe {
108+
let loc_ptr = location::get_ptr(&loc);
109+
gccjit_sys::gcc_jit_rvalue_set_location(self.ptr, loc_ptr);
110+
}
111+
}
112+
104113
/// Given an RValue x and a Field f, returns an RValue representing
105114
/// C's x.f.
106115
pub fn access_field(&self,

0 commit comments

Comments
 (0)