Avoid a bunch of unnecessary unsafe blocks in cg_llvm

This commit is contained in:
Oli Scherer
2025-07-09 09:12:42 +00:00
parent ad635e5d06
commit d3d51b4fdb
8 changed files with 52 additions and 63 deletions

View File

@@ -1009,7 +1009,7 @@ unsafe extern "C" {
ModuleID: *const c_char,
C: &Context,
) -> &Module;
pub(crate) fn LLVMCloneModule(M: &Module) -> &Module;
pub(crate) safe fn LLVMCloneModule(M: &Module) -> &Module;
/// Data layout. See Module::getDataLayout.
pub(crate) fn LLVMGetDataLayoutStr(M: &Module) -> *const c_char;
@@ -1179,7 +1179,7 @@ unsafe extern "C" {
pub(crate) fn LLVMIsThreadLocal(GlobalVar: &Value) -> Bool;
pub(crate) fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode);
pub(crate) fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool;
pub(crate) fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
pub(crate) safe fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
pub(crate) safe fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool);
// Operations on attributes
@@ -1718,7 +1718,7 @@ unsafe extern "C" {
pub(crate) safe fn LLVMMetadataAsValue<'a>(C: &'a Context, MD: &'a Metadata) -> &'a Value;
pub(crate) fn LLVMSetUnnamedAddress(Global: &Value, UnnamedAddr: UnnamedAddr);
pub(crate) safe fn LLVMSetUnnamedAddress(Global: &Value, UnnamedAddr: UnnamedAddr);
pub(crate) fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&ConstantInt>;