Add type_array to BaseTypeMethods
Moved type_array function to rustc_codegen_ssa::BaseTypeMethods trait. This allows using normal alloca function to create arrays as suggested in https://github.com/rust-lang/rust/pull/104022. Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
This commit is contained in:
parent
5b3e909075
commit
299bc61035
3 changed files with 26 additions and 25 deletions
|
@ -127,10 +127,6 @@ impl<'ll> CodegenCx<'ll, '_> {
|
|||
pub(crate) fn type_variadic_func(&self, args: &[&'ll Type], ret: &'ll Type) -> &'ll Type {
|
||||
unsafe { llvm::LLVMFunctionType(ret, args.as_ptr(), args.len() as c_uint, True) }
|
||||
}
|
||||
|
||||
pub(crate) fn type_array(&self, ty: &'ll Type, len: u64) -> &'ll Type {
|
||||
unsafe { llvm::LLVMRustArrayType(ty, len) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ll, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
||||
|
@ -231,6 +227,10 @@ impl<'ll, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
|||
fn val_ty(&self, v: &'ll Value) -> &'ll Type {
|
||||
common::val_ty(v)
|
||||
}
|
||||
|
||||
fn type_array(&self, ty: &'ll Type, len: u64) -> &'ll Type {
|
||||
unsafe { llvm::LLVMRustArrayType(ty, len) }
|
||||
}
|
||||
}
|
||||
|
||||
impl Type {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue