Skip to content

Commit 484e07c

Browse files
committed
[eddyb/rebase cleanup] s/&self./self.
1 parent 0a1c509 commit 484e07c

File tree

4 files changed

+79
-79
lines changed

4 files changed

+79
-79
lines changed

src/librustc_codegen_llvm/builder.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
761761
}).collect::<Vec<_>>();
762762

763763
debug!("Asm Output Type: {:?}", output);
764-
let fty = &self.cx().type_func(&argtys[..], output);
764+
let fty = self.cx().type_func(&argtys[..], output);
765765
unsafe {
766766
// Ask LLVM to verify that the constraints are well-formed.
767767
let constraints_ok = llvm::LLVMRustInlineAsmVerify(fty, cons);
@@ -896,9 +896,9 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
896896
fn vector_splat(&self, num_elts: usize, elt: &'ll Value) -> &'ll Value {
897897
unsafe {
898898
let elt_ty = self.cx.val_ty(elt);
899-
let undef = llvm::LLVMGetUndef(&self.cx().type_vector(elt_ty, num_elts as u64));
899+
let undef = llvm::LLVMGetUndef(self.cx().type_vector(elt_ty, num_elts as u64));
900900
let vec = self.insert_element(undef, elt, self.cx.const_i32(0));
901-
let vec_i32_ty = &self.cx().type_vector(&self.cx().type_i32(), num_elts as u64);
901+
let vec_i32_ty = self.cx().type_vector(self.cx().type_i32(), num_elts as u64);
902902
self.shuffle_vector(vec, undef, self.cx().const_null(vec_i32_ty))
903903
}
904904
}
@@ -1305,6 +1305,6 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
13051305
}
13061306

13071307
fn cx(&self) -> &'a CodegenCx<'ll, 'tcx> {
1308-
&self.cx
1308+
self.cx
13091309
}
13101310
}

src/librustc_codegen_llvm/common.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -255,19 +255,19 @@ impl<'ll, 'tcx: 'll> ConstMethods for CodegenCx<'ll, 'tcx> {
255255
}
256256

257257
fn const_bool(&self, val: bool) -> &'ll Value {
258-
&self.const_uint(&self.type_i1(), val as u64)
258+
self.const_uint(self.type_i1(), val as u64)
259259
}
260260

261261
fn const_i32(&self, i: i32) -> &'ll Value {
262-
&self.const_int(&self.type_i32(), i as i64)
262+
self.const_int(self.type_i32(), i as i64)
263263
}
264264

265265
fn const_u32(&self, i: u32) -> &'ll Value {
266-
&self.const_uint(&self.type_i32(), i as u64)
266+
self.const_uint(self.type_i32(), i as u64)
267267
}
268268

269269
fn const_u64(&self, i: u64) -> &'ll Value {
270-
&self.const_uint(&self.type_i64(), i)
270+
self.const_uint(self.type_i64(), i)
271271
}
272272

273273
fn const_usize(&self, i: u64) -> &'ll Value {
@@ -277,11 +277,11 @@ impl<'ll, 'tcx: 'll> ConstMethods for CodegenCx<'ll, 'tcx> {
277277
assert!(i < (1<<bit_size));
278278
}
279279

280-
&self.const_uint(&self.isize_ty, i)
280+
self.const_uint(self.isize_ty, i)
281281
}
282282

283283
fn const_u8(&self, i: u8) -> &'ll Value {
284-
&self.const_uint(&self.type_i8(), i as u64)
284+
self.const_uint(self.type_i8(), i as u64)
285285
}
286286

287287

