[Mlir-commits] [mlir] [MLIR] Add 'const' qualifier to some functions (PR #72430)
Oleksandr Alex Zinenko
llvmlistbot at llvm.org
Fri Nov 17 12:25:51 PST 2023
================
@@ -182,10 +182,10 @@ class Value {
/// Replace all uses of 'this' value with 'newValue' if the given callback
/// returns true.
void replaceUsesWithIf(Value newValue,
- function_ref<bool(OpOperand &)> shouldReplace);
+ function_ref<bool(OpOperand &)> shouldReplace) const;
/// Returns true if the value is used outside of the given block.
- bool isUsedOutsideOfBlock(Block *block);
+ bool isUsedOutsideOfBlock(Block *block) const;
----------------
ftynse wrote:
I have seen some cases where iterating over a container gives you a const reference by default, e.g., when `Value` is a map key IIRC or stored in an `ArrayRef` (rather than `ValueRange`). The usual solution to that is to store it in a value-typed variable, without using `auto`, so we don't see much of these upstream.
https://github.com/llvm/llvm-project/pull/72430
More information about the Mlir-commits
mailing list