File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -774,4 +774,10 @@ extern_maybe_dlopen! {
774774
775775 #[ cfg( feature="master" ) ]
776776 fn gcc_jit_type_set_addressable( typ: * mut gcc_jit_type) ;
777+
778+ #[ cfg( feature="master" ) ]
779+ fn gcc_jit_set_lang_name( lang_name: * const c_char) ;
780+
781+ #[ cfg( feature="master" ) ]
782+ fn gcc_jit_context_set_filename( ctx: * mut gcc_jit_context, filename: * const c_char) ;
777783}
Original file line number Diff line number Diff line change @@ -1271,6 +1271,16 @@ impl<'ctx> Context<'ctx> {
12711271 panic ! ( "{}" , error) ;
12721272 }
12731273 }
1274+
1275+ #[ cfg( feature="master" ) ]
1276+ pub fn set_filename ( & self , filename : & str ) {
1277+ let c_str = CString :: new ( filename) . unwrap ( ) ;
1278+ with_lib ( |lib| {
1279+ unsafe {
1280+ lib. gcc_jit_context_set_filename ( self . ptr , c_str. as_ptr ( ) ) ;
1281+ }
1282+ } )
1283+ }
12741284}
12751285
12761286impl < ' ctx > Drop for Context < ' ctx > {
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ mod block;
3333#[ cfg( feature="master" ) ]
3434mod target_info;
3535
36- #[ cfg( feature="dlopen" ) ]
36+ #[ cfg( any ( feature="dlopen" , feature= "master" ) ) ]
3737use std:: ffi:: CStr ;
3838#[ cfg( feature="dlopen" ) ]
3939use std:: sync:: OnceLock ;
@@ -148,3 +148,12 @@ pub static LIB: OnceLock<Option<Libgccjit>> = OnceLock::new();
148148// Without the dlopen feature, we avoid using OnceLock as to not have any performance impact.
149149#[ cfg( not( feature="dlopen" ) ) ]
150150static LIB : Libgccjit = Libgccjit :: new ( ) ;
151+
152+ #[ cfg( feature="master" ) ]
153+ pub fn set_lang_name ( lang_name : & ' static CStr ) {
154+ unsafe {
155+ with_lib ( |lib| {
156+ lib. gcc_jit_set_lang_name ( lang_name. as_ptr ( ) ) ;
157+ } ) ;
158+ }
159+ }
You can’t perform that action at this time.
0 commit comments