[clang-tools-extra] added check for the parentheses declaration (PR #196739)
via cfe-commits
cfe-commits at lists.llvm.org
Sat May 9 11:07:55 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- clang-tools-extra/clang-tidy/readability/RedundantParenthesesCheck.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang-tools-extra/clang-tidy/readability/RedundantParenthesesCheck.cpp b/clang-tools-extra/clang-tidy/readability/RedundantParenthesesCheck.cpp
index 6d473ccf1..f5909e364 100644
--- a/clang-tools-extra/clang-tidy/readability/RedundantParenthesesCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/RedundantParenthesesCheck.cpp
@@ -6,11 +6,11 @@
//
//===----------------------------------------------------------------------===//
-#include "clang/AST/TypeLoc.h"
#include "RedundantParenthesesCheck.h"
#include "../utils/Matchers.h"
#include "../utils/OptionsUtils.h"
#include "clang/AST/Expr.h"
+#include "clang/AST/TypeLoc.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/ASTMatchers/ASTMatchersMacros.h"
@@ -68,11 +68,10 @@ void RedundantParenthesesCheck::registerMatchers(MatchFinder *Finder) {
void RedundantParenthesesCheck::check(const MatchFinder::MatchResult &Result) {
if (const auto *PE = Result.Nodes.getNodeAs<ParenExpr>("dup")) {
-
diag(PE->getBeginLoc(), "redundant parentheses around expression")
<< FixItHint::CreateRemoval(PE->getLParen())
<< FixItHint::CreateRemoval(PE->getRParen());
- return ;
+ return;
}
if (const auto *TL = Result.Nodes.getNodeAs<TypeLoc>("parentheses-decl")) {
@@ -86,7 +85,6 @@ void RedundantParenthesesCheck::check(const MatchFinder::MatchResult &Result) {
<< FixItHint::CreateRemoval(ParenType.getRParenLoc());
return;
}
-
}
} // namespace clang::tidy::readability
``````````
</details>
https://github.com/llvm/llvm-project/pull/196739
More information about the cfe-commits
mailing list