1
Fork 0

Use safe FFI for various functions in codegen_llvm

This commit is contained in:
Oli Scherer 2025-02-21 17:23:49 +00:00
parent bb029a1d3f
commit a54bfcf52b
2 changed files with 3 additions and 7 deletions

View file

@ -100,9 +100,7 @@ impl<'a, 'll, CX: Borrow<SimpleCx<'ll>>> GenericBuilder<'a, 'll, CX> {
} }
fn ret_void(&mut self) { fn ret_void(&mut self) {
unsafe { llvm::LLVMBuildRetVoid(self.llbuilder);
llvm::LLVMBuildRetVoid(self.llbuilder);
}
} }
fn ret(&mut self, v: &'ll Value) { fn ret(&mut self, v: &'ll Value) {
@ -293,9 +291,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
} }
fn ret_void(&mut self) { fn ret_void(&mut self) {
unsafe { llvm::LLVMBuildRetVoid(self.llbuilder);
llvm::LLVMBuildRetVoid(self.llbuilder);
}
} }
fn ret(&mut self, v: &'ll Value) { fn ret(&mut self, v: &'ll Value) {

View file

@ -1204,7 +1204,7 @@ unsafe extern "C" {
pub(crate) fn LLVMGetCurrentDebugLocation2<'a>(Builder: &Builder<'a>) -> Option<&'a Metadata>; pub(crate) fn LLVMGetCurrentDebugLocation2<'a>(Builder: &Builder<'a>) -> Option<&'a Metadata>;
// Terminators // Terminators
pub(crate) fn LLVMBuildRetVoid<'a>(B: &Builder<'a>) -> &'a Value; pub(crate) safe fn LLVMBuildRetVoid<'a>(B: &Builder<'a>) -> &'a Value;
pub(crate) fn LLVMBuildRet<'a>(B: &Builder<'a>, V: &'a Value) -> &'a Value; pub(crate) fn LLVMBuildRet<'a>(B: &Builder<'a>, V: &'a Value) -> &'a Value;
pub(crate) fn LLVMBuildBr<'a>(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value; pub(crate) fn LLVMBuildBr<'a>(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value;
pub(crate) fn LLVMBuildCondBr<'a>( pub(crate) fn LLVMBuildCondBr<'a>(