File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -699,4 +699,7 @@ extern "C" {
699699
700700 #[ cfg( feature="master" ) ]
701701 pub fn gcc_jit_lvalue_add_attribute ( variable : * mut gcc_jit_lvalue , attribute : gcc_jit_variable_attribute ) ;
702+
703+ #[ cfg( feature="master" ) ]
704+ pub fn gcc_jit_lvalue_get_name ( lvalue : * mut gcc_jit_lvalue ) -> * const c_char ;
702705}
Original file line number Diff line number Diff line change 11use std:: { ffi:: CString , marker:: PhantomData } ;
22use std:: fmt;
33use std:: ptr;
4+
45use context:: Context ;
56use rvalue:: { RValue , ToRValue } ;
67use rvalue;
@@ -238,6 +239,18 @@ impl<'ctx> LValue<'ctx> {
238239 } ,
239240 }
240241 }
242+
243+ #[ cfg( feature = "master" ) ]
244+ pub fn get_name ( & self ) -> Result < Option < & ' ctx str > , std:: str:: Utf8Error > {
245+ unsafe {
246+ let str = gccjit_sys:: gcc_jit_lvalue_get_name ( self . ptr ) ;
247+ if str. is_null ( ) {
248+ Ok ( None )
249+ } else {
250+ Ok ( Some ( std:: ffi:: CStr :: from_ptr ( str) . to_str ( ) ?) )
251+ }
252+ }
253+ }
241254}
242255
243256pub unsafe fn from_ptr < ' ctx > ( ptr : * mut gccjit_sys:: gcc_jit_lvalue ) -> LValue < ' ctx > {
You can’t perform that action at this time.
0 commit comments