From b205d5fe77d3fe7d2affd90e14e2f8509d509acf Mon Sep 17 00:00:00 2001 From: Matthew Davis <87373031+matthewd28@users.noreply.github.com> Date: Sun, 2 Oct 2022 13:22:34 -0400 Subject: [PATCH] Update type_factory.h Modifying TypeFactory class functions to be of const type. Issue link: https://github.com/taichi-dev/taichi/issues/5167 --- taichi/ir/type_factory.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/taichi/ir/type_factory.h b/taichi/ir/type_factory.h index a273091579ea9..da4b772c8eb7f 100644 --- a/taichi/ir/type_factory.h +++ b/taichi/ir/type_factory.h @@ -13,38 +13,38 @@ class TypeFactory { // TODO(type): maybe it makes sense to let each get_X function return X* // instead of generic Type* - Type *get_primitive_type(PrimitiveTypeID id); + const Type *get_primitive_type(PrimitiveTypeID id); - PrimitiveType *get_primitive_int_type(int bits, bool is_signed = true); + const PrimitiveType *get_primitive_int_type(int bits, bool is_signed = true); - PrimitiveType *get_primitive_real_type(int bits); + const PrimitiveType *get_primitive_real_type(int bits); - Type *get_tensor_type(std::vector shape, Type *element); + const Type *get_tensor_type(std::vector shape, Type *element); - Type *get_pointer_type(Type *element, bool is_bit_pointer = false); + const Type *get_pointer_type(Type *element, bool is_bit_pointer = false); - Type *get_quant_int_type(int num_bits, bool is_signed, Type *compute_type); + const Type *get_quant_int_type(int num_bits, bool is_signed, Type *compute_type); - Type *get_quant_fixed_type(Type *digits_type, + const Type *get_quant_fixed_type(Type *digits_type, Type *compute_type, float64 scale); - Type *get_quant_float_type(Type *digits_type, + const Type *get_quant_float_type(Type *digits_type, Type *exponent_type, Type *compute_type); - BitStructType *get_bit_struct_type( + const BitStructType *get_bit_struct_type( PrimitiveType *physical_type, const std::vector &member_types, const std::vector &member_bit_offsets, const std::vector &member_exponents, const std::vector> &member_exponent_users); - Type *get_quant_array_type(PrimitiveType *physical_type, + const Type *get_quant_array_type(PrimitiveType *physical_type, Type *element_type, int num_elements); - static DataType create_tensor_type(std::vector shape, DataType element); + static const DataType create_tensor_type(std::vector shape, DataType element); private: TypeFactory();