[clang] [CIR] Upstream minimal support for structure types (PR #135105)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 10 12:17:43 PDT 2025


================
@@ -37,6 +50,32 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
     llvm_unreachable("Unsupported format for long double");
   }
 
+  /// Get a CIR record kind from a AST declaration tag.
+  cir::StructType::RecordKind getRecordKind(const clang::TagTypeKind kind) {
+    switch (kind) {
+    case clang::TagTypeKind::Struct:
+      return cir::StructType::Struct;
+    case clang::TagTypeKind::Union:
+      return cir::StructType::Union;
+    case clang::TagTypeKind::Class:
+      return cir::StructType::Class;
+    case clang::TagTypeKind::Interface:
+      llvm_unreachable("interface records are NYI");
+    case clang::TagTypeKind::Enum:
+      llvm_unreachable("enum records are NYI");
----------------
andykaylor wrote:

This is also NYI in the incubator, so I'm not sure what the plan is/was. I'm not sure there's any value in preserving enums in CIR, and the incubator doesn't do so. Perhaps this should be `llvm_unreachable("enums are not records");`?

https://github.com/llvm/llvm-project/pull/135105


More information about the cfe-commits mailing list