[clang-tools-extra] [clang-tidy] add readability-redundant-parentheses (PR #159911)
Baranov Victor via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 25 09:03:28 PDT 2025
================
@@ -0,0 +1,29 @@
+.. title:: clang-tidy - readability-redundant-parentheses
+
+readability-redundant-parentheses
+=================================
+
+Detect redundant parentheses.
+
+When modifying the code, one often forgets to remove the corresponding parentheses.
+This results in overly lengthy code. When the expression is complex, finding
+the matching parentheses becomes particularly difficult.
+
+Example
+-------
+
+.. code-block:: c++
+
+ (1);
+ ((a + 2)) * 3;
+ (a);
+ ("aaa");
+
+Currently this check does not take into account the precedence of operations.
+Even if the expression within the parentheses has a higher priority than that
+outside the parentheses, in other words, removing the parentheses will not
+affect the semantic.
----------------
vbvictor wrote:
```suggestion
affect the semantics.
```
Not very sure about this one, but `semantics` usually used in plural?
https://github.com/llvm/llvm-project/pull/159911
More information about the cfe-commits
mailing list