https://github.com/PiotrZSL closed
https://github.com/llvm/llvm-project/pull/89530
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/nicovank updated
https://github.com/llvm/llvm-project/pull/89530
>From c6706922f31d4a7eedecb483346f99bffef67539 Mon Sep 17 00:00:00 2001
From: Nicolas van Kempen
Date: Sun, 21 Apr 2024 05:17:19 +
Subject: [PATCH] [clang-tidy][modernize-use-starts-ends-with] Add support
@@ -3,15 +3,16 @@
modernize-use-starts-ends-with
==
-Checks whether a ``find`` or ``rfind`` result is compared with 0 and suggests
-replacing with ``starts_with`` when the method exists in the class. Notably,
+Checks for common roundabout ways to
@@ -3,15 +3,16 @@
modernize-use-starts-ends-with
==
-Checks whether a ``find`` or ``rfind`` result is compared with 0 and suggests
-replacing with ``starts_with`` when the method exists in the class. Notably,
+Checks for common roundabout ways to
nicovank wrote:
Got it, thanks! I'm somewhat familiar using InnerMatchers but didn't think that
solution fit quite right here.
This new version I think is much better. Kept matcher construction in
`registerMatchers`, added a little bit of logic in `check` to make sure some
sizes match.
https://github.com/nicovank updated
https://github.com/llvm/llvm-project/pull/89530
>From 98af89a36d4f112c3b31e450a5e6df8b6593aed4 Mon Sep 17 00:00:00 2001
From: Nicolas van Kempen
Date: Sun, 21 Apr 2024 05:17:19 +
Subject: [PATCH] [clang-tidy][modernize-use-starts-ends-with] Add support
@@ -16,6 +16,75 @@
using namespace clang::ast_matchers;
namespace clang::tidy::modernize {
+namespace {
+// Given two argument indices X and Y, matches when a call expression has a
+// string at index X with an expression representing that string's length at
+// index Y. The
nicovank wrote:
Update following feedback. I rewrote `hasStringAndLengthArguments` to only
build the matchers once (`static`), with necessary information being saved in
variable bindings. @PiotrZSL This should be better, right?
https://github.com/llvm/llvm-project/pull/89530
https://github.com/nicovank updated
https://github.com/llvm/llvm-project/pull/89530
>From ff7ebb3086d5467685e54435f3eabe86c76c24b0 Mon Sep 17 00:00:00 2001
From: Nicolas van Kempen
Date: Sun, 21 Apr 2024 05:17:19 +
Subject: [PATCH] [clang-tidy][modernize-use-starts-ends-with] Add support
@@ -16,6 +16,49 @@
using namespace clang::ast_matchers;
namespace clang::tidy::modernize {
+namespace {
+// Given two argument indices X and Y, matches when a call expression has a
+// string at index X with an expression representing that string's length at
+// index Y. The
@@ -16,6 +16,49 @@
using namespace clang::ast_matchers;
namespace clang::tidy::modernize {
+namespace {
+// Given two argument indices X and Y, matches when a call expression has a
+// string at index X with an expression representing that string's length at
+// index Y. The
@@ -298,6 +298,10 @@ Changes in existing checks
check by resolving fix-it overlaps in template code by disregarding implicit
instances.
+- Improved :doc:`modernize-use-starts-ends-with
+ ` check to also handle
+ cases using `compare()`.
PiotrZSL wrote:
https://github.com/PiotrZSL approved this pull request.
Looks +- fine, I just worry a little bit about performance.
But as "HasStringAndLengthArguments" will be executed only for an compare
methods, then probably it could be fine.
https://github.com/llvm/llvm-project/pull/89530
https://github.com/PiotrZSL edited
https://github.com/llvm/llvm-project/pull/89530
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -16,6 +16,49 @@
using namespace clang::ast_matchers;
namespace clang::tidy::modernize {
+namespace {
+// Given two argument indices X and Y, matches when a call expression has a
+// string at index X with an expression representing that string's length at
+// index Y. The
@@ -94,11 +155,12 @@ void UseStartsEndsWithCheck::check(const
MatchFinder::MatchResult ) {
Diagnostic << FixItHint::CreateRemoval(CharSourceRange::getCharRange(
ComparisonExpr->getBeginLoc(), FindExpr->getBeginLoc()));
- // Replace '(r?)find' with 'starts_with'.
+
@@ -298,6 +298,10 @@ Changes in existing checks
check by resolving fix-it overlaps in template code by disregarding implicit
instances.
+- Improved :doc:`modernize-use-starts-ends-with
EugeneZelenko wrote:
Please keep alphabetical order in this section
@@ -298,6 +298,10 @@ Changes in existing checks
check by resolving fix-it overlaps in template code by disregarding implicit
instances.
+- Improved :doc:`modernize-use-starts-ends-with
+ ` check to also handle
+ cases using `compare()`.
EugeneZelenko
https://github.com/nicovank updated
https://github.com/llvm/llvm-project/pull/89530
>From 7a2ff84f113959bc89f50b6eef7ee9762e6f5d2f Mon Sep 17 00:00:00 2001
From: Nicolas van Kempen
Date: Sun, 21 Apr 2024 05:17:19 +
Subject: [PATCH] [clang-tidy][modernize-use-starts-ends-with] Add support
https://github.com/nicovank updated
https://github.com/llvm/llvm-project/pull/89530
>From 5f20627f74103d3b2b5adf484c902b85228006dd Mon Sep 17 00:00:00 2001
From: Nicolas van Kempen
Date: Sun, 21 Apr 2024 05:17:19 +
Subject: [PATCH] [clang-tidy][modernize-use-starts-ends-with] Add support
llvmbot wrote:
@llvm/pr-subscribers-clang-tidy
Author: Nicolas van Kempen (nicovank)
Changes
Using `compare` is the next most common roundabout way to express `starts_with`
before it was added to the standard. In this case, using `starts_with` is a
readability improvement. Extend
llvmbot wrote:
@llvm/pr-subscribers-clang-tools-extra
Author: Nicolas van Kempen (nicovank)
Changes
Using `compare` is the next most common roundabout way to express `starts_with`
before it was added to the standard. In this case, using `starts_with` is a
readability improvement. Extend
https://github.com/nicovank created
https://github.com/llvm/llvm-project/pull/89530
Using `compare` is the next most common roundabout way to express `starts_with`
before it was added to the standard. In this case, using `starts_with` is a
readability improvement. Extend existing
23 matches
Mail list logo