1#![allow(clippy::needless_lifetimes)]
18
19extern crate gccjit_sys;
20
21mod asm;
22mod types;
23mod context;
24mod object;
25mod location;
26mod field;
27mod structs;
28mod lvalue;
29mod rvalue;
30mod parameter;
31mod function;
32mod block;
33#[cfg(feature="master")]
34mod target_info;
35
36pub use context::Context;
37pub use context::CType;
38pub use context::GlobalKind;
39pub use context::OptimizationLevel;
40pub use context::CompileResult;
41pub use context::OutputKind;
42pub use location::Location;
43pub use object::Object;
44pub use object::ToObject;
45pub use types::FunctionPtrType;
46pub use types::Type;
47pub use types::Typeable;
48pub use field::Field;
49pub use structs::Struct;
50#[cfg(feature="master")]
51pub use lvalue::{VarAttribute, Visibility};
52pub use lvalue::{LValue, TlsModel, ToLValue};
53pub use rvalue::{RValue, ToRValue};
54pub use parameter::Parameter;
55#[cfg(feature="master")]
56pub use function::FnAttribute;
57pub use function::{Function, FunctionType};
58pub use block::{Block, BinaryOp, UnaryOp, ComparisonOp};
59#[cfg(feature="master")]
60pub use target_info::TargetInfo;
61
62#[cfg(feature="master")]
63pub fn set_global_personality_function_name(name: &'static [u8]) {
64 debug_assert!(name.ends_with(b"\0"), "Expecting a NUL-terminated C string");
65 unsafe {
66 gccjit_sys::gcc_jit_set_global_personality_function_name(name.as_ptr() as *const _);
67 }
68}
69
70#[derive(Debug)]
71pub struct Version {
72 pub major: i32,
73 pub minor: i32,
74 pub patch: i32,
75}
76
77impl Version {
78 pub fn get() -> Self {
79 unsafe {
80 Self {
81 major: gccjit_sys::gcc_jit_version_major(),
82 minor: gccjit_sys::gcc_jit_version_minor(),
83 patch: gccjit_sys::gcc_jit_version_patchlevel(),
84 }
85 }
86 }
87}