@@ -293,23 +293,23 @@ impl<'ll, 'tcx: 'll> ConstMethods for CodegenCx<'ll, 'tcx> {
293293
null_terminated: bool,
294294
) -> &'ll Value {
295295
unsafe {
296-
if let Some(&llval) = &self.const_cstr_cache.borrow().get(&s) {
296+
if let Some(&llval) = self.const_cstr_cache.borrow().get(&s) {
297297
return llval;
298298
}
299299

300-
let sc = llvm::LLVMConstStringInContext(&self.llcx,
300+
let sc = llvm::LLVMConstStringInContext(self.llcx,
301301
s.as_ptr() as *const c_char,
302302
s.len() as c_uint,
303303
!null_terminated as Bool);
304-
let sym = &self.generate_local_symbol_name("str");
305-
let g = declare::define_global(&self, &sym[..], &self.val_ty(sc)).unwrap_or_else(||{
304+
let sym = self.generate_local_symbol_name("str");
305+
let g = declare::define_global(&self, &sym[..], self.val_ty(sc)).unwrap_or_else(||{
306306
bug!("symbol `{}` is already defined", sym);
307307
});
308308
llvm::LLVMSetInitializer(g, sc);
309309
llvm::LLVMSetGlobalConstant(g, True);
310310
llvm::LLVMRustSetLinkage(g, llvm::Linkage::InternalLinkage);
311311

312-
&self.const_cstr_cache.borrow_mut().insert(s, g);
312+
self.const_cstr_cache.borrow_mut().insert(s, g);
313313
g
314314
}
315315
}
@@ -318,9 +318,9 @@ impl<'ll, 'tcx: 'll> ConstMethods for CodegenCx<'ll, 'tcx> {
318318
// you will be kicked off fast isel. See issue #4352 for an example of this.
319319
fn const_str_slice(&self, s: LocalInternedString) -> &'ll Value {
320320
let len = s.len();
321-
let cs = consts::ptrcast(&self.const_cstr(s, false),
322-
&self.type_ptr_to(&self.layout_of(&self.tcx.mk_str()).llvm_type(&self)));
323-
&self.const_fat_ptr(cs, &self.const_usize(len as u64))
321+
let cs = consts::ptrcast(self.const_cstr(s, false),
322+
self.type_ptr_to(self.layout_of(self.tcx.mk_str()).llvm_type(&self)));
323+
self.const_fat_ptr(cs, self.const_usize(len as u64))
324324
}
325325

326326
fn const_fat_ptr(
@@ -330,15 +330,15 @@ impl<'ll, 'tcx: 'll> ConstMethods for CodegenCx<'ll, 'tcx> {
330330
) -> &'ll Value {
331331
assert_eq!(abi::FAT_PTR_ADDR, 0);
332332
assert_eq!(abi::FAT_PTR_EXTRA, 1);
333-
&self.const_struct(&[ptr, meta], false)
333+
self.const_struct(&[ptr, meta], false)
334334
}
335335

336336
fn const_struct(
337337
&self,
338338
elts: &[&'ll Value],
339339
packed: bool
340340
) -> &'ll Value {
341-
struct_in_context(&self.llcx, elts, packed)
341+
struct_in_context(self.llcx, elts, packed)
342342
}
343343

344344
fn const_array(&self, ty: &'ll Type, elts: &[&'ll Value]) -> &'ll Value {
@@ -354,7 +354,7 @@ impl<'ll, 'tcx: 'll> ConstMethods for CodegenCx<'ll, 'tcx> {
354354
}
355355

356356
fn const_bytes(&self, bytes: &[u8]) -> &'ll Value {
357-
bytes_in_context(&self.llcx, bytes)
357+
bytes_in_context(self.llcx, bytes)
358358
}
359359

360360
fn const_get_elt(&self, v: &'ll Value, idx: u64) -> &'ll Value {

src/librustc_codegen_llvm/consts.rs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,16 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
137137
) -> &'ll Value {
138138
unsafe {
139139
let gv = match kind {
140-
Some(kind) if !&self.tcx.sess.fewer_names() => {
141-
let name = &self.generate_local_symbol_name(kind);
140+
Some(kind) if !self.tcx.sess.fewer_names() => {
141+
let name = self.generate_local_symbol_name(kind);
142142
let gv = declare::define_global(&self, &name[..],
143-
&self.val_ty(cv)).unwrap_or_else(||{
143+
self.val_ty(cv)).unwrap_or_else(||{
144144
bug!("symbol `{}` is already defined", name);
145145
});
146146
llvm::LLVMRustSetLinkage(gv, llvm::Linkage::PrivateLinkage);
147147
gv
148148
},
149-
_ => declare::define_private_global(&self, &self.val_ty(cv)),
149+
_ => declare::define_private_global(&self, self.val_ty(cv)),
150150
};
151151
llvm::LLVMSetInitializer(gv, cv);
152152
set_global_alignment(&self, gv, align);
@@ -161,7 +161,7 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
161161
align: Align,
162162
kind: Option<&str>,
163163
) -> &'ll Value {
164-
if let Some(&gv) = &self.const_globals.borrow().get(&cv) {
164+
if let Some(&gv) = self.const_globals.borrow().get(&cv) {
165165
unsafe {
166166
// Upgrade the alignment in cases where the same constant is used with different
167167
// alignment requirements
@@ -172,21 +172,21 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
172172
}
173173
return gv;
174174
}
175-
let gv = &self.static_addr_of_mut(cv, align, kind);
175+
let gv = self.static_addr_of_mut(cv, align, kind);
176176
unsafe {
177177
llvm::LLVMSetGlobalConstant(gv, True);
178178
}
179-
&self.const_globals.borrow_mut().insert(cv, gv);
179+
self.const_globals.borrow_mut().insert(cv, gv);
180180
gv
181181
}
182182

183183
fn get_static(&self, def_id: DefId) -> &'ll Value {
184184
let instance = Instance::mono(self.tcx, def_id);
185-
if let Some(&g) = &self.instances.borrow().get(&instance) {
185+
if let Some(&g) = self.instances.borrow().get(&instance) {
186186
return g;
187187
}
188188

189-
let defined_in_current_codegen_unit = &self.codegen_unit
189+
let defined_in_current_codegen_unit = self.codegen_unit
190190
.items()
191191
.contains_key(&MonoItem::Static(def_id));
192192
assert!(!defined_in_current_codegen_unit,
@@ -201,8 +201,8 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
201201

202202
let g = if let Some(id) = self.tcx.hir.as_local_node_id(def_id) {
203203

204-
let llty = &self.layout_of(ty).llvm_type(&self);
205-
let (g, attrs) = match &self.tcx.hir.get(id) {
204+
let llty = self.layout_of(ty).llvm_type(&self);
205+
let (g, attrs) = match self.tcx.hir.get(id) {
206206
Node::Item(&hir::Item {
207207
ref attrs, span, node: hir::ItemKind::Static(..), ..
208208
}) => {
@@ -212,7 +212,7 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
212212

213213
let g = declare::define_global(&self, &sym[..], llty).unwrap();
214214

215-
if !&self.tcx.is_reachable_non_generic(def_id) {
215+
if !self.tcx.is_reachable_non_generic(def_id) {
216216
unsafe {
217217
llvm::LLVMRustSetVisibility(g, llvm::Visibility::Hidden);
218218
}
@@ -224,7 +224,7 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
224224
Node::ForeignItem(&hir::ForeignItem {
225225
ref attrs, span, node: hir::ForeignItemKind::Static(..), ..
226226
}) => {
227-
let fn_attrs = &self.tcx.codegen_fn_attrs(def_id);
227+
let fn_attrs = self.tcx.codegen_fn_attrs(def_id);
228228
(check_and_apply_linkage(&self, &fn_attrs, ty, sym, Some(span)), attrs)
229229
}
230230

@@ -242,9 +242,9 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
242242
g
243243
} else {
244244
// FIXME(nagisa): perhaps the map of externs could be offloaded to llvm somehow?
245-
debug!("get_static: sym={} item_attr={:?}", sym, &self.tcx.item_attrs(def_id));
245+
debug!("get_static: sym={} item_attr={:?}", sym, self.tcx.item_attrs(def_id));
246246

247-
let attrs = &self.tcx.codegen_fn_attrs(def_id);
247+
let attrs = self.tcx.codegen_fn_attrs(def_id);
248248
let g = check_and_apply_linkage(&self, &attrs, ty, sym, None);
249249

250250
// Thread-local statics in some other crate need to *always* be linked
@@ -258,11 +258,11 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
258258
}
259259

260260
let needs_dll_storage_attr =
261-
self.use_dll_storage_attrs && !&self.tcx.is_foreign_item(def_id) &&
261+
self.use_dll_storage_attrs && !self.tcx.is_foreign_item(def_id) &&
262262
// ThinLTO can't handle this workaround in all cases, so we don't
263263
// emit the attrs. Instead we make them unnecessary by disallowing
264264
// dynamic linking when cross-language LTO is enabled.
265-
!&self.tcx.sess.opts.debugging_opts.cross_lang_lto.enabled();
265+
!self.tcx.sess.opts.debugging_opts.cross_lang_lto.enabled();
266266

267267
// If this assertion triggers, there's something wrong with commandline
268268
// argument validation.
@@ -281,7 +281,7 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
281281
// crates, so there are cases where a static with an upstream DefId
282282
// is actually present in the current crate. We can find out via the
283283
// is_codegened_item query.
284-
if !&self.tcx.is_codegened_item(def_id) {
284+
if !self.tcx.is_codegened_item(def_id) {
285285
unsafe {
286286
llvm::LLVMSetDLLStorageClass(g, llvm::DLLStorageClass::DllImport);
287287
}
@@ -297,7 +297,7 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
297297
}
298298
}
299299

300-
&self.instances.borrow_mut().insert(instance, g);
300+
self.instances.borrow_mut().insert(instance, g);
301301
g
302302
}
303303

@@ -307,15 +307,15 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
307307
is_mutable: bool,
308308
) {
309309
unsafe {
310-
let attrs = &self.tcx.codegen_fn_attrs(def_id);
310+
let attrs = self.tcx.codegen_fn_attrs(def_id);
311311

312312
let (v, alloc) = match ::mir::codegen_static_initializer(&self, def_id) {
313313
Ok(v) => v,
314314
// Error has already been reported
315315
Err(_) => return,
316316
};
317317

318-
let g = &self.get_static(def_id);
318+
let g = self.get_static(def_id);
319319

320320
// boolean SSA values are i1, but they have to be stored in i8 slots,
321321
// otherwise some LLVM optimization passes don't work as expected
@@ -344,15 +344,15 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
344344
let visibility = llvm::LLVMRustGetVisibility(g);
345345

346346
let new_g = llvm::LLVMRustGetOrInsertGlobal(
347-
&self.llmod, name_string.as_ptr(), val_llty);
347+
self.llmod, name_string.as_ptr(), val_llty);
348348

349349
llvm::LLVMRustSetLinkage(new_g, linkage);
350350
llvm::LLVMRustSetVisibility(new_g, visibility);
351351

352352
// To avoid breaking any invariants, we leave around the old
353353
// global for the moment; we'll replace all references to it
354354
// with the new global later. (See base::codegen_backend.)
355-
&self.statics_to_rauw.borrow_mut().push((g, new_g));
355+
self.statics_to_rauw.borrow_mut().push((g, new_g));
356356
new_g
357357
};
358358
set_global_alignment(&self, g, self.align_of(ty));
@@ -416,19 +416,19 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
416416
if self.tcx.sess.opts.target_triple.triple().starts_with("wasm32") {
417417
if let Some(section) = attrs.link_section {
418418
let section = llvm::LLVMMDStringInContext(
419-
&self.llcx,
419+
self.llcx,
420420
section.as_str().as_ptr() as *const _,
421421
section.as_str().len() as c_uint,
422422
);
423423
let alloc = llvm::LLVMMDStringInContext(
424-
&self.llcx,
424+
self.llcx,
425425
alloc.bytes.as_ptr() as *const _,
426426
alloc.bytes.len() as c_uint,
427427
);
428428
let data = [section, alloc];
429-
let meta = llvm::LLVMMDNodeInContext(&self.llcx, data.as_ptr(), 2);
429+
let meta = llvm::LLVMMDNodeInContext(self.llcx, data.as_ptr(), 2);
430430
llvm::LLVMAddNamedMetadataOperand(
431-
&self.llmod,
431+
self.llmod,
432432
"wasm.custom_sections\0".as_ptr() as *const _,
433433
meta,
434434
);
@@ -439,8 +439,8 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
439439

440440
if attrs.flags.contains(CodegenFnAttrFlags::USED) {
441441
// This static will be stored in the llvm.used variable which is an array of i8*
442-
let cast = llvm::LLVMConstPointerCast(g, &self.type_i8p());
443-
&self.used_statics.borrow_mut().push(cast);
442+
let cast = llvm::LLVMConstPointerCast(g, self.type_i8p());
443+
self.used_statics.borrow_mut().push(cast);
444444
}
445445
}
446446
}

0 commit comments

Comments
 (0)