Skip to content

Commit 25cfaf7

Browse files
Add gcc_jit_type_get_restrict
1 parent 814eea1 commit 25cfaf7

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

gccjit_sys/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@ extern {
339339
pub fn gcc_jit_type_get_pointer(ty: *mut gcc_jit_type) -> *mut gcc_jit_type;
340340
pub fn gcc_jit_type_get_const(ty: *mut gcc_jit_type) -> *mut gcc_jit_type;
341341
pub fn gcc_jit_type_get_volatile(ty: *mut gcc_jit_type) -> *mut gcc_jit_type;
342+
#[cfg(feature="master")]
343+
pub fn gcc_jit_type_get_restrict(ty: *mut gcc_jit_type) -> *mut gcc_jit_type;
342344
pub fn gcc_jit_context_new_array_type(ctx: *mut gcc_jit_context,
343345
loc: *mut gcc_jit_location,
344346
ty: *mut gcc_jit_type,

src/types.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,15 @@ impl<'ctx> Type<'ctx> {
137137
}
138138
}
139139

140+
/// Given a type T, creates a new type of restrict T, which
141+
/// has the semantics of C's restrict.
142+
#[cfg(feature="master")]
143+
pub fn make_restrict(self) -> Type<'ctx> {
144+
unsafe {
145+
from_ptr(gccjit_sys::gcc_jit_type_get_restrict(self.ptr))
146+
}
147+
}
148+
140149
pub fn get_aligned(self, alignment_in_bytes: u64) -> Type<'ctx> {
141150
unsafe {
142151
from_ptr(gccjit_sys::gcc_jit_type_get_aligned(self.ptr, alignment_in_bytes as _))

0 commit comments

Comments
 (0)