[clang-tools-extra] [clang] [llvm] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

Piotr Zegar via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 22 08:42:00 PST 2024


https://github.com/PiotrZSL approved this pull request.

Just few style issues. For me from functional point of view this check looks fine and even in this limited state could be delivered.

Personaly:
- I would like to see more code moved into AST matchers
- Support for if/else
- Support for code like this;
```
if (a > b)
  x  = a
else 
  x = b;
```
- Support for code like this:
```
int x = b;
if (a > b)
  x  = a
```

Branch out of Clang-tidy 18 is tomorrow, for me this could be merged today / tomorrow morning. Would be nice to see some of reported issues resolved. Would be nice if work on this check would continue in next release (under new push request) to add support for missing things.

https://github.com/llvm/llvm-project/pull/77816


More information about the cfe-commits mailing list