Skip to content

Commit 32f7e78

Browse files
committed
Rename static_addr_of_impl
1 parent 6436b41 commit 32f7e78

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

compiler/rustc_codegen_gcc/src/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ impl<'gcc, 'tcx> ConstCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
261261
self.context.new_cast(None, val, ty)
262262
}
263263

264-
fn static_addr_of_impl(
264+
fn static_addr_of_const(
265265
&self,
266266
cv: Self::Value,
267267
align: Align,

compiler/rustc_codegen_llvm/src/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,13 @@ impl<'ll, 'tcx> ConstCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
279279
unsafe { llvm::LLVMConstPtrToInt(val, ty) }
280280
}
281281

282-
fn static_addr_of_impl(
282+
fn static_addr_of_const(
283283
&self,
284284
cv: Self::Value,
285285
align: Align,
286286
kind: Option<&str>,
287287
) -> Self::Value {
288-
self.static_addr_of_impl(cv, align, kind)
288+
self.static_addr_of_const(cv, align, kind)
289289
}
290290

291291
fn static_addr_of_mut(&self, cv: Self::Value, align: Align, kind: Option<&str>) -> Self::Value {

compiler/rustc_codegen_llvm/src/consts.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ impl<'ll> CodegenCx<'ll, '_> {
244244
/// Create a global constant.
245245
///
246246
/// The returned global variable is a pointer in the default address space for globals.
247-
pub(crate) fn static_addr_of_impl(
247+
pub(crate) fn static_addr_of_const(
248248
&self,
249249
cv: &'ll Value,
250250
align: Align,
@@ -552,8 +552,8 @@ impl<'ll> StaticCodegenMethods for CodegenCx<'ll, '_> {
552552
/// The pointer will always be in the default address space. If global variables default to a
553553
/// different address space, an addrspacecast is inserted.
554554
fn static_addr_of(&self, cv: &'ll Value, align: Align, kind: Option<&str>) -> &'ll Value {
555-
let gv = self.static_addr_of_impl(cv, align, kind);
556-
// static_addr_of_impl returns the bare global variable, which might not be in the default
555+
let gv = self.static_addr_of_const(cv, align, kind);
556+
// static_addr_of_const returns the bare global variable, which might not be in the default
557557
// address space. Cast to the default address space if necessary.
558558
self.const_pointercast(gv, self.type_ptr())
559559
}

compiler/rustc_codegen_ssa/src/traits/consts.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,14 @@ pub trait ConstCodegenMethods<'tcx>:
5858
/// Create a global constant.
5959
///
6060
/// The returned global variable is a pointer in the default address space for globals.
61-
fn static_addr_of_impl(&self, cv: Self::Value, align: Align, kind: Option<&str>)
62-
-> Self::Value;
61+
fn static_addr_of_const(
62+
&self,
63+
cv: Self::Value,
64+
align: Align,
65+
kind: Option<&str>,
66+
) -> Self::Value;
6367

64-
/// Same as `static_addr_of_impl`, but does not mark the static as immutable
68+
/// Same as `static_addr_of_const`, but does not mark the static as immutable
6569
fn static_addr_of_mut(&self, cv: Self::Value, align: Align, kind: Option<&str>) -> Self::Value;
6670

6771
fn scalar_to_backend(&self, cv: Scalar, layout: abi::Scalar, llty: Self::Type) -> Self::Value {
@@ -97,7 +101,7 @@ pub trait ConstCodegenMethods<'tcx>:
97101
let alloc = alloc.inner();
98102
let value = match alloc.mutability {
99103
Mutability::Mut => self.static_addr_of_mut(init, alloc.align, None),
100-
_ => self.static_addr_of_impl(init, alloc.align, None),
104+
_ => self.static_addr_of_const(init, alloc.align, None),
101105
};
102106
if !self.tcx().sess.fewer_names()
103107
&& self.get_value_name(value).is_empty()
@@ -124,7 +128,7 @@ pub trait ConstCodegenMethods<'tcx>:
124128
)))
125129
.unwrap_memory();
126130
let init = self.const_data_from_alloc(alloc);
127-
let value = self.static_addr_of_impl(init, alloc.inner().align, None);
131+
let value = self.static_addr_of_const(init, alloc.inner().align, None);
128132
value
129133
}
130134
GlobalAlloc::Static(def_id) => {

0 commit comments

Comments
 (0)