[PATCH] D80250: Enclose verifier code for AttrSizedOperandSegments and AttrSizedResultSegments in a nested code block to avoid symbol collision.

Kuangyuan Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 19 14:53:52 PDT 2020


chky created this revision.
chky added a reviewer: antiagainst.
Herald added subscribers: llvm-commits, jurahul, Kayjukh, frgossen, grosul1, Joonsoo, stephenneuendorffer, liufengdb, lucyrfox, mgester, arpith-jacob, nicolasvasilache, shauheen, jpienaar, rriddle, mehdi_amini.
Herald added a project: LLVM.

Enclose verifier code for AttrSizedOperandSegments and AttrSizedResultSegments in a nested code block to avoid symbol collision.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80250

Files:
  mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp


Index: mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
===================================================================
--- mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
+++ mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
@@ -1464,11 +1464,13 @@
   auto &body = method.body();
 
   const char *checkAttrSizedValueSegmentsCode = R"(
-  auto sizeAttr = getAttrOfType<DenseIntElementsAttr>("{0}");
-  auto numElements = sizeAttr.getType().cast<ShapedType>().getNumElements();
-  if (numElements != {1}) {{
-    return emitOpError("'{0}' attribute for specifying {2} segments "
-                       "must have {1} elements");
+  {
+    auto sizeAttr = getAttrOfType<DenseIntElementsAttr>("{0}");
+    auto numElements = sizeAttr.getType().cast<ShapedType>().getNumElements();
+    if (numElements != {1}) {{
+      return emitOpError("'{0}' attribute for specifying {2} segments "
+                         "must have {1} elements");
+    }
   }
   )";
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80250.265050.patch
Type: text/x-patch
Size: 947 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200519/3d862abe/attachment.bin>


More information about the llvm-commits mailing list