[clang-tools-extra] [clang-tidy] Add new check 'misc-scope-reduction' (PR #175429)
Oliver Stöneberg via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 11 10:53:18 PST 2026
firewave wrote:
The tests only utilize assignments involving literals. It should also test something like this:
```cpp
int func();
void test() {
int i = func();
if (true) {
i = 0;
}
}
```
Since it is not known of the call has any side effects it should not be suggested. If the implementation were visible it could be determined but I think such assignments should be completely excluded for now and left for a follow-up (and have a tunable).
https://github.com/llvm/llvm-project/pull/175429
More information about the cfe-commits
mailing list