summaryrefslogtreecommitdiffstats
path: root/mlir/lib/IR
diff options
context:
space:
mode:
authorAlex Zinenko <zinenko@google.com>2019-11-21 04:24:52 -0800
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-11-21 05:08:19 -0800
commitb5af3784a6b9c67f67a11a9308b043b877f01095 (patch)
tree09853ee00d2d39a00648761c3ccafb4673043388 /mlir/lib/IR
parent8bde4aa1bcc7745e1d4274046193358fe3181f16 (diff)
downloadbcm5719-llvm-b5af3784a6b9c67f67a11a9308b043b877f01095.tar.gz
bcm5719-llvm-b5af3784a6b9c67f67a11a9308b043b877f01095.zip
Don't force newline before function attributes
Due to legacy reasons, a newline character followed by two spaces was always inserted before the attributes of the function Op in pretty form. This breaks formatting when functions are nested in some other operations. Don't print the newline and just put the attributes on the same line, which is also more consistent with module Op. Line breaking aware of indentation can be introduced separately into the parser if deemed useful. PiperOrigin-RevId: 281721793
Diffstat (limited to 'mlir/lib/IR')
-rw-r--r--mlir/lib/IR/FunctionSupport.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/mlir/lib/IR/FunctionSupport.cpp b/mlir/lib/IR/FunctionSupport.cpp
index 6b27eb833bf..1f39575331c 100644
--- a/mlir/lib/IR/FunctionSupport.cpp
+++ b/mlir/lib/IR/FunctionSupport.cpp
@@ -299,11 +299,7 @@ void mlir::impl::printFunctionLikeOp(OpAsmPrinter &p, Operation *op,
resultAttrStorage.emplace_back(attrNameBuf);
ignoredAttrs.append(resultAttrStorage.begin(), resultAttrStorage.end());
- auto attrs = op->getAttrs();
- if (attrs.size() > ignoredAttrs.size()) {
- p << "\n attributes ";
- p.printOptionalAttrDict(attrs, ignoredAttrs);
- }
+ p.printOptionalAttrDictWithKeyword(op->getAttrs(), ignoredAttrs);
// Print the body if this is not an external function.
Region &body = op->getRegion(0);
OpenPOWER on IntegriCloud