Skip to content

Commit 98c4d96

Browse files
committed
Reduce visibility of coverage FFI functions/types
1 parent da93539 commit 98c4d96

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

compiler/rustc_codegen_llvm/src/coverageinfo/ffi.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_middle::mir::coverage::{
55
/// Must match the layout of `LLVMRustCounterKind`.
66
#[derive(Copy, Clone, Debug)]
77
#[repr(C)]
8-
pub enum CounterKind {
8+
pub(crate) enum CounterKind {
99
Zero = 0,
1010
CounterValueReference = 1,
1111
Expression = 2,
@@ -25,9 +25,9 @@ pub enum CounterKind {
2525
/// Must match the layout of `LLVMRustCounter`.
2626
#[derive(Copy, Clone, Debug)]
2727
#[repr(C)]
28-
pub struct Counter {
28+
pub(crate) struct Counter {
2929
// Important: The layout (order and types of fields) must match its C++ counterpart.
30-
pub kind: CounterKind,
30+
pub(crate) kind: CounterKind,
3131
id: u32,
3232
}
3333

@@ -36,7 +36,7 @@ impl Counter {
3636
pub(crate) const ZERO: Self = Self { kind: CounterKind::Zero, id: 0 };
3737

3838
/// Constructs a new `Counter` of kind `CounterValueReference`.
39-
pub fn counter_value_reference(counter_id: CounterId) -> Self {
39+
pub(crate) fn counter_value_reference(counter_id: CounterId) -> Self {
4040
Self { kind: CounterKind::CounterValueReference, id: counter_id.as_u32() }
4141
}
4242

@@ -59,7 +59,7 @@ impl Counter {
5959
/// Must match the layout of `LLVMRustCounterExprKind`.
6060
#[derive(Copy, Clone, Debug)]
6161
#[repr(C)]
62-
pub enum ExprKind {
62+
pub(crate) enum ExprKind {
6363
Subtract = 0,
6464
Add = 1,
6565
}
@@ -69,10 +69,10 @@ pub enum ExprKind {
6969
/// Must match the layout of `LLVMRustCounterExpression`.
7070
#[derive(Copy, Clone, Debug)]
7171
#[repr(C)]
72-
pub struct CounterExpression {
73-
pub kind: ExprKind,
74-
pub lhs: Counter,
75-
pub rhs: Counter,
72+
pub(crate) struct CounterExpression {
73+
pub(crate) kind: ExprKind,
74+
pub(crate) lhs: Counter,
75+
pub(crate) rhs: Counter,
7676
}
7777

7878
/// Corresponds to enum `llvm::coverage::CounterMappingRegion::RegionKind`.
@@ -199,7 +199,7 @@ mod mcdc {
199199
/// Must match the layout of `LLVMRustCounterMappingRegion`.
200200
#[derive(Copy, Clone, Debug)]
201201
#[repr(C)]
202-
pub struct CounterMappingRegion {
202+
pub(crate) struct CounterMappingRegion {
203203
/// The counter type and type-dependent counter data, if any.
204204
counter: Counter,
205205

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1740,7 +1740,7 @@ unsafe extern "C" {
17401740
) -> bool;
17411741

17421742
#[allow(improper_ctypes)]
1743-
pub fn LLVMRustCoverageWriteFilenamesSectionToBuffer(
1743+
pub(crate) fn LLVMRustCoverageWriteFilenamesSectionToBuffer(
17441744
Filenames: *const *const c_char,
17451745
FilenamesLen: size_t,
17461746
Lengths: *const size_t,
@@ -1749,7 +1749,7 @@ unsafe extern "C" {
17491749
);
17501750

17511751
#[allow(improper_ctypes)]
1752-
pub fn LLVMRustCoverageWriteMappingToBuffer(
1752+
pub(crate) fn LLVMRustCoverageWriteMappingToBuffer(
17531753
VirtualFileMappingIDs: *const c_uint,
17541754
NumVirtualFileMappingIDs: c_uint,
17551755
Expressions: *const crate::coverageinfo::ffi::CounterExpression,
@@ -1759,23 +1759,23 @@ unsafe extern "C" {
17591759
BufferOut: &RustString,
17601760
);
17611761

1762-
pub fn LLVMRustCoverageCreatePGOFuncNameVar(
1762+
pub(crate) fn LLVMRustCoverageCreatePGOFuncNameVar(
17631763
F: &Value,
17641764
FuncName: *const c_char,
17651765
FuncNameLen: size_t,
17661766
) -> &Value;
1767-
pub fn LLVMRustCoverageHashByteArray(Bytes: *const c_char, NumBytes: size_t) -> u64;
1767+
pub(crate) fn LLVMRustCoverageHashByteArray(Bytes: *const c_char, NumBytes: size_t) -> u64;
17681768

17691769
#[allow(improper_ctypes)]
1770-
pub fn LLVMRustCoverageWriteMapSectionNameToString(M: &Module, Str: &RustString);
1770+
pub(crate) fn LLVMRustCoverageWriteMapSectionNameToString(M: &Module, Str: &RustString);
17711771

17721772
#[allow(improper_ctypes)]
1773-
pub fn LLVMRustCoverageWriteFuncSectionNameToString(M: &Module, Str: &RustString);
1773+
pub(crate) fn LLVMRustCoverageWriteFuncSectionNameToString(M: &Module, Str: &RustString);
17741774

17751775
#[allow(improper_ctypes)]
1776-
pub fn LLVMRustCoverageWriteMappingVarNameToString(Str: &RustString);
1776+
pub(crate) fn LLVMRustCoverageWriteMappingVarNameToString(Str: &RustString);
17771777

1778-
pub fn LLVMRustCoverageMappingVersion() -> u32;
1778+
pub(crate) fn LLVMRustCoverageMappingVersion() -> u32;
17791779
pub fn LLVMRustDebugMetadataVersion() -> u32;
17801780
pub fn LLVMRustVersionMajor() -> u32;
17811781
pub fn LLVMRustVersionMinor() -> u32;

0 commit comments

Comments
 (0)