Skip to content

Commit 61f4773

Browse files
committed
codegen_llvm: whitespace & formatting improvements
1 parent ef5c00d commit 61f4773

File tree

4 files changed

+14
-25
lines changed

4 files changed

+14
-25
lines changed

src/librustc_codegen_llvm/abi.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,7 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> {
259259
}
260260

261261
pub trait FnTypeExt<'tcx> {
262-
fn of_instance(cx: &CodegenCx<'ll, 'tcx>, instance: &ty::Instance<'tcx>)
263-
-> Self;
262+
fn of_instance(cx: &CodegenCx<'ll, 'tcx>, instance: &ty::Instance<'tcx>) -> Self;
264263
fn new(cx: &CodegenCx<'ll, 'tcx>,
265264
sig: ty::FnSig<'tcx>,
266265
extra_args: &[Ty<'tcx>]) -> Self;
@@ -283,8 +282,7 @@ pub trait FnTypeExt<'tcx> {
283282
}
284283

285284
impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
286-
fn of_instance(cx: &CodegenCx<'ll, 'tcx>, instance: &ty::Instance<'tcx>)
287-
-> Self {
285+
fn of_instance(cx: &CodegenCx<'ll, 'tcx>, instance: &ty::Instance<'tcx>) -> Self {
288286
let fn_ty = instance.ty(cx.tcx);
289287
let sig = ty_fn_sig(cx, fn_ty);
290288
let sig = cx.tcx.normalize_erasing_late_bound_regions(ty::ParamEnv::reveal_all(), &sig);

src/librustc_codegen_llvm/base.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -737,8 +737,8 @@ fn determine_cgu_reuse<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
737737

738738
pub fn codegen_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
739739
rx: mpsc::Receiver<Box<dyn Any + Send>>)
740-
-> OngoingCodegen {
741-
740+
-> OngoingCodegen
741+
{
742742
check_for_rustc_errors_attr(tcx);
743743

744744
if let Some(true) = tcx.sess.opts.debugging_opts.thinlto {
@@ -803,8 +803,7 @@ pub fn codegen_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
803803

804804
// Run the monomorphization collector and partition the collected items into
805805
// codegen units.
806-
let codegen_units =
807-
tcx.collect_and_partition_mono_items(LOCAL_CRATE).1;
806+
let codegen_units = tcx.collect_and_partition_mono_items(LOCAL_CRATE).1;
808807
let codegen_units = (*codegen_units).clone();
809808

810809
// Force all codegen_unit queries so they are already either red or green

src/librustc_codegen_llvm/builder.rs

Whitespace-only changes.

src/librustc_codegen_llvm/consts.rs

Whitespace-only changes.

src/librustc_codegen_llvm/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ pub struct CodegenCx<'a, 'tcx: 'a> {
5959
/// Cache instances of monomorphic and polymorphic items
6060
pub instances: RefCell<FxHashMap<Instance<'tcx>, &'a Value>>,
6161
/// Cache generated vtables
62-
pub vtables: RefCell<FxHashMap<(Ty<'tcx>,
63-
Option<ty::PolyExistentialTraitRef<'tcx>>), &'a Value>>,
62+
pub vtables: RefCell<FxHashMap<(Ty<'tcx>, Option<ty::PolyExistentialTraitRef<'tcx>>),
63+
&'a Value>>,
6464
/// Cache of constant strings,
6565
pub const_cstr_cache: RefCell<FxHashMap<LocalInternedString, &'a Value>>,
6666

src/librustc_codegen_llvm/glue.rs

Whitespace-only changes.

src/librustc_codegen_llvm/intrinsic.rs

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@ pub fn codegen_intrinsic_call(
373373
return;
374374
}
375375
}
376-
377376
},
378377
"fadd_fast" | "fsub_fast" | "fmul_fast" | "fdiv_fast" | "frem_fast" => {
379378
let sty = &arg_tys[0].sty;
@@ -822,8 +821,7 @@ fn codegen_msvc_try(
822821
let i64p = Type::i64(cx).ptr_to();
823822
let ptr_align = bx.tcx().data_layout.pointer_align;
824823
let slot = bx.alloca(i64p, "slot", ptr_align);
825-
bx.invoke(func, &[data], normal.llbb(), catchswitch.llbb(),
826-
None);
824+
bx.invoke(func, &[data], normal.llbb(), catchswitch.llbb(), None);
827825

828826
normal.ret(C_i32(cx, 0));
829827

@@ -911,8 +909,7 @@ fn codegen_gnu_try(
911909
// being thrown. The second value is a "selector" indicating which of
912910
// the landing pad clauses the exception's type had been matched to.
913911
// rust_try ignores the selector.
914-
let lpad_ty = Type::struct_(cx, &[Type::i8p(cx), Type::i32(cx)],
915-
false);
912+
let lpad_ty = Type::struct_(cx, &[Type::i8p(cx), Type::i32(cx)], false);
916913
let vals = catch.landing_pad(lpad_ty, bx.cx.eh_personality(), 1);
917914
catch.add_clause(vals, C_null(Type::i8p(cx)));
918915
let ptr = catch.extract_value(vals, 0);
@@ -1000,11 +997,11 @@ fn generic_simd_intrinsic(
1000997
($msg: tt, $($fmt: tt)*) => {
1001998
span_invalid_monomorphization_error(
1002999
bx.sess(), span,
1003-
&format!(concat!("invalid monomorphization of `{}` intrinsic: ",
1004-
$msg),
1000+
&format!(concat!("invalid monomorphization of `{}` intrinsic: ", $msg),
10051001
name, $($fmt)*));
10061002
}
10071003
}
1004+
10081005
macro_rules! return_error {
10091006
($($fmt: tt)*) => {
10101007
{
@@ -1021,14 +1018,13 @@ fn generic_simd_intrinsic(
10211018
}
10221019
};
10231020
}
1021+
10241022
macro_rules! require_simd {
10251023
($ty: expr, $position: expr) => {
10261024
require!($ty.is_simd(), "expected SIMD {} type, found non-SIMD `{}`", $position, $ty)
10271025
}
10281026
}
10291027

1030-
1031-
10321028
let tcx = bx.tcx();
10331029
let sig = tcx.normalize_erasing_late_bound_regions(
10341030
ty::ParamEnv::reveal_all(),
@@ -1150,9 +1146,7 @@ fn generic_simd_intrinsic(
11501146
);
11511147
match m_elem_ty.sty {
11521148
ty::Int(_) => {},
1153-
_ => {
1154-
return_error!("mask element type is `{}`, expected `i_`", m_elem_ty);
1155-
}
1149+
_ => return_error!("mask element type is `{}`, expected `i_`", m_elem_ty)
11561150
}
11571151
// truncate the mask to a vector of i1s
11581152
let i1 = Type::i1(bx.cx);
@@ -1177,8 +1171,7 @@ fn generic_simd_intrinsic(
11771171
($msg: tt, $($fmt: tt)*) => {
11781172
span_invalid_monomorphization_error(
11791173
bx.sess(), span,
1180-
&format!(concat!("invalid monomorphization of `{}` intrinsic: ",
1181-
$msg),
1174+
&format!(concat!("invalid monomorphization of `{}` intrinsic: ", $msg),
11821175
name, $($fmt)*));
11831176
}
11841177
}
@@ -1570,7 +1563,6 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
15701563
)
15711564
}
15721565
}
1573-
15741566
};
15751567
Ok(bx.$float_reduce(acc, args[0].immediate()))
15761568
}

src/librustc_codegen_llvm/lib.rs

Whitespace-only changes.

src/librustc_codegen_llvm/metadata.rs

Whitespace-only changes.

src/librustc_codegen_llvm/mir/analyze.rs

Whitespace-only changes.

src/librustc_codegen_llvm/mir/block.rs

Whitespace-only changes.

src/librustc_codegen_llvm/mono_item.rs

Whitespace-only changes.

src/librustc_codegen_llvm/type_of.rs

Whitespace-only changes.

0 commit comments

Comments
 (0)