gribozavr accepted this revision.
gribozavr added a comment.

Good improvements!



================
Comment at: clang-tools-extra/clang-tidy/bugprone/PosixReturnCheck.cpp:21
+static StringRef getFunctionSpelling(const MatchFinder::MatchResult &Result, 
const char *BindingStr) {
+  const CallExpr *MatchedCall = cast 
<CallExpr>((Result.Nodes.getNodeAs<BinaryOperator>(BindingStr))->getLHS());
+  const SourceManager &SM = *Result.SourceManager;
----------------
Please clang-format (the whole file).


================
Comment at: clang-tools-extra/clang-tidy/bugprone/PosixReturnCheck.cpp:56
+    SourceLocation OperatorLoc = LessThanZeroOp->getOperatorLoc();
+    diag(OperatorLoc, "%0 only returns nonnegative values")
+        << getFunctionSpelling(Result, "ltzop")
----------------
"non-negative"

"the comparison always evaluates to false because %0 always returns 
non-negative values"


================
Comment at: clang-tools-extra/clang-tidy/bugprone/PosixReturnCheck.cpp:62
+  if (const auto *AlwaysTrueOp = 
Result.Nodes.getNodeAs<BinaryOperator>("atop")) {
+    diag(AlwaysTrueOp->getOperatorLoc(), "redundant check as %0 only returns 
nonnegative values")
+        << getFunctionSpelling(Result, "atop");
----------------
I'd suggest "the comparison always evaluates to true because %0 always returns 
a non-negative value"


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63623/new/

https://reviews.llvm.org/D63623



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to