Use LLVMDisposeTargetMachine
This commit is contained in:
parent
ae12bc21d8
commit
85018f09f6
3 changed files with 3 additions and 8 deletions
|
|
@ -95,8 +95,6 @@ impl Drop for OwnedTargetMachine {
|
|||
// SAFETY: constructing ensures we have a valid pointer created by
|
||||
// llvm::LLVMRustCreateTargetMachine OwnedTargetMachine is not copyable so there is no
|
||||
// double free or use after free.
|
||||
unsafe {
|
||||
llvm::LLVMRustDisposeTargetMachine(self.tm_unique.as_ptr());
|
||||
}
|
||||
unsafe { llvm::LLVMDisposeTargetMachine(self.tm_unique) };
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1053,6 +1053,8 @@ unsafe extern "C" {
|
|||
SLen: c_uint,
|
||||
) -> MetadataKindId;
|
||||
|
||||
pub(crate) fn LLVMDisposeTargetMachine(T: ptr::NonNull<TargetMachine>);
|
||||
|
||||
// Create modules.
|
||||
pub(crate) fn LLVMModuleCreateWithNameInContext(
|
||||
ModuleID: *const c_char,
|
||||
|
|
@ -2499,7 +2501,6 @@ unsafe extern "C" {
|
|||
UseWasmEH: bool,
|
||||
) -> *mut TargetMachine;
|
||||
|
||||
pub(crate) fn LLVMRustDisposeTargetMachine(T: *mut TargetMachine);
|
||||
pub(crate) fn LLVMRustAddLibraryInfo<'a>(
|
||||
PM: &PassManager<'a>,
|
||||
M: &'a Module,
|
||||
|
|
|
|||
|
|
@ -359,10 +359,6 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
|
|||
return wrap(TM);
|
||||
}
|
||||
|
||||
extern "C" void LLVMRustDisposeTargetMachine(LLVMTargetMachineRef TM) {
|
||||
delete unwrap(TM);
|
||||
}
|
||||
|
||||
// Unfortunately, the LLVM C API doesn't provide a way to create the
|
||||
// TargetLibraryInfo pass, so we use this method to do so.
|
||||
extern "C" void LLVMRustAddLibraryInfo(LLVMPassManagerRef PMR, LLVMModuleRef M,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue