[Mlir-commits] [mlir] [mlir][python] namespace generated enums in python (PR #77830)

Maksim Levental llvmlistbot at llvm.org
Fri Jan 12 16:10:49 PST 2024


================
@@ -165,16 +164,27 @@ static bool emitDialectEnumAttributeBuilder(const AttrOrTypeDef &attr,
 static bool emitPythonEnums(const llvm::RecordKeeper &recordKeeper,
                             raw_ostream &os) {
   os << fileHeader;
+  for (const auto &it :
+       recordKeeper.getAllDerivedDefinitionsIfDefined("EnumAttr")) {
+    EnumAttr *enumAttr;
+    for (const auto &value : it->getValues())
+      if (value.getType()->getAsString() == "EnumAttrInfo")
----------------
makslevental wrote:

there must be a better way to do this but for the life of me i can't figure it out.

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


More information about the Mlir-commits mailing list