Skip to content

Commit e7cef26

Browse files
dpaolielloZalathar
authored andcommitted
cg_llvm: Reduce visibility of all functions in the llvm module
1 parent 659e20f commit e7cef26

File tree

4 files changed

+479
-420
lines changed

4 files changed

+479
-420
lines changed

Diff for: compiler/rustc_codegen_llvm/src/llvm/archive_ro.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl ArchiveRO {
2626
///
2727
/// If this archive is used with a mutable method, then an error will be
2828
/// raised.
29-
pub fn open(dst: &Path) -> Result<ArchiveRO, String> {
29+
pub(crate) fn open(dst: &Path) -> Result<ArchiveRO, String> {
3030
unsafe {
3131
let s = path_to_c_string(dst);
3232
let ar = super::LLVMRustOpenArchive(s.as_ptr()).ok_or_else(|| {
@@ -36,7 +36,7 @@ impl ArchiveRO {
3636
}
3737
}
3838

39-
pub fn iter(&self) -> Iter<'_> {
39+
pub(crate) fn iter(&self) -> Iter<'_> {
4040
unsafe { Iter { raw: super::LLVMRustArchiveIteratorNew(self.raw) } }
4141
}
4242
}
@@ -71,7 +71,7 @@ impl<'a> Drop for Iter<'a> {
7171
}
7272

7373
impl<'a> Child<'a> {
74-
pub fn name(&self) -> Option<&'a str> {
74+
pub(crate) fn name(&self) -> Option<&'a str> {
7575
unsafe {
7676
let mut name_len = 0;
7777
let name_ptr = super::LLVMRustArchiveChildName(self.raw, &mut name_len);

Diff for: compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs

+14-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![allow(non_camel_case_types)]
2+
#![expect(dead_code)]
23

34
use libc::{c_char, c_uint};
45

@@ -8,23 +9,23 @@ use crate::llvm::Bool;
89
#[link(name = "llvm-wrapper", kind = "static")]
910
extern "C" {
1011
// Enzyme
11-
pub fn LLVMRustHasMetadata(I: &Value, KindID: c_uint) -> bool;
12-
pub fn LLVMRustEraseInstUntilInclusive(BB: &BasicBlock, I: &Value);
13-
pub fn LLVMRustGetLastInstruction<'a>(BB: &BasicBlock) -> Option<&'a Value>;
14-
pub fn LLVMRustDIGetInstMetadata(I: &Value) -> Option<&Metadata>;
15-
pub fn LLVMRustEraseInstFromParent(V: &Value);
16-
pub fn LLVMRustGetTerminator<'a>(B: &BasicBlock) -> &'a Value;
17-
pub fn LLVMRustVerifyFunction(V: &Value, action: LLVMRustVerifierFailureAction) -> Bool;
12+
pub(crate) fn LLVMRustHasMetadata(I: &Value, KindID: c_uint) -> bool;
13+
pub(crate) fn LLVMRustEraseInstUntilInclusive(BB: &BasicBlock, I: &Value);
14+
pub(crate) fn LLVMRustGetLastInstruction<'a>(BB: &BasicBlock) -> Option<&'a Value>;
15+
pub(crate) fn LLVMRustDIGetInstMetadata(I: &Value) -> Option<&Metadata>;
16+
pub(crate) fn LLVMRustEraseInstFromParent(V: &Value);
17+
pub(crate) fn LLVMRustGetTerminator<'a>(B: &BasicBlock) -> &'a Value;
18+
pub(crate) fn LLVMRustVerifyFunction(V: &Value, action: LLVMRustVerifierFailureAction) -> Bool;
1819
}
1920

2021
extern "C" {
2122
// Enzyme
22-
pub fn LLVMDumpModule(M: &Module);
23-
pub fn LLVMDumpValue(V: &Value);
24-
pub fn LLVMGetFunctionCallConv(F: &Value) -> c_uint;
25-
pub fn LLVMGetReturnType(T: &Type) -> &Type;
26-
pub fn LLVMGetParams(Fnc: &Value, parms: *mut &Value);
27-
pub fn LLVMGetNamedFunction(M: &Module, Name: *const c_char) -> Option<&Value>;
23+
pub(crate) fn LLVMDumpModule(M: &Module);
24+
pub(crate) fn LLVMDumpValue(V: &Value);
25+
pub(crate) fn LLVMGetFunctionCallConv(F: &Value) -> c_uint;
26+
pub(crate) fn LLVMGetReturnType(T: &Type) -> &Type;
27+
pub(crate) fn LLVMGetParams(Fnc: &Value, parms: *mut &Value);
28+
pub(crate) fn LLVMGetNamedFunction(M: &Module, Name: *const c_char) -> Option<&Value>;
2829
}
2930

3031
#[repr(C)]

0 commit comments

Comments
 (0)