From c43e8c0eeffe04b4c761273349fe287866c7fb8c Mon Sep 17 00:00:00 2001 From: River Riddle Date: Wed, 23 Jun 2021 03:03:27 +0000 Subject: [PATCH] [mlir][OpDefGen] Don't emit attribute name getters when there are no attributes This avoids generating otherwise unnecessary methods. --- mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp index 4af4902..664fc2de 100644 --- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp +++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp @@ -669,6 +669,8 @@ void OpEmitter::genAttrNameGetters() { body << "};\n return ::llvm::makeArrayRef(attrNames);"; } } + if (attributeNames.empty()) + return; // Emit the getAttributeNameForIndex methods. { -- 2.7.4