[clang-tools-extra] [clang-tidy] Add readability-constant-operand-order check (PR #167158)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 9 22:56:19 PST 2025


================
@@ -0,0 +1,31 @@
+// RUN: %check_clang_tidy %s readability-constant-operand-order %t -- -- -std=c++17
+// RUN: %check_clang_tidy %s readability-constant-operand-order %t -- -check-suffixes=LEFT -- -config="{CheckOptions:[{key: readability-constant-operand-order.PreferredConstantSide, value: Left}, {key: readability-constant-operand-order.BinaryOperators, value: '==,!='}]}" -- -std=c++17
+
+void swap_eq(int a) {
+  if (0 == a) {} // CHECK-MESSAGES: warning: constant operand should be on the Right side
----------------
zwuis wrote:

Please verify line numbers and column numbers. Ditto elsewhere.

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


More information about the cfe-commits mailing list