[clang-tools-extra] [clang-tidy] Add check for assignment or comparision operators' operand in `readability-math-missing-parentheses` (PR #141345)
Baranov Victor via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 4 09:02:39 PDT 2025
================
@@ -157,3 +157,17 @@ namespace PR92516 {
for (j = i + 1, 2; j < 1; ++j) {}
}
}
+
+namespace PR141249 {
+ void AssignAsParentBinOp(int* netChange, int* nums, int k, int i) {
+ //CHECK-MESSAGES: :[[@LINE+1]]:30: warning: '-' has higher precedence than '^'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]
+ netChange[i] = nums[i] ^ k - nums[i];
+ }
+}
+
+void CompareAsParentBinOp(int b) {
+ //CHECK-MESSAGES: :[[@LINE+1]]:12: warning: '*' has higher precedence than '-'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]
----------------
vbvictor wrote:
Here also
https://github.com/llvm/llvm-project/pull/141345
More information about the cfe-commits
mailing list