5chmidti wrote:

> It currently handles this case:
> 
> ```
> if (value1 < value2)
>   value = value2;
> else
>   value = value1;
> ```

When I add 
```c++
  if (value1 < value2)
    value3 = value2;
  else
    value3 = value1;
```
(just renamed `value` to `value3`) to the tests, the check does not suggest 
using `value3 = std::max(value1, value2);`.

The example from @felix642 used two different expressions on the LHS of the 
assignment (`value1 = ` and `value2 = `) and correctly does not emit a 
diagnostic:
```c++
if(value1 < value2)
    value1 = value2;
else
    value2 = value1;
```

https://github.com/llvm/llvm-project/pull/77816
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to