[mlir][OpDefGen] Don't emit attribute name getters when there are no attributes
authorRiver Riddle <riddleriver@gmail.com>
Wed, 23 Jun 2021 03:03:27 +0000 (03:03 +0000)
committerRiver Riddle <riddleriver@gmail.com>
Wed, 23 Jun 2021 03:03:54 +0000 (03:03 +0000)
This avoids generating otherwise unnecessary methods.

mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp

index 4af4902..664fc2d 100644 (file)
@@ -669,6 +669,8 @@ void OpEmitter::genAttrNameGetters() {
       body << "};\n  return ::llvm::makeArrayRef(attrNames);";
     }
   }
+  if (attributeNames.empty())
+    return;
 
   // Emit the getAttributeNameForIndex methods.
   {