Skip to content

Commit 8efd9dd

Browse files
committed
codegen_llvm/misc: whitespace & formatting improvements
1 parent b1a137d commit 8efd9dd

File tree

5 files changed

+46
-45
lines changed

5 files changed

+46
-45
lines changed

src/librustc_codegen_llvm/debuginfo/metadata.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -582,12 +582,12 @@ pub fn type_metadata(
582582
}
583583
ty::Dynamic(..) => {
584584
MetadataCreationResult::new(
585-
trait_pointer_metadata(cx, t, None, unique_type_id),
586-
false)
585+
trait_pointer_metadata(cx, t, None, unique_type_id),
586+
false)
587587
}
588588
ty::Foreign(..) => {
589589
MetadataCreationResult::new(
590-
foreign_type_metadata(cx, t, unique_type_id),
590+
foreign_type_metadata(cx, t, unique_type_id),
591591
false)
592592
}
593593
ty::RawPtr(ty::TypeAndMut{ty, ..}) |
@@ -646,16 +646,16 @@ pub fn type_metadata(
646646
}
647647
AdtKind::Union => {
648648
prepare_union_metadata(cx,
649-
t,
650-
unique_type_id,
651-
usage_site_span).finalize(cx)
649+
t,
650+
unique_type_id,
651+
usage_site_span).finalize(cx)
652652
}
653653
AdtKind::Enum => {
654654
prepare_enum_metadata(cx,
655-
t,
656-
def.did,
657-
unique_type_id,
658-
usage_site_span).finalize(cx)
655+
t,
656+
def.did,
657+
unique_type_id,
658+
usage_site_span).finalize(cx)
659659
}
660660
},
661661
ty::Tuple(ref elements) => {
@@ -943,7 +943,7 @@ enum MemberDescriptionFactory<'ll, 'tcx> {
943943

944944
impl MemberDescriptionFactory<'ll, 'tcx> {
945945
fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>)
946-
-> Vec<MemberDescription<'ll>> {
946+
-> Vec<MemberDescription<'ll>> {
947947
match *self {
948948
StructMDF(ref this) => {
949949
this.create_member_descriptions(cx)
@@ -977,7 +977,7 @@ struct StructMemberDescriptionFactory<'tcx> {
977977

978978
impl<'tcx> StructMemberDescriptionFactory<'tcx> {
979979
fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>)
980-
-> Vec<MemberDescription<'ll>> {
980+
-> Vec<MemberDescription<'ll>> {
981981
let layout = cx.layout_of(self.ty);
982982
self.variant.fields.iter().enumerate().map(|(i, f)| {
983983
let name = if self.variant.ctor_kind == CtorKind::Fn {
@@ -1047,7 +1047,7 @@ struct TupleMemberDescriptionFactory<'tcx> {
10471047

10481048
impl<'tcx> TupleMemberDescriptionFactory<'tcx> {
10491049
fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>)
1050-
-> Vec<MemberDescription<'ll>> {
1050+
-> Vec<MemberDescription<'ll>> {
10511051
let layout = cx.layout_of(self.ty);
10521052
self.component_types.iter().enumerate().map(|(i, &component_type)| {
10531053
let (size, align) = cx.size_and_align_of(component_type);
@@ -1101,7 +1101,7 @@ struct UnionMemberDescriptionFactory<'tcx> {
11011101

11021102
impl<'tcx> UnionMemberDescriptionFactory<'tcx> {
11031103
fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>)
1104-
-> Vec<MemberDescription<'ll>> {
1104+
-> Vec<MemberDescription<'ll>> {
11051105
self.variant.fields.iter().enumerate().map(|(i, f)| {
11061106
let field = self.layout.field(cx, i);
11071107
let (size, align) = field.size_and_align();
@@ -1170,7 +1170,7 @@ struct EnumMemberDescriptionFactory<'ll, 'tcx> {
11701170

11711171
impl EnumMemberDescriptionFactory<'ll, 'tcx> {
11721172
fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>)
1173-
-> Vec<MemberDescription<'ll>> {
1173+
-> Vec<MemberDescription<'ll>> {
11741174
let adt = &self.enum_type.ty_adt_def().unwrap();
11751175
match self.layout.variants {
11761176
layout::Variants::Single { .. } if adt.variants.is_empty() => vec![],

src/librustc_codegen_llvm/debuginfo/type_names.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
179179
ty::GeneratorWitness(..) |
180180
ty::Param(_) => {
181181
bug!("debuginfo: Trying to create type name for \
182-
unexpected type: {:?}", t);
182+
unexpected type: {:?}", t);
183183
}
184184
}
185185

src/librustc_codegen_llvm/mir/analyze.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ impl Visitor<'tcx> for LocalAnalyzer<'mir, 'a, 'll, 'tcx> {
151151
}
152152

153153
fn visit_place(&mut self,
154-
place: &mir::Place<'tcx>,
155-
context: PlaceContext<'tcx>,
156-
location: Location) {
154+
place: &mir::Place<'tcx>,
155+
context: PlaceContext<'tcx>,
156+
location: Location) {
157157
debug!("visit_place(place={:?}, context={:?})", place, context);
158158
let cx = self.fx.cx;
159159

src/librustc_codegen_llvm/mir/block.rs

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ impl FunctionCx<'a, 'll, 'tcx> {
4949
}
5050

5151
fn codegen_terminator(&mut self,
52-
mut bx: Builder<'a, 'll, 'tcx>,
53-
bb: mir::BasicBlock,
54-
terminator: &mir::Terminator<'tcx>)
52+
mut bx: Builder<'a, 'll, 'tcx>,
53+
bb: mir::BasicBlock,
54+
terminator: &mir::Terminator<'tcx>)
5555
{
5656
debug!("codegen_terminator: {:?}", terminator);
5757

@@ -125,10 +125,10 @@ impl FunctionCx<'a, 'll, 'tcx> {
125125
this.unreachable_block()
126126
};
127127
let invokeret = bx.invoke(fn_ptr,
128-
&llargs,
129-
ret_bx,
130-
llblock(this, cleanup),
131-
cleanup_bundle);
128+
&llargs,
129+
ret_bx,
130+
llblock(this, cleanup),
131+
cleanup_bundle);
132132
fn_ty.apply_attrs_callsite(&bx, invokeret);
133133

134134
if let Some((ret_dest, target)) = destination {
@@ -213,7 +213,8 @@ impl FunctionCx<'a, 'll, 'tcx> {
213213
} else {
214214
let (otherwise, targets) = targets.split_last().unwrap();
215215
let switch = bx.switch(discr.immediate(),
216-
llblock(self, *otherwise), values.len());
216+
llblock(self, *otherwise),
217+
values.len());
217218
let switch_llty = bx.cx.layout_of(switch_ty).immediate_llvm_type(bx.cx);
218219
for (&value, target) in values.iter().zip(targets) {
219220
let llval = C_uint_big(switch_llty, value);
@@ -387,8 +388,8 @@ impl FunctionCx<'a, 'll, 'tcx> {
387388
let msg_str = Symbol::intern(str).as_str();
388389
let msg_str = C_str_slice(bx.cx, msg_str);
389390
let msg_file_line_col = C_struct(bx.cx,
390-
&[msg_str, filename, line, col],
391-
false);
391+
&[msg_str, filename, line, col],
392+
false);
392393
let msg_file_line_col = consts::addr_of(bx.cx,
393394
msg_file_line_col,
394395
align,
@@ -509,8 +510,8 @@ impl FunctionCx<'a, 'll, 'tcx> {
509510
let msg_str = Symbol::intern(&str).as_str();
510511
let msg_str = C_str_slice(bx.cx, msg_str);
511512
let msg_file_line_col = C_struct(bx.cx,
512-
&[msg_str, filename, line, col],
513-
false);
513+
&[msg_str, filename, line, col],
514+
false);
514515
let msg_file_line_col = consts::addr_of(bx.cx,
515516
msg_file_line_col,
516517
align,
@@ -619,7 +620,7 @@ impl FunctionCx<'a, 'll, 'tcx> {
619620

620621
let callee_ty = instance.as_ref().unwrap().ty(bx.cx.tcx);
621622
codegen_intrinsic_call(&bx, callee_ty, &fn_ty, &args, dest,
622-
terminator.source_info.span);
623+
terminator.source_info.span);
623624

624625
if let ReturnDest::IndirectOperand(dst, _) = ret_dest {
625626
self.store_return(&bx, ret_dest, &fn_ty.ret, dst.llval);
@@ -756,7 +757,7 @@ impl FunctionCx<'a, 'll, 'tcx> {
756757
// Have to load the argument, maybe while casting it.
757758
if let PassMode::Cast(ty) = arg.mode {
758759
llval = bx.load(bx.pointercast(llval, ty.llvm_type(bx.cx).ptr_to()),
759-
align.min(arg.layout.align));
760+
align.min(arg.layout.align));
760761
} else {
761762
// We can't use `PlaceRef::load` here because the argument
762763
// may have a type we don't treat as immediate, but the ABI
@@ -778,10 +779,10 @@ impl FunctionCx<'a, 'll, 'tcx> {
778779
}
779780

780781
fn codegen_arguments_untupled(&mut self,
781-
bx: &Builder<'a, 'll, 'tcx>,
782-
operand: &mir::Operand<'tcx>,
783-
llargs: &mut Vec<&'ll Value>,
784-
args: &[ArgType<'tcx, Ty<'tcx>>]) {
782+
bx: &Builder<'a, 'll, 'tcx>,
783+
operand: &mir::Operand<'tcx>,
784+
llargs: &mut Vec<&'ll Value>,
785+
args: &[ArgType<'tcx, Ty<'tcx>>]) {
785786
let tuple = self.codegen_operand(bx, operand);
786787

787788
// Handle both by-ref and immediate tuples.
@@ -933,8 +934,8 @@ impl FunctionCx<'a, 'll, 'tcx> {
933934
}
934935

935936
fn codegen_transmute(&mut self, bx: &Builder<'a, 'll, 'tcx>,
936-
src: &mir::Operand<'tcx>,
937-
dst: &mir::Place<'tcx>) {
937+
src: &mir::Operand<'tcx>,
938+
dst: &mir::Place<'tcx>) {
938939
if let mir::Place::Local(index) = *dst {
939940
match self.locals[index] {
940941
LocalRef::Place(place) => self.codegen_transmute_into(bx, src, place),
@@ -961,8 +962,8 @@ impl FunctionCx<'a, 'll, 'tcx> {
961962
}
962963

963964
fn codegen_transmute_into(&mut self, bx: &Builder<'a, 'll, 'tcx>,
964-
src: &mir::Operand<'tcx>,
965-
dst: PlaceRef<'ll, 'tcx>) {
965+
src: &mir::Operand<'tcx>,
966+
dst: PlaceRef<'ll, 'tcx>) {
966967
let src = self.codegen_operand(bx, src);
967968
let llty = src.layout.llvm_type(bx.cx);
968969
let cast_ptr = bx.pointercast(dst.llval, llty.ptr_to());

src/librustc_codegen_llvm/mir/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,16 +162,16 @@ impl FunctionCx<'a, 'll, 'tcx> {
162162
// corresponding to span's containing source scope. If so, we need to create a DIScope
163163
// "extension" into that file.
164164
fn scope_metadata_for_loc(&self, scope_id: mir::SourceScope, pos: BytePos)
165-
-> Option<&'ll DIScope> {
165+
-> Option<&'ll DIScope> {
166166
let scope_metadata = self.scopes[scope_id].scope_metadata;
167167
if pos < self.scopes[scope_id].file_start_pos ||
168168
pos >= self.scopes[scope_id].file_end_pos {
169169
let cm = self.cx.sess().source_map();
170170
let defining_crate = self.debug_context.get_ref(DUMMY_SP).defining_crate;
171171
Some(debuginfo::extend_scope_to_file(self.cx,
172-
scope_metadata.unwrap(),
173-
&cm.lookup_char_pos(pos).file,
174-
defining_crate))
172+
scope_metadata.unwrap(),
173+
&cm.lookup_char_pos(pos).file,
174+
defining_crate))
175175
} else {
176176
scope_metadata
177177
}

0 commit comments

Comments
 (0)