about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Zakrzewski <robert.zakrzewski1@stellantis.com>2024-05-12 17:40:14 +0200
committerRobert Zakrzewski <robert.zakrzewski1@stellantis.com>2024-06-21 16:12:05 +0200
commitb94cb8c01ccb1c027dc2840483afa45c6325fd2b (patch)
treee6dc6420325d51c068f80353cadebf11d0bd793e
parentfa18a181f7bf0a7c1f5753de82c1e934a957894d (diff)
downloadrust-b94cb8c01ccb1c027dc2840483afa45c6325fd2b.tar.gz
rust-b94cb8c01ccb1c027dc2840483afa45c6325fd2b.zip
Add missing types in the type_kind function
reorder type_kind

reorder type_kind

reorder type_kind

fix

fix

fix

fix
-rw-r--r--src/type_.rs16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/type_.rs b/src/type_.rs
index cc26f306d6d..36656c66a65 100644
--- a/src/type_.rs
+++ b/src/type_.rs
@@ -194,12 +194,20 @@ impl<'gcc, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
     fn type_kind(&self, typ: Type<'gcc>) -> TypeKind {
         if self.is_int_type_or_bool(typ) {
             TypeKind::Integer
+        } else if typ.get_pointee().is_some() {
+            TypeKind::Pointer
+        } else if typ.is_vector() {
+            TypeKind::Vector
+        } else if typ.dyncast_array().is_some() {
+            TypeKind::Array
+        } else if typ.is_struct().is_some() {
+            TypeKind::Struct
+        } else if typ.dyncast_function_ptr_type().is_some() {
+            TypeKind::Function
         } else if typ.is_compatible_with(self.float_type) {
             TypeKind::Float
         } else if typ.is_compatible_with(self.double_type) {
             TypeKind::Double
-        } else if typ.is_vector() {
-            TypeKind::Vector
         } else if typ.is_floating_point() {
             match typ.get_size() {
                 2 => TypeKind::Half,
@@ -208,9 +216,11 @@ impl<'gcc, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
                 16 => TypeKind::FP128,
                 _ => TypeKind::Void,
             }
+        } else if typ == self.type_void() {
+            TypeKind::Void
         } else {
             // TODO(antoyo): support other types.
-            TypeKind::Void
+            unimplemented!();
         }
     }