[PATCH] D78384: [mlir] omit extra newlines if there are no aliases

Matthias Kramm via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 10:47:22 PDT 2020


matthiaskramm updated this revision to Diff 258365.
matthiaskramm added a comment.

Use 'continue' instead of 'if'.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78384/new/

https://reviews.llvm.org/D78384

Files:
  mlir/lib/IR/AsmPrinter.cpp


Index: mlir/lib/IR/AsmPrinter.cpp
===================================================================
--- mlir/lib/IR/AsmPrinter.cpp
+++ mlir/lib/IR/AsmPrinter.cpp
@@ -381,7 +381,9 @@
   // Print all of the attribute kind aliases.
   for (auto &kindAlias : attrKindToAlias) {
     auto &aliasAttrsPair = kindAlias.second;
-    for (unsigned i = 0, e = aliasAttrsPair.second.size(); i != e; ++i)
+    if (aliasAttrsPair.second.empty())
+      continue;
+    for (unsigned i = 0; i != aliasAttrsPair.second.size(); ++i)
       printAlias(aliasAttrsPair.first, aliasAttrsPair.second[i], i);
     os << newLine;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78384.258365.patch
Type: text/x-patch
Size: 613 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200417/fc2ed023/attachment.bin>


More information about the llvm-commits mailing list