[clang-tools-extra] [clang-tidy] Enhance modernize-use-starts-ends-with to handle substr patterns (PR #116033)

Helmut Januschka via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 18 10:25:53 PST 2024


================
@@ -71,6 +71,17 @@ struct NotLengthExprForStringNode {
   ASTContext *Context;
 };
 
+static bool isNegativeComparison(const Expr *ComparisonExpr) {
+  if (const auto *BO = llvm::dyn_cast<BinaryOperator>(ComparisonExpr)) {
+    return BO->getOpcode() == BO_NE;
+  }
----------------
hjanuschka wrote:

got you! also prefer more braces than less, but as always follow the projects styleguide.
(wonder if clang-format, should mention that?)

especially this hurts my inner braces monk:
```
  if (const auto *Op = llvm::dyn_cast<CXXOperatorCallExpr>(ComparisonExpr))
    return Op->getOperator() == OO_ExclaimEqual;

  return false;
```




https://github.com/llvm/llvm-project/pull/116033


More information about the cfe-commits mailing list