[clang-tools-extra] [clang-tidy] Fix redundant-parentheses diagnosing synthetic parentheses (PR #228666)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 3 09:09:46 PDT 2026


================
@@ -93,6 +93,8 @@ void RedundantParenthesesCheck::registerMatchers(MatchFinder *Finder) {
 
 void RedundantParenthesesCheck::check(const MatchFinder::MatchResult &Result) {
   const auto *PE = Result.Nodes.getNodeAs<ParenExpr>("dup");
+  if (PE->getLParen() == PE->getRParen())
+    return;
----------------
vbvictor wrote:

This should be a custom ast matcher, something like `isWritten`.
Place it inside Finder->addMatcher(
      parenExpr(

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


More information about the cfe-commits mailing list