Skip to content

Commit b32dc44

Browse files
committed
Tweak imports to make the LLVM FFI bindings easier to move
1 parent 4f355c9 commit b32dc44

File tree

6 files changed

+21
-20
lines changed

6 files changed

+21
-20
lines changed
File renamed without changes.

compiler/rustc_codegen_llvm/src/coverageinfo/llvm_cov.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use std::ffi::CString;
44

5-
use crate::coverageinfo::ffi;
5+
use crate::coverageinfo::coverage_ffi as ffi;
66
use crate::llvm;
77

88
pub(crate) fn covmap_var_name() -> CString {

compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use tracing::debug;
2020

2121
use crate::common::CodegenCx;
2222
use crate::coverageinfo::mapgen::{GlobalFileTable, VirtualFileMapping, spans};
23-
use crate::coverageinfo::{ffi, llvm_cov};
23+
use crate::coverageinfo::{coverage_ffi as ffi, llvm_cov};
2424
use crate::llvm;
2525

2626
/// Intermediate coverage metadata for a single function, used to help build

compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/spans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use rustc_span::source_map::SourceMap;
22
use rustc_span::{BytePos, Pos, SourceFile, Span};
33
use tracing::debug;
44

5-
use crate::coverageinfo::ffi;
5+
use crate::coverageinfo::coverage_ffi as ffi;
66
use crate::coverageinfo::mapgen::LocalFileId;
77

88
/// Line and byte-column coordinates of a source code span within some file.

compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::builder::Builder;
1313
use crate::common::CodegenCx;
1414
use crate::llvm;
1515

16-
pub(crate) mod ffi;
16+
pub(crate) mod coverage_ffi;
1717
mod llvm_cov;
1818
mod mapgen;
1919

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@ use std::ptr;
1919

2020
use bitflags::bitflags;
2121
use libc::{c_char, c_int, c_uchar, c_uint, c_ulonglong, c_void, size_t};
22+
use rustc_llvm::RustString;
2223

23-
use super::RustString;
24-
use super::debuginfo::{
24+
use self::debuginfo::{
2525
DIArray, DIBuilder, DIDerivedType, DIDescriptor, DIEnumerator, DIFile, DIFlags,
2626
DIGlobalVariableExpression, DILocation, DISPFlags, DIScope, DISubprogram,
2727
DITemplateTypeParameter, DIType, DebugEmissionKind, DebugNameTableKind,
2828
};
29+
use crate::TryFromU32;
30+
use crate::coverageinfo::coverage_ffi;
2931
use crate::llvm::MetadataKindId;
30-
use crate::{TryFromU32, llvm};
3132

3233
/// In the LLVM-C API, boolean values are passed as `typedef int LLVMBool`,
3334
/// which has a different ABI from Rust or C++ `bool`.
@@ -75,13 +76,13 @@ impl Debug for Bool {
7576
/// Being able to write `b.to_llvm_bool()` is less noisy than `llvm::Bool::from(b)`,
7677
/// while being more explicit and less mistake-prone than something like `b.into()`.
7778
pub(crate) trait ToLlvmBool: Copy {
78-
fn to_llvm_bool(self) -> llvm::Bool;
79+
fn to_llvm_bool(self) -> Bool;
7980
}
8081

8182
impl ToLlvmBool for bool {
8283
#[inline(always)]
83-
fn to_llvm_bool(self) -> llvm::Bool {
84-
llvm::Bool::from_bool(self)
84+
fn to_llvm_bool(self) -> Bool {
85+
Bool::from_bool(self)
8586
}
8687
}
8788

@@ -882,10 +883,10 @@ unsafe extern "C" {
882883
AsmStringSize: size_t,
883884
Constraints: *const c_uchar, // See "PTR_LEN_STR".
884885
ConstraintsSize: size_t,
885-
HasSideEffects: llvm::Bool,
886-
IsAlignStack: llvm::Bool,
886+
HasSideEffects: Bool,
887+
IsAlignStack: Bool,
887888
Dialect: AsmDialect,
888-
CanThrow: llvm::Bool,
889+
CanThrow: Bool,
889890
) -> &'ll Value;
890891

891892
pub(crate) safe fn LLVMGetTypeKind(Ty: &Type) -> RawEnum<TypeKind>;
@@ -1655,7 +1656,7 @@ unsafe extern "C" {
16551656
ParentScope: Option<&'ll Metadata>,
16561657
Name: *const c_uchar, // See "PTR_LEN_STR".
16571658
NameLen: size_t,
1658-
ExportSymbols: llvm::Bool,
1659+
ExportSymbols: Bool,
16591660
) -> &'ll Metadata;
16601661

16611662
pub(crate) fn LLVMDIBuilderCreateLexicalBlock<'ll>(
@@ -1843,7 +1844,7 @@ unsafe extern "C" {
18431844
File: &'ll Metadata,
18441845
LineNo: c_uint,
18451846
Ty: &'ll Metadata,
1846-
AlwaysPreserve: llvm::Bool, // "If true, this descriptor will survive optimizations."
1847+
AlwaysPreserve: Bool, // "If true, this descriptor will survive optimizations."
18471848
Flags: DIFlags,
18481849
AlignInBits: u32,
18491850
) -> &'ll Metadata;
@@ -1857,7 +1858,7 @@ unsafe extern "C" {
18571858
File: &'ll Metadata,
18581859
LineNo: c_uint,
18591860
Ty: &'ll Metadata,
1860-
AlwaysPreserve: llvm::Bool, // "If true, this descriptor will survive optimizations."
1861+
AlwaysPreserve: Bool, // "If true, this descriptor will survive optimizations."
18611862
Flags: DIFlags,
18621863
) -> &'ll Metadata;
18631864
}
@@ -2084,13 +2085,13 @@ unsafe extern "C" {
20842085
pub(crate) fn LLVMRustCoverageWriteFunctionMappingsToBuffer(
20852086
VirtualFileMappingIDs: *const c_uint,
20862087
NumVirtualFileMappingIDs: size_t,
2087-
Expressions: *const crate::coverageinfo::ffi::CounterExpression,
2088+
Expressions: *const coverage_ffi::CounterExpression,
20882089
NumExpressions: size_t,
2089-
CodeRegions: *const crate::coverageinfo::ffi::CodeRegion,
2090+
CodeRegions: *const coverage_ffi::CodeRegion,
20902091
NumCodeRegions: size_t,
2091-
ExpansionRegions: *const crate::coverageinfo::ffi::ExpansionRegion,
2092+
ExpansionRegions: *const coverage_ffi::ExpansionRegion,
20922093
NumExpansionRegions: size_t,
2093-
BranchRegions: *const crate::coverageinfo::ffi::BranchRegion,
2094+
BranchRegions: *const coverage_ffi::BranchRegion,
20942095
NumBranchRegions: size_t,
20952096
BufferOut: &RustString,
20962097
);

0 commit comments

Comments
 (0)