[clang] [CIR] Upstream enum support (PR #136807)

Morris Hafner via cfe-commits cfe-commits at lists.llvm.org
Fri May 2 13:02:20 PDT 2025


================
@@ -417,6 +417,19 @@ mlir::Type CIRGenTypes::convertType(QualType type) {
     break;
   }
 
+  case Type::Enum: {
+    // TODO(cir): Implement updateCompletedType for enums.
+    assert(!cir.MissingFeatures::updateCompletedType());
+    const EnumDecl *ED = cast<EnumType>(ty)->getDecl();
+    if (ED->isCompleteDefinition() || ED->isFixed())
+      return convertType(ED->getIntegerType());
----------------
mmha wrote:

I think you can simplify this a little:
```suggestion
    if (auto integerType = ED->getIntegerType(); !integerType.isNull())
      return convertType(integerType);
```

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


More information about the cfe-commits mailing list