rustc_codegen_llvm: use safe references for ThinLTOBuffer.
This commit is contained in:
parent
ab4f93c742
commit
2e3a6af7fa
@ -579,7 +579,7 @@ impl Drop for ThinData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ThinBuffer(*mut llvm::ThinLTOBuffer);
|
pub struct ThinBuffer(&'static mut llvm::ThinLTOBuffer);
|
||||||
|
|
||||||
unsafe impl Send for ThinBuffer {}
|
unsafe impl Send for ThinBuffer {}
|
||||||
unsafe impl Sync for ThinBuffer {}
|
unsafe impl Sync for ThinBuffer {}
|
||||||
@ -604,7 +604,7 @@ impl ThinBuffer {
|
|||||||
impl Drop for ThinBuffer {
|
impl Drop for ThinBuffer {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
llvm::LLVMRustThinLTOBufferFree(self.0);
|
llvm::LLVMRustThinLTOBufferFree(&mut *(self.0 as *mut _));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1571,10 +1571,10 @@ extern "C" {
|
|||||||
|
|
||||||
pub fn LLVMRustThinLTOAvailable() -> bool;
|
pub fn LLVMRustThinLTOAvailable() -> bool;
|
||||||
pub fn LLVMRustPGOAvailable() -> bool;
|
pub fn LLVMRustPGOAvailable() -> bool;
|
||||||
pub fn LLVMRustThinLTOBufferCreate(M: &Module) -> *mut ThinLTOBuffer;
|
pub fn LLVMRustThinLTOBufferCreate(M: &Module) -> &'static mut ThinLTOBuffer;
|
||||||
pub fn LLVMRustThinLTOBufferFree(M: *mut ThinLTOBuffer);
|
pub fn LLVMRustThinLTOBufferFree(M: &'static mut ThinLTOBuffer);
|
||||||
pub fn LLVMRustThinLTOBufferPtr(M: *const ThinLTOBuffer) -> *const c_char;
|
pub fn LLVMRustThinLTOBufferPtr(M: &ThinLTOBuffer) -> *const c_char;
|
||||||
pub fn LLVMRustThinLTOBufferLen(M: *const ThinLTOBuffer) -> size_t;
|
pub fn LLVMRustThinLTOBufferLen(M: &ThinLTOBuffer) -> size_t;
|
||||||
pub fn LLVMRustCreateThinLTOData(
|
pub fn LLVMRustCreateThinLTOData(
|
||||||
Modules: *const ThinLTOModule,
|
Modules: *const ThinLTOModule,
|
||||||
NumModules: c_uint,
|
NumModules: c_uint,
|
||||||
|
Loading…
Reference in New Issue
Block a user