[clang-tools-extra] [clang-tidy] Add bugprone-chained-comparison check (PR #76365)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 21 14:56:40 PST 2024
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 9fba1d5f3a52af0ae62f386d0c494bd9510fa845 9da19e1e90afd21ef6c783159265dac234846b8b -- clang-tools-extra/clang-tidy/bugprone/ChainedComparisonCheck.cpp clang-tools-extra/clang-tidy/bugprone/ChainedComparisonCheck.h clang-tools-extra/test/clang-tidy/checkers/bugprone/chained-comparison.c clang-tools-extra/test/clang-tidy/checkers/bugprone/chained-comparison.cpp clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang-tools-extra/clang-tidy/bugprone/ChainedComparisonCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/ChainedComparisonCheck.cpp
index 475de8a5a5..c6bb5bdf5c 100644
--- a/clang-tools-extra/clang-tidy/bugprone/ChainedComparisonCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/ChainedComparisonCheck.cpp
@@ -101,12 +101,12 @@ void ChainedComparisonData::extract(const Expr *Op) {
if (!Op)
return;
- if (const auto* BinaryOp = dyn_cast<BinaryOperator>(Op)) {
+ if (const auto *BinaryOp = dyn_cast<BinaryOperator>(Op)) {
extract(BinaryOp);
return;
}
- if (const auto* OverloadedOp = dyn_cast<CXXOperatorCallExpr>(Op)) {
+ if (const auto *OverloadedOp = dyn_cast<CXXOperatorCallExpr>(Op)) {
if (OverloadedOp->getNumArgs() == 2U)
extract(OverloadedOp);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/76365
More information about the cfe-commits
mailing list