[PATCH] D77504: [mlir][toy] hasOperand() const correctness

Jonathan Roelofs via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 5 10:08:33 PDT 2020


jroelofs created this revision.
jroelofs added a reviewer: mehdi_amini.
Herald added subscribers: llvm-commits, grosul1, Joonsoo, liufengdb, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, burmako, jpienaar, rriddle.
Herald added a project: LLVM.
mehdi_amini added a comment.

Did you it a case where this is useful/needed? See also: https://mlir.llvm.org/docs/UsageOfConst/


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77504

Files:
  mlir/examples/toy/Ch2/include/toy/Ops.td
  mlir/examples/toy/Ch3/include/toy/Ops.td
  mlir/examples/toy/Ch4/include/toy/Ops.td
  mlir/examples/toy/Ch5/include/toy/Ops.td
  mlir/examples/toy/Ch6/include/toy/Ops.td
  mlir/examples/toy/Ch7/include/toy/Ops.td


Index: mlir/examples/toy/Ch7/include/toy/Ops.td
===================================================================
--- mlir/examples/toy/Ch7/include/toy/Ops.td
+++ mlir/examples/toy/Ch7/include/toy/Ops.td
@@ -265,7 +265,7 @@
 
   // Provide extra utility definitions on the c++ operation class definition.
   let extraClassDeclaration = [{
-    bool hasOperand() { return getNumOperands() != 0; }
+    bool hasOperand() const { return getNumOperands() != 0; }
   }];
 
   // Invoke a static verify method to verify this return operation.
Index: mlir/examples/toy/Ch6/include/toy/Ops.td
===================================================================
--- mlir/examples/toy/Ch6/include/toy/Ops.td
+++ mlir/examples/toy/Ch6/include/toy/Ops.td
@@ -251,7 +251,7 @@
 
   // Provide extra utility definitions on the c++ operation class definition.
   let extraClassDeclaration = [{
-    bool hasOperand() { return getNumOperands() != 0; }
+    bool hasOperand() const { return getNumOperands() != 0; }
   }];
 
   // Invoke a static verify method to verify this return operation.
Index: mlir/examples/toy/Ch5/include/toy/Ops.td
===================================================================
--- mlir/examples/toy/Ch5/include/toy/Ops.td
+++ mlir/examples/toy/Ch5/include/toy/Ops.td
@@ -251,7 +251,7 @@
 
   // Provide extra utility definitions on the c++ operation class definition.
   let extraClassDeclaration = [{
-    bool hasOperand() { return getNumOperands() != 0; }
+    bool hasOperand() const { return getNumOperands() != 0; }
   }];
 
   // Invoke a static verify method to verify this return operation.
Index: mlir/examples/toy/Ch4/include/toy/Ops.td
===================================================================
--- mlir/examples/toy/Ch4/include/toy/Ops.td
+++ mlir/examples/toy/Ch4/include/toy/Ops.td
@@ -250,7 +250,7 @@
 
   // Provide extra utility definitions on the c++ operation class definition.
   let extraClassDeclaration = [{
-    bool hasOperand() { return getNumOperands() != 0; }
+    bool hasOperand() const { return getNumOperands() != 0; }
   }];
 
   // Invoke a static verify method to verify this return operation.
Index: mlir/examples/toy/Ch3/include/toy/Ops.td
===================================================================
--- mlir/examples/toy/Ch3/include/toy/Ops.td
+++ mlir/examples/toy/Ch3/include/toy/Ops.td
@@ -224,7 +224,7 @@
 
   // Provide extra utility definitions on the c++ operation class definition.
   let extraClassDeclaration = [{
-    bool hasOperand() { return getNumOperands() != 0; }
+    bool hasOperand() const { return getNumOperands() != 0; }
   }];
 
   // Invoke a static verify method to verify this return operation.
Index: mlir/examples/toy/Ch2/include/toy/Ops.td
===================================================================
--- mlir/examples/toy/Ch2/include/toy/Ops.td
+++ mlir/examples/toy/Ch2/include/toy/Ops.td
@@ -222,7 +222,7 @@
 
   // Provide extra utility definitions on the c++ operation class definition.
   let extraClassDeclaration = [{
-    bool hasOperand() { return getNumOperands() != 0; }
+    bool hasOperand() const { return getNumOperands() != 0; }
   }];
 
   // Invoke a static verify method to verify this return operation.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77504.255171.patch
Type: text/x-patch
Size: 3234 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200405/f7ae3454/attachment.bin>


More information about the llvm-commits mailing list