提交 c1bfd0ca 编写于 作者: A Ariel Ben-Yehuda

implement lvalue_len

no tests - sorry
上级 dcb64b52
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
use llvm::ValueRef; use llvm::ValueRef;
use rustc::middle::ty::Ty; use rustc::middle::ty::{self, Ty};
use rustc_mir::repr as mir; use rustc_mir::repr as mir;
use rustc_mir::tcx::LvalueTy; use rustc_mir::tcx::LvalueTy;
use trans::adt; use trans::adt;
...@@ -52,10 +52,17 @@ pub fn alloca<'bcx>(bcx: Block<'bcx, 'tcx>, ...@@ -52,10 +52,17 @@ pub fn alloca<'bcx>(bcx: Block<'bcx, 'tcx>,
impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
pub fn lvalue_len(&mut self, pub fn lvalue_len(&mut self,
_bcx: Block<'bcx, 'tcx>, bcx: Block<'bcx, 'tcx>,
_lvalue: LvalueRef<'tcx>) lvalue: LvalueRef<'tcx>)
-> ValueRef { -> ValueRef {
unimplemented!() match lvalue.ty.to_ty(bcx.tcx()).sty {
ty::TyArray(_, n) => common::C_uint(bcx.ccx(), n),
ty::TySlice(_) | ty::TyStr => {
assert!(lvalue.llextra != ptr::null_mut());
lvalue.llextra
}
_ => bcx.sess().bug("unexpected type in get_base_and_len"),
}
} }
pub fn trans_lvalue(&mut self, pub fn trans_lvalue(&mut self,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册