[clang-tools-extra] [clang-tidy][bugprone-posix-return] support integer literals as LHS (PR #109302)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 20 07:44:13 PDT 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 5e3d48a68096a0017a0fa4bb89f2d48767c8a7e4 b42278e592a9d64ba6868ee6eb5663cb8306e16b --extensions cpp -- clang-tools-extra/clang-tidy/bugprone/PosixReturnCheck.cpp clang-tools-extra/test/clang-tidy/checkers/bugprone/posix-return.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang-tools-extra/clang-tidy/bugprone/PosixReturnCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/PosixReturnCheck.cpp
index e4ceee127a..ffc58e5739 100644
--- a/clang-tools-extra/clang-tidy/bugprone/PosixReturnCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/PosixReturnCheck.cpp
@@ -67,9 +67,9 @@ void PosixReturnCheck::check(const MatchFinder::MatchResult &Result) {
if (const auto *LessThanZeroOp =
Result.Nodes.getNodeAs<BinaryOperator>("ltzop")) {
SourceLocation OperatorLoc = LessThanZeroOp->getOperatorLoc();
- const char NewBinOp = LessThanZeroOp->getOpcode() == BinaryOperator::Opcode::BO_LT
- ? '>'
- : '<';
+ const char NewBinOp =
+ LessThanZeroOp->getOpcode() == BinaryOperator::Opcode::BO_LT ? '>'
+ : '<';
diag(OperatorLoc, "the comparison always evaluates to false because %0 "
"always returns non-negative values")
<< getFunctionSpelling(Result)
``````````
</details>
https://github.com/llvm/llvm-project/pull/109302
More information about the cfe-commits
mailing list