Skip to content
/ rust Public
forked from rust-lang/rust

Commit 1c5a78f

Browse files
authored
Rollup merge of rust-lang#136721 - dpaoliello:cleanllvm2, r=Zalathar
cg_llvm: Reduce visibility of some items outside the `llvm` module Next piece of rust-lang#135502 This reduces the visibility of items (other than those in the `llvm` module) so that dead code analysis will correctly identify unused items.
2 parents 2715d4f + 5f29273 commit 1c5a78f

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

compiler/rustc_codegen_llvm/src/abi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ impl<'tcx> AbiBuilderMethods<'tcx> for Builder<'_, '_, 'tcx> {
664664
}
665665

666666
impl llvm::CallConv {
667-
pub fn from_conv(conv: Conv, arch: &str) -> Self {
667+
pub(crate) fn from_conv(conv: Conv, arch: &str) -> Self {
668668
match conv {
669669
Conv::C
670670
| Conv::Rust

compiler/rustc_codegen_llvm/src/back/lto.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ unsafe impl Send for ModuleBuffer {}
642642
unsafe impl Sync for ModuleBuffer {}
643643

644644
impl ModuleBuffer {
645-
pub fn new(m: &llvm::Module) -> ModuleBuffer {
645+
pub(crate) fn new(m: &llvm::Module) -> ModuleBuffer {
646646
ModuleBuffer(unsafe { llvm::LLVMRustModuleBufferCreate(m) })
647647
}
648648
}
@@ -684,7 +684,7 @@ unsafe impl Send for ThinBuffer {}
684684
unsafe impl Sync for ThinBuffer {}
685685

686686
impl ThinBuffer {
687-
pub fn new(m: &llvm::Module, is_thin: bool, emit_summary: bool) -> ThinBuffer {
687+
pub(crate) fn new(m: &llvm::Module, is_thin: bool, emit_summary: bool) -> ThinBuffer {
688688
unsafe {
689689
let buffer = llvm::LLVMRustThinLTOBufferCreate(m, is_thin, emit_summary);
690690
ThinBuffer(buffer)

compiler/rustc_codegen_llvm/src/back/owned_target_machine.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub struct OwnedTargetMachine {
1717
}
1818

1919
impl OwnedTargetMachine {
20-
pub fn new(
20+
pub(crate) fn new(
2121
triple: &CStr,
2222
cpu: &CStr,
2323
features: &CStr,

compiler/rustc_codegen_llvm/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use std::mem::ManuallyDrop;
3030
use back::owned_target_machine::OwnedTargetMachine;
3131
use back::write::{create_informational_target_machine, create_target_machine};
3232
use errors::{AutoDiffWithoutLTO, ParseTargetMachineConfig};
33-
pub use llvm_util::target_features_cfg;
33+
pub(crate) use llvm_util::target_features_cfg;
3434
use rustc_ast::expand::allocator::AllocatorKind;
3535
use rustc_ast::expand::autodiff_attrs::AutoDiffItem;
3636
use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule};

compiler/rustc_codegen_llvm/src/llvm_util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
303303
/// Must express features in the way Rust understands them.
304304
///
305305
/// We do not have to worry about RUSTC_SPECIFIC_FEATURES here, those are handled outside codegen.
306-
pub fn target_features_cfg(sess: &Session, allow_unstable: bool) -> Vec<Symbol> {
306+
pub(crate) fn target_features_cfg(sess: &Session, allow_unstable: bool) -> Vec<Symbol> {
307307
let mut features: FxHashSet<Symbol> = Default::default();
308308

309309
// Add base features for the target.

compiler/rustc_codegen_llvm/src/type_.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,11 @@ impl<'ll, 'tcx> BaseTypeCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
237237

238238
impl Type {
239239
/// Creates an integer type with the given number of bits, e.g., i24
240-
pub fn ix_llcx(llcx: &llvm::Context, num_bits: u64) -> &Type {
240+
pub(crate) fn ix_llcx(llcx: &llvm::Context, num_bits: u64) -> &Type {
241241
unsafe { llvm::LLVMIntTypeInContext(llcx, num_bits as c_uint) }
242242
}
243243

244-
pub fn ptr_llcx(llcx: &llvm::Context) -> &Type {
244+
pub(crate) fn ptr_llcx(llcx: &llvm::Context) -> &Type {
245245
unsafe { llvm::LLVMPointerTypeInContext(llcx, AddressSpace::DATA.0) }
246246
}
247247
}

0 commit comments

Comments
 (0)