diff --git a/nac3core/src/codegen/types/list.rs b/nac3core/src/codegen/types/list.rs index 3d04134..8de3086 100644 --- a/nac3core/src/codegen/types/list.rs +++ b/nac3core/src/codegen/types/list.rs @@ -1,7 +1,7 @@ use inkwell::{ context::Context, types::{AnyTypeEnum, BasicType, BasicTypeEnum, IntType, PointerType}, - values::IntValue, + values::{IntValue, PointerValue}, AddressSpace, }; @@ -167,7 +167,7 @@ impl<'ctx> ProxyType<'ctx> for ListType<'ctx> { generator: &mut G, ctx: &mut CodeGenContext<'ctx, '_>, name: Option<&'ctx str>, - ) -> >::Base { + ) -> PointerValue<'ctx> { generator .gen_var_alloc( ctx, diff --git a/nac3core/src/codegen/types/mod.rs b/nac3core/src/codegen/types/mod.rs index 022f897..03d6d38 100644 --- a/nac3core/src/codegen/types/mod.rs +++ b/nac3core/src/codegen/types/mod.rs @@ -16,7 +16,11 @@ //! the returned object. This is similar to a `new` expression in C++ but the object is allocated //! on the stack. -use inkwell::{context::Context, types::BasicType, values::IntValue}; +use inkwell::{ + context::Context, + types::BasicType, + values::{IntValue, PointerValue}, +}; use super::{ values::{ArraySliceValue, ProxyValue}, @@ -53,13 +57,14 @@ pub trait ProxyType<'ctx>: Into { llvm_ty: Self::Base, ) -> Result<(), String>; - /// Creates a new value of this type, returning the LLVM instance of this value. + /// Creates a new value of this type by invoking `alloca`, returning a [`PointerValue`] instance + /// representing the allocated value. fn raw_alloca( &self, generator: &mut G, ctx: &mut CodeGenContext<'ctx, '_>, name: Option<&'ctx str>, - ) -> >::Base; + ) -> PointerValue<'ctx>; /// Creates a new array value of this type, returning an [`ArraySliceValue`] encapsulating the /// resulting array. diff --git a/nac3core/src/codegen/types/ndarray/contiguous.rs b/nac3core/src/codegen/types/ndarray/contiguous.rs index 317539c..4be5547 100644 --- a/nac3core/src/codegen/types/ndarray/contiguous.rs +++ b/nac3core/src/codegen/types/ndarray/contiguous.rs @@ -218,7 +218,7 @@ impl<'ctx> ProxyType<'ctx> for ContiguousNDArrayType<'ctx> { generator: &mut G, ctx: &mut CodeGenContext<'ctx, '_>, name: Option<&'ctx str>, - ) -> >::Base { + ) -> PointerValue<'ctx> { generator .gen_var_alloc( ctx, diff --git a/nac3core/src/codegen/types/ndarray/indexing.rs b/nac3core/src/codegen/types/ndarray/indexing.rs index 959d4f5..6bbd3e8 100644 --- a/nac3core/src/codegen/types/ndarray/indexing.rs +++ b/nac3core/src/codegen/types/ndarray/indexing.rs @@ -176,7 +176,7 @@ impl<'ctx> ProxyType<'ctx> for NDIndexType<'ctx> { generator: &mut G, ctx: &mut CodeGenContext<'ctx, '_>, name: Option<&'ctx str>, - ) -> >::Base { + ) -> PointerValue<'ctx> { generator .gen_var_alloc( ctx, diff --git a/nac3core/src/codegen/types/ndarray/mod.rs b/nac3core/src/codegen/types/ndarray/mod.rs index 4127ffa..b655f35 100644 --- a/nac3core/src/codegen/types/ndarray/mod.rs +++ b/nac3core/src/codegen/types/ndarray/mod.rs @@ -430,7 +430,7 @@ impl<'ctx> ProxyType<'ctx> for NDArrayType<'ctx> { generator: &mut G, ctx: &mut CodeGenContext<'ctx, '_>, name: Option<&'ctx str>, - ) -> >::Base { + ) -> PointerValue<'ctx> { generator .gen_var_alloc( ctx, diff --git a/nac3core/src/codegen/types/ndarray/nditer.rs b/nac3core/src/codegen/types/ndarray/nditer.rs index 772d5b2..ed98aa4 100644 --- a/nac3core/src/codegen/types/ndarray/nditer.rs +++ b/nac3core/src/codegen/types/ndarray/nditer.rs @@ -203,7 +203,7 @@ impl<'ctx> ProxyType<'ctx> for NDIterType<'ctx> { generator: &mut G, ctx: &mut CodeGenContext<'ctx, '_>, name: Option<&'ctx str>, - ) -> >::Base { + ) -> PointerValue<'ctx> { generator .gen_var_alloc( ctx, diff --git a/nac3core/src/codegen/types/range.rs b/nac3core/src/codegen/types/range.rs index e704455..dc241b6 100644 --- a/nac3core/src/codegen/types/range.rs +++ b/nac3core/src/codegen/types/range.rs @@ -1,7 +1,7 @@ use inkwell::{ context::Context, types::{AnyTypeEnum, BasicType, BasicTypeEnum, IntType, PointerType}, - values::IntValue, + values::{IntValue, PointerValue}, AddressSpace, }; @@ -131,7 +131,7 @@ impl<'ctx> ProxyType<'ctx> for RangeType<'ctx> { generator: &mut G, ctx: &mut CodeGenContext<'ctx, '_>, name: Option<&'ctx str>, - ) -> >::Base { + ) -> PointerValue<'ctx> { generator .gen_var_alloc( ctx, diff --git a/nac3core/src/codegen/types/utils/slice.rs b/nac3core/src/codegen/types/utils/slice.rs index aba0efb..dd7643f 100644 --- a/nac3core/src/codegen/types/utils/slice.rs +++ b/nac3core/src/codegen/types/utils/slice.rs @@ -1,7 +1,7 @@ use inkwell::{ context::{AsContextRef, Context, ContextRef}, types::{AnyTypeEnum, BasicType, BasicTypeEnum, IntType, PointerType}, - values::IntValue, + values::{IntValue, PointerValue}, AddressSpace, }; use itertools::Itertools; @@ -215,7 +215,7 @@ impl<'ctx> ProxyType<'ctx> for SliceType<'ctx> { generator: &mut G, ctx: &mut CodeGenContext<'ctx, '_>, name: Option<&'ctx str>, - ) -> >::Base { + ) -> PointerValue<'ctx> { generator .gen_var_alloc( ctx,