[Mlir-commits] [mlir] [mlir] Add helper method to print and parse cyclic attributes and types (PR #65210)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Mon Sep 4 01:42:29 PDT 2023


================
@@ -224,11 +194,17 @@ static LLVMStructType parseStructType(AsmParser &parser) {
   std::string name;
   bool isIdentified = succeeded(parser.parseOptionalString(&name));
   if (isIdentified) {
-    if (knownStructNames.count(name)) {
-      if (failed(parser.parseGreater()))
-        return LLVMStructType();
-      return LLVMStructType::getIdentifiedChecked(
+    SMLoc greaterLoc = parser.getCurrentLocation();
+    if (succeeded(parser.parseOptionalGreater())) {
+      auto type = LLVMStructType::getIdentifiedChecked(
           [loc] { return emitError(loc); }, loc.getContext(), name);
+      if (succeeded(parser.tryStartCyclicParse(type)))
----------------
ftynse wrote:

Nit: braces here plz.  Having a separate `return nullptr` line could also improve readability.

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


More information about the Mlir-commits mailing list