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

via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 13 07:52:03 PST 2024


================
@@ -0,0 +1,57 @@
+// RUN: %check_clang_tidy %s readability-use-std-min-max %t
+
+constexpr int myConstexprMin(int a, int b) {
+  return a < b ? a : b;
+}
+
+constexpr int myConstexprMax(int a, int b) {
+  return a > b ? a : b;
+}
+
+int bar(int x, int y) {
+  return x < y ? x : y;
+}
+void foo() {
----------------
EugeneZelenko wrote:

Please separate with newline.

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


More information about the cfe-commits mailing list