Add OwnedTargetMachine to manage llvm:TargetMachine. Uses pointers
instead of &'static mut and provides safe interface to create/dispose it.
This commit is contained in:
parent
fc61fabc24
commit
3409ca65d8
7 changed files with 148 additions and 40 deletions
|
@ -2112,6 +2112,8 @@ extern "C" {
|
|||
);
|
||||
|
||||
pub fn LLVMRustGetHostCPUName(len: *mut usize) -> *const c_char;
|
||||
|
||||
// This function makes copies of pointed to data, so the data's lifetime may end after this function returns
|
||||
pub fn LLVMRustCreateTargetMachine(
|
||||
Triple: *const c_char,
|
||||
CPU: *const c_char,
|
||||
|
@ -2135,9 +2137,9 @@ extern "C" {
|
|||
ForceEmulatedTls: bool,
|
||||
ArgsCstrBuff: *const c_char,
|
||||
ArgsCstrBuffLen: usize,
|
||||
) -> Option<&'static mut TargetMachine>;
|
||||
) -> *mut TargetMachine;
|
||||
|
||||
pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
|
||||
pub fn LLVMRustDisposeTargetMachine(T: *mut TargetMachine);
|
||||
pub fn LLVMRustAddLibraryInfo<'a>(
|
||||
PM: &PassManager<'a>,
|
||||
M: &'a Module,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue