[clang-tools-extra] [clang-tidy] Add `bugprone-errno-comparison` check (PR #210548)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 19 04:55:29 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 h,cpp,c -- clang-tools-extra/clang-tidy/bugprone/ErrnoComparisonCheck.cpp clang-tools-extra/clang-tidy/bugprone/ErrnoComparisonCheck.h clang-tools-extra/test/clang-tidy/checkers/bugprone/errno-comparison.c clang-tools-extra/test/clang-tidy/checkers/bugprone/errno-comparison.cpp clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.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/bugprone/ErrnoComparisonCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/ErrnoComparisonCheck.cpp
index ebec29b26..0f1ef9da9 100644
--- a/clang-tools-extra/clang-tidy/bugprone/ErrnoComparisonCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/ErrnoComparisonCheck.cpp
@@ -16,12 +16,11 @@ using namespace clang::ast_matchers;
namespace clang::tidy::bugprone {
void ErrnoComparisonCheck::registerMatchers(MatchFinder *Finder) {
- Finder->addMatcher(
- binaryOperator(
- isComparisonOperator(),
- hasEitherOperand(ignoringParenImpCasts(integerLiteral().bind("lit"))))
- .bind("cmp"),
- this);
+ Finder->addMatcher(binaryOperator(isComparisonOperator(),
+ hasEitherOperand(ignoringParenImpCasts(
+ integerLiteral().bind("lit"))))
+ .bind("cmp"),
+ this);
}
void ErrnoComparisonCheck::check(const MatchFinder::MatchResult &Result) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/210548
More information about the cfe-commits
mailing list