[clang-tools-extra] [mlir] [clang-tidy][mlir] Add check for passing value type by reference. (PR #179882)
Baranov Victor via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 6 05:46:59 PST 2026
vbvictor wrote:
I think we should make a generalised check (with types that can be configure).
In LLVM I can think of `SourceLocation` which is small and should be passed by value too.
Also, pass by value should be applied to built-in integer/floats and pointers.
------------------------------------------------------------
Isn't this a misleading behavoir?
```cpp
void badFunctionMutable(MyOp &op) {
op = newOp()
}
```
What if someone overrides `op` inside function - then the check produces FP?
https://github.com/llvm/llvm-project/pull/179882
More information about the cfe-commits
mailing list