Skip to content

Commit

Permalink
Rename StaticMethods::static_ptrcast to ConstMethods::const_ptrcast
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Nov 29, 2018
1 parent 59682d3 commit aaca5a3
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/librustc_codegen_llvm/callee.rs
Expand Up @@ -81,7 +81,7 @@ pub fn get_fn(
// other weird situations. Annoying.
if cx.val_ty(llfn) != llptrty {
debug!("get_fn: casting {:?} to {:?}", llfn, llptrty);
cx.static_ptrcast(llfn, llptrty)
cx.const_ptrcast(llfn, llptrty)
} else {
debug!("get_fn: not casting pointer!");
llfn
Expand Down
4 changes: 4 additions & 0 deletions src/librustc_codegen_llvm/common.rs
Expand Up @@ -366,6 +366,10 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
let llval = self.static_bitcast(llval, self.type_ptr_to(layout.llvm_type(self)));
PlaceRef::new_sized(llval, layout, alloc.align)
}

fn const_ptrcast(&self, val: &'ll Value, ty: &'ll Type) -> &'ll Value {
consts::ptrcast(val, ty)
}
}

pub fn val_ty(v: &'ll Value) -> &'ll Type {
Expand Down
4 changes: 0 additions & 4 deletions src/librustc_codegen_llvm/consts.rs
Expand Up @@ -180,10 +180,6 @@ impl CodegenCx<'ll, 'tcx> {
}

impl StaticMethods for CodegenCx<'ll, 'tcx> {
fn static_ptrcast(&self, val: &'ll Value, ty: &'ll Type) -> &'ll Value {
ptrcast(val, ty)
}

fn static_addr_of_mut(
&self,
cv: &'ll Value,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/base.rs
Expand Up @@ -192,7 +192,7 @@ pub fn unsized_info<'tcx, Cx: CodegenMethods<'tcx>>(
(_, &ty::Dynamic(ref data, ..)) => {
let vtable_ptr = cx.layout_of(cx.tcx().mk_mut_ptr(target))
.field(cx, FAT_PTR_EXTRA);
cx.static_ptrcast(meth::get_vtable(cx, source, data.principal()),
cx.const_ptrcast(meth::get_vtable(cx, source, data.principal()),
cx.backend_type(vtable_ptr))
}
_ => bug!("unsized_info: invalid unsizing {:?} -> {:?}",
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_codegen_ssa/traits/consts.rs
Expand Up @@ -17,7 +17,6 @@ use syntax::symbol::LocalInternedString;

pub trait ConstMethods<'tcx>: BackendTypes {
// Constant constructors

fn const_null(&self, t: Self::Type) -> Self::Value;
fn const_undef(&self, t: Self::Type) -> Self::Value;
fn const_int(&self, t: Self::Type, i: i64) -> Self::Value;
Expand Down Expand Up @@ -61,4 +60,6 @@ pub trait ConstMethods<'tcx>: BackendTypes {
alloc: &Allocation,
offset: layout::Size,
) -> PlaceRef<'tcx, Self::Value>;

fn const_ptrcast(&self, val: Self::Value, ty: Self::Type) -> Self::Value;
}
1 change: 0 additions & 1 deletion src/librustc_codegen_ssa/traits/statics.rs
Expand Up @@ -13,7 +13,6 @@ use rustc::hir::def_id::DefId;
use rustc::ty::layout::Align;

pub trait StaticMethods: BackendTypes {
fn static_ptrcast(&self, val: Self::Value, ty: Self::Type) -> Self::Value;
fn static_addr_of_mut(&self, cv: Self::Value, align: Align, kind: Option<&str>) -> Self::Value;
fn static_addr_of(&self, cv: Self::Value, align: Align, kind: Option<&str>) -> Self::Value;
fn get_static(&self, def_id: DefId) -> Self::Value;
Expand Down

0 comments on commit aaca5a3

Please sign in to comment.