[clang-tools-extra] [clang-tidy] Add new check 'misc-scope-reduction' (PR #175429)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 12 17:50:34 PST 2026
vabridgers wrote:
> The tests only utilize assignments involving literals. It should also test something like this:
>
> ```c++
> int func();
>
> void test() {
> int i = func();
> if (true) {
> i = 0;
> }
> }
> ```
>
> Since it is not known if 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).
I believe I've address this and added a test case.
https://github.com/llvm/llvm-project/pull/175429
More information about the cfe-commits
mailing list