Skip to content

Commit 98af2e1

Browse files
author
Robert Zakrzewski
committed
Add missing types in the type_kind function
reorder type_kind reorder type_kind
1 parent 10798db commit 98af2e1

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/type_.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,22 @@ impl<'gcc, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
192192

193193
#[cfg(feature = "master")]
194194
fn type_kind(&self, typ: Type<'gcc>) -> TypeKind {
195-
if self.is_int_type_or_bool(typ) {
195+
if typ.get_pointee().is_some() {
196+
TypeKind::Pointer
197+
} else if self.is_int_type_or_bool(typ) {
196198
TypeKind::Integer
197199
} else if typ.is_compatible_with(self.float_type) {
198200
TypeKind::Float
199201
} else if typ.is_compatible_with(self.double_type) {
200202
TypeKind::Double
201203
} else if typ.is_vector() {
202204
TypeKind::Vector
205+
} else if typ.dyncast_array().is_some() {
206+
TypeKind::Array
207+
} else if typ.is_struct().is_some() {
208+
TypeKind::Struct
209+
} else if typ.dyncast_function_ptr_type().is_some() {
210+
TypeKind::Function
203211
} else if typ.is_floating_point() {
204212
match typ.get_size() {
205213
2 => TypeKind::Half,
@@ -208,9 +216,11 @@ impl<'gcc, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
208216
16 => TypeKind::FP128,
209217
_ => TypeKind::Void,
210218
}
219+
} else if typ == self.type_void() {
220+
TypeKind::Void
211221
} else {
212222
// TODO(antoyo): support other types.
213-
TypeKind::Void
223+
unimplemented!();
214224
}
215225
}
216226

0 commit comments

Comments
 (0)