From 794056e86a53beff8e80f3a4fd8926e776a1f65e Mon Sep 17 00:00:00 2001 From: Schuyler Eldridge Date: Thu, 22 Dec 2022 17:34:27 -0500 Subject: [PATCH] [mlir] Fix missing OpInterface docs newline Fix incorrect markdown generated by mlir-tblgen for an InterfaceMethod that includes a body. Previously, this would cause the next method to show up on the same line and produce incorrect markdown. Newlines would only be added if the method did _not_ provide a body. E.g., previously this was generating markdown like: some function comment#### `next method` This change makes this generate as: some function comment #### `next method` Signed-off-by: Schuyler Eldridge Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D140590 --- mlir/test/mlir-tblgen/op-interface.td | 22 ++++++++++++++++++++++ mlir/tools/mlir-tblgen/OpInterfacesGen.cpp | 4 +++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/mlir/test/mlir-tblgen/op-interface.td b/mlir/test/mlir-tblgen/op-interface.td index 8ac0d6d..ab04198 100644 --- a/mlir/test/mlir-tblgen/op-interface.td +++ b/mlir/test/mlir-tblgen/op-interface.td @@ -1,5 +1,6 @@ // RUN: mlir-tblgen -gen-op-interface-decls -I %S/../../include %s | FileCheck %s --check-prefix=DECL // RUN: mlir-tblgen -gen-op-decls -I %S/../../include %s | FileCheck %s --check-prefix=OP_DECL +// RUN: mlir-tblgen -gen-op-interface-docs -I %S/../../include %s | FileCheck %s --check-prefix=DOCS include "mlir/IR/OpBase.td" @@ -34,6 +35,13 @@ def TestOpInterface : OpInterface<"TestOpInterface"> { InterfaceMethod< /*desc=*/[{some function comment}], /*retTy=*/"int", + /*methodName=*/"body_foo", + /*args=*/(ins "int":$input), + /*body=*/[{ return 0; }] + >, + InterfaceMethod< + /*desc=*/[{some function comment}], + /*retTy=*/"int", /*methodName=*/"default_foo", /*args=*/(ins "int":$input), /*body=*/[{}], @@ -93,3 +101,17 @@ def DeclareMethodsWithDefaultOp : Op