================ @@ -61,23 +67,26 @@ 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 ? '>' + : '<'; diag(OperatorLoc, "the comparison always evaluates to false because %0 " "always returns non-negative values") - << getFunctionSpelling(Result, "ltzop") - << FixItHint::CreateReplacement(OperatorLoc, Twine(">").str()); + << getFunctionSpelling(Result) + << FixItHint::CreateReplacement(OperatorLoc, Twine(NewBinOp).str()); ---------------- 5chmidti wrote:
Nit: the `Twine` isn't needed, `CreateReplacement` takes a `StringRef` https://github.com/llvm/llvm-project/pull/109302 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits