File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -699,4 +699,7 @@ extern "C" {
699
699
700
700
#[ cfg( feature="master" ) ]
701
701
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 ;
702
705
}
Original file line number Diff line number Diff line change 1
- use std:: { ffi:: CString , marker:: PhantomData } ;
1
+ use std:: ffi:: { CStr , CString } ;
2
+ use std:: marker:: PhantomData ;
2
3
use std:: fmt;
3
4
use std:: ptr;
5
+ use std:: str:: Utf8Error ;
6
+
4
7
use context:: Context ;
5
8
use rvalue:: { RValue , ToRValue } ;
6
9
use rvalue;
@@ -238,6 +241,18 @@ impl<'ctx> LValue<'ctx> {
238
241
} ,
239
242
}
240
243
}
244
+
245
+ #[ cfg( feature = "master" ) ]
246
+ pub fn get_name ( & self ) -> Result < Option < & ' ctx str > , Utf8Error > {
247
+ unsafe {
248
+ let str = gccjit_sys:: gcc_jit_lvalue_get_name ( self . ptr ) ;
249
+ if str. is_null ( ) {
250
+ Ok ( None )
251
+ } else {
252
+ Ok ( Some ( CStr :: from_ptr ( str) . to_str ( ) ?) )
253
+ }
254
+ }
255
+ }
241
256
}
242
257
243
258
pub 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