| Issue |
170445
|
| Summary |
[clang-tidy] Make misc-const-correctness analyze function parameters
|
| Labels |
enhancement,
clang-tidy
|
| Assignees |
|
| Reporter |
vbvictor
|
Function parameters could be analyzed by misc-const-correctness.
I believe this could be an easy and straightforward improvement by running `MutationAnalyzer` on matched `ParamVarDecl`.
Minimal example https://godbolt.org/z/hjehYKxY5:
```cpp
struct Bar {
void buz() const {};
};
void shoud_be_cosnt(Bar& b) { // could be declared 'const'
b.buz();
}
void local_vars_work(Bar& b) { // note that we immediately can't make it 'const' because of binding to 'ref_b' but after 'ref_b' is 'const', we can convert 'b' to 'const'.
b.buz();
Bar& ref_b = b; // this is already reported to need const
ref_b.buz();
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs