[Mlir-commits] [mlir] [mlir] Make TypedValue::getType() const (PR #76568)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Dec 29 06:54:18 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-core

Author: Andrei Golubev (andrey-golubev)

<details>
<summary>Changes</summary>

The TypedValue::getType() essentially forwards the return value of Value::getType() which is a const method. Somehow, at TypedValue level the method's constness is lost, so restore it.

Originally done by: Nikita Kudriavtsev <nikita.kudriavtsev@<!-- -->intel.com>

---
Full diff: https://github.com/llvm/llvm-project/pull/76568.diff


1 Files Affected:

- (modified) mlir/include/mlir/IR/Value.h (+1-1) 


``````````diff
diff --git a/mlir/include/mlir/IR/Value.h b/mlir/include/mlir/IR/Value.h
index 1c5bf09c1aeb87..fff3b87faff669 100644
--- a/mlir/include/mlir/IR/Value.h
+++ b/mlir/include/mlir/IR/Value.h
@@ -443,7 +443,7 @@ struct TypedValue : Value {
   static bool classof(Value value) { return llvm::isa<Ty>(value.getType()); }
 
   /// Return the known Type
-  Ty getType() { return llvm::cast<Ty>(Value::getType()); }
+  Ty getType() const { return llvm::cast<Ty>(Value::getType()); }
   void setType(Ty ty) { Value::setType(ty); }
 };
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/76568


More information about the Mlir-commits mailing list