Skip to content

Commit 471234f

Browse files
committed
Sync from rust 3d127e2
2 parents 164aa39 + 648d038 commit 471234f

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

src/archive.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,6 @@ impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> {
113113
Ok(())
114114
}
115115

116-
fn update_symbols(&mut self) {
117-
}
118-
119116
fn build(mut self) {
120117
use std::process::Command;
121118

src/builder.rs

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -390,11 +390,6 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
390390
bx
391391
}
392392

393-
fn build_sibling_block(&mut self, name: &str) -> Self {
394-
let block = self.append_sibling_block(name);
395-
Self::build(self.cx, block)
396-
}
397-
398393
fn llbb(&self) -> Block<'gcc> {
399394
self.block.expect("block")
400395
}
@@ -409,6 +404,11 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
409404
func.new_block(name)
410405
}
411406

407+
fn switch_to_block(&mut self, block: Self::BasicBlock) {
408+
*self.cx.current_block.borrow_mut() = Some(block);
409+
self.block = Some(block);
410+
}
411+
412412
fn ret_void(&mut self) {
413413
self.llbb().end_with_void_return(None)
414414
}
@@ -747,28 +747,31 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
747747
let start = dest.project_index(&mut self, zero).llval;
748748
let end = dest.project_index(&mut self, count).llval;
749749

750-
let mut header_bx = self.build_sibling_block("repeat_loop_header");
751-
let mut body_bx = self.build_sibling_block("repeat_loop_body");
752-
let next_bx = self.build_sibling_block("repeat_loop_next");
750+
let header_bb = self.append_sibling_block("repeat_loop_header");
751+
let body_bb = self.append_sibling_block("repeat_loop_body");
752+
let next_bb = self.append_sibling_block("repeat_loop_next");
753753

754754
let ptr_type = start.get_type();
755755
let current = self.llbb().get_function().new_local(None, ptr_type, "loop_var");
756756
let current_val = current.to_rvalue();
757757
self.assign(current, start);
758758

759-
self.br(header_bx.llbb());
759+
self.br(header_bb);
760760

761-
let keep_going = header_bx.icmp(IntPredicate::IntNE, current_val, end);
762-
header_bx.cond_br(keep_going, body_bx.llbb(), next_bx.llbb());
761+
self.switch_to_block(header_bb);
762+
let keep_going = self.icmp(IntPredicate::IntNE, current_val, end);
763+
self.cond_br(keep_going, body_bb, next_bb);
763764

765+
self.switch_to_block(body_bb);
764766
let align = dest.align.restrict_for_offset(dest.layout.field(self.cx(), 0).size);
765-
cg_elem.val.store(&mut body_bx, PlaceRef::new_sized_aligned(current_val, cg_elem.layout, align));
767+
cg_elem.val.store(&mut self, PlaceRef::new_sized_aligned(current_val, cg_elem.layout, align));
766768

767-
let next = body_bx.inbounds_gep(self.backend_type(cg_elem.layout), current.to_rvalue(), &[self.const_usize(1)]);
768-
body_bx.llbb().add_assignment(None, current, next);
769-
body_bx.br(header_bx.llbb());
769+
let next = self.inbounds_gep(self.backend_type(cg_elem.layout), current.to_rvalue(), &[self.const_usize(1)]);
770+
self.llbb().add_assignment(None, current, next);
771+
self.br(header_bb);
770772

771-
next_bx
773+
self.switch_to_block(next_bb);
774+
self
772775
}
773776

774777
fn range_metadata(&mut self, _load: RValue<'gcc>, _range: WrappingRange) {

src/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ impl<'gcc, 'tcx> StaticMethods for CodegenCx<'gcc, 'tcx> {
149149
// TODO(antoyo): set link section.
150150
}
151151

152-
if attrs.flags.contains(CodegenFnAttrFlags::USED) {
152+
if attrs.flags.contains(CodegenFnAttrFlags::USED) || attrs.flags.contains(CodegenFnAttrFlags::USED_LINKER) {
153153
self.add_used_global(global.to_rvalue());
154154
}
155155
}

src/type_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub fn uncached_gcc_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, layout: TyAndLa
5252
ty::Adt(..) | ty::Closure(..) | ty::Foreign(..) | ty::Generator(..) | ty::Str
5353
if !cx.sess().fewer_names() =>
5454
{
55-
let mut name = with_no_trimmed_paths(|| layout.ty.to_string());
55+
let mut name = with_no_trimmed_paths!(layout.ty.to_string());
5656
if let (&ty::Adt(def, _), &Variants::Single { index }) =
5757
(layout.ty.kind(), &layout.variants)
5858
{

0 commit comments

Comments
 (0)