https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/116033
>From adafcceb45853c3e8f797eba51d90e64654dafe6 Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Wed, 13 Nov 2024 12:52:36 +0100
Subject: [PATCH 1/5] [clang-tidy] Add modernize-substr-to-starts-with check
hjanuschka wrote:
refactored and integrated into existing checker. seems to work, with my local
test.cpp files.
however i am struggling, adding tests.
https://github.com/llvm/llvm-project/pull/116033/files#diff-da808871a68f05cbe09bd3761e5092a51a46608bd2206db26c2a98f93e75f68cR274
.substr() is u
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/116033
>From 23b4bcdf52041aad1c5581e0f7dc01028770a154 Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Wed, 13 Nov 2024 12:52:36 +0100
Subject: [PATCH] [clang-tidy] Enhance modernize-use-starts-ends-with with
https://github.com/hjanuschka edited
https://github.com/llvm/llvm-project/pull/116033
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -266,3 +269,53 @@ void test(std::string s, std::string_view sv, sub_string
ss, sub_sub_string sss,
s.compare(0, 1, "ab") == 0;
s.rfind(suffix, 1) == s.size() - suffix.size();
}
+
+void test_substr() {
+std::string str("hello world");
+std::string prefix = "hello
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/116033
>From 7c446c6ce13e8c8c4fda22b70d5eef03852c5572 Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Wed, 13 Nov 2024 12:52:36 +0100
Subject: [PATCH] [clang-tidy] Enhance modernize-use-starts-ends-with with
@@ -189,7 +203,54 @@ void UseStartsEndsWithCheck::check(const
MatchFinder::MatchResult &Result) {
if (ComparisonExpr->getBeginLoc().isMacroID())
return;
- const bool Neg = ComparisonExpr->getOpcode() == BO_NE;
+ bool Neg;
+ if (const auto *BO = llvm::dyn_cast(Compari
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/118074
>From cb748c34d35b8c0c9ca93a67b111dcf5d7665b34 Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Fri, 29 Nov 2024 10:17:49 +0100
Subject: [PATCH 01/25] [clang-tidy] Add modernize-use-span-first-last check
hjanuschka wrote:
feedback addressed.
@5chmidti - added range support
@HerrCai0907 tried using `TK_IgnoreUnlessSpelledInSource` but this breaks the
template based cases.
i am afraid having `TK_IgnoreUnlessSpelledInSource` would require way more
complex matchers? how big of a deal is to not us
@@ -18,108 +18,77 @@ using namespace clang::ast_matchers;
namespace clang::tidy::readability {
void UseSpanFirstLastCheck::registerMatchers(MatchFinder *Finder) {
- // Match span::subspan calls
const auto HasSpanType =
hasType(hasUnqualifiedDesugaredType(recordType(
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/118074
>From cb748c34d35b8c0c9ca93a67b111dcf5d7665b34 Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Fri, 29 Nov 2024 10:17:49 +0100
Subject: [PATCH 01/23] [clang-tidy] Add modernize-use-span-first-last check
https://github.com/hjanuschka commented:
@5chmidti removed the recursive visitor and refactored it, hope this is correct
now, added the test cases, you mentioned, and you where right in the complex
version they failed, work now!
https://github.com/llvm/llvm-project/pull/118074
@@ -0,0 +1,24 @@
+.. title:: clang-tidy - readability-use-span-first-last
+
+readability-use-span-first-last
+===
+
+Suggests using ``std::span::first()`` and ``std::span::last()`` member
functions
+instead of equivalent ``subspan()``. These dedicated
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/118074
>From cb748c34d35b8c0c9ca93a67b111dcf5d7665b34 Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Fri, 29 Nov 2024 10:17:49 +0100
Subject: [PATCH 01/26] [clang-tidy] Add modernize-use-span-first-last check
@@ -0,0 +1,96 @@
+//===--- UseSpanFirstLastCheck.cpp - clang-tidy -*- C++
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apa
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/120055
>From 8b2dc9adf4fae2065823e5beb3a1cd851686913c Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Mon, 16 Dec 2024 08:24:14 +0100
Subject: [PATCH 1/8] [clang-tidy] Add readability-string-view-substr check
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/120055
>From 8b2dc9adf4fae2065823e5beb3a1cd851686913c Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Mon, 16 Dec 2024 08:24:14 +0100
Subject: [PATCH 1/7] [clang-tidy] Add readability-string-view-substr check
@@ -0,0 +1,201 @@
+//===--- StringViewSubstrCheck.cpp - clang-tidy--*- C++
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/120055
>From 8b2dc9adf4fae2065823e5beb3a1cd851686913c Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Mon, 16 Dec 2024 08:24:14 +0100
Subject: [PATCH 1/9] [clang-tidy] Add readability-string-view-substr check
hjanuschka wrote:
@5chmidti may i ping you? could you help me out, it feels like its only inches
away from being done. or could we go with the prev. commit as mentioned above?
https://github.com/llvm/llvm-project/pull/120055
___
cfe-commits mailing li
@@ -0,0 +1,96 @@
+//===--- UseSpanFirstLastCheck.cpp - clang-tidy -*- C++
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apa
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/118074
>From cb748c34d35b8c0c9ca93a67b111dcf5d7665b34 Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Fri, 29 Nov 2024 10:17:49 +0100
Subject: [PATCH 01/29] [clang-tidy] Add modernize-use-span-first-last check
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/120055
>From bcee24de45d955760257bb0b1825e3e59bf7a28c Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Mon, 16 Dec 2024 08:24:14 +0100
Subject: [PATCH 1/2] [clang-tidy] Add readability-string-view-substr check
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/120055
>From bcee24de45d955760257bb0b1825e3e59bf7a28c Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Mon, 16 Dec 2024 08:24:14 +0100
Subject: [PATCH 1/2] [clang-tidy] Add readability-string-view-substr check
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/120055
>From 8b2dc9adf4fae2065823e5beb3a1cd851686913c Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Mon, 16 Dec 2024 08:24:14 +0100
Subject: [PATCH] [clang-tidy] Add readability-string-view-substr check
Add
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/120055
>From 8b2dc9adf4fae2065823e5beb3a1cd851686913c Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Mon, 16 Dec 2024 08:24:14 +0100
Subject: [PATCH 1/3] [clang-tidy] Add readability-string-view-substr check
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/120055
>From 8b2dc9adf4fae2065823e5beb3a1cd851686913c Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Mon, 16 Dec 2024 08:24:14 +0100
Subject: [PATCH 1/4] [clang-tidy] Add readability-string-view-substr check
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/120055
>From 8b2dc9adf4fae2065823e5beb3a1cd851686913c Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Mon, 16 Dec 2024 08:24:14 +0100
Subject: [PATCH 1/2] [clang-tidy] Add readability-string-view-substr check
https://github.com/hjanuschka created
https://github.com/llvm/llvm-project/pull/120055
Add a new check that suggests using `string_view::remove_prefix()` and
`remove_suffix()` instead of `substr()` when the intent is to remove characters
from either end of a string_view.
>From 16a98e0d99cc
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/120055
>From 16a98e0d99ccee0c2bb6bad51c27c67c5c43d747 Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Mon, 16 Dec 2024 08:24:14 +0100
Subject: [PATCH] [clang-tidy] Add readability-string-view-substr check
Add
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/120055
>From bcee24de45d955760257bb0b1825e3e59bf7a28c Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Mon, 16 Dec 2024 08:24:14 +0100
Subject: [PATCH] [clang-tidy] Add readability-string-view-substr check
Add
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/120055
>From 8b2dc9adf4fae2065823e5beb3a1cd851686913c Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Mon, 16 Dec 2024 08:24:14 +0100
Subject: [PATCH 1/2] [clang-tidy] Add readability-string-view-substr check
https://github.com/hjanuschka ready_for_review
https://github.com/llvm/llvm-project/pull/120055
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hjanuschka edited
https://github.com/llvm/llvm-project/pull/120055
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/120055
>From 8b2dc9adf4fae2065823e5beb3a1cd851686913c Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Mon, 16 Dec 2024 08:24:14 +0100
Subject: [PATCH 1/5] [clang-tidy] Add readability-string-view-substr check
https://github.com/hjanuschka edited
https://github.com/llvm/llvm-project/pull/120055
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hjanuschka edited
https://github.com/llvm/llvm-project/pull/120055
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/120055
>From 8b2dc9adf4fae2065823e5beb3a1cd851686913c Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Mon, 16 Dec 2024 08:24:14 +0100
Subject: [PATCH 1/5] [clang-tidy] Add readability-string-view-substr check
@@ -0,0 +1,104 @@
+//===--- UseSpanFirstLastCheck.cpp - clang-tidy -*- C++
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/118074
>From cb748c34d35b8c0c9ca93a67b111dcf5d7665b34 Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Fri, 29 Nov 2024 10:17:49 +0100
Subject: [PATCH 01/31] [clang-tidy] Add modernize-use-span-first-last check
https://github.com/hjanuschka commented:
ready for re-review
https://github.com/llvm/llvm-project/pull/118074
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
hjanuschka wrote:
feedback addressed, you were right about the template case, it is really
broken, adding:
```
std::optional getCheckTraversalKind() const override {
return TK_IgnoreUnlessSpelledInSource;
}
```
fixes it, but now templates seem to be skipped completely. and existing
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/116033
>From 23b4bcdf52041aad1c5581e0f7dc01028770a154 Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Wed, 13 Nov 2024 12:52:36 +0100
Subject: [PATCH 1/9] [clang-tidy] Enhance modernize-use-starts-ends-with wi
@@ -183,40 +210,45 @@ void UseStartsEndsWithCheck::check(const
MatchFinder::MatchResult &Result) {
const auto *EndsWithFunction =
Result.Nodes.getNodeAs("ends_with_fun");
assert(bool(StartsWithFunction) != bool(EndsWithFunction));
+
const CXXMethodDecl *Replacemen
https://github.com/hjanuschka commented:
feedback addressed, not sure how to proceed with output format changes
https://github.com/llvm/llvm-project/pull/116033
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mail
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/116033
>From 23b4bcdf52041aad1c5581e0f7dc01028770a154 Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Wed, 13 Nov 2024 12:52:36 +0100
Subject: [PATCH 01/10] [clang-tidy] Enhance modernize-use-starts-ends-with
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/116033
>From 23b4bcdf52041aad1c5581e0f7dc01028770a154 Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Wed, 13 Nov 2024 12:52:36 +0100
Subject: [PATCH 01/11] [clang-tidy] Enhance modernize-use-starts-ends-with
https://github.com/hjanuschka commented:
feedback addressed
https://github.com/llvm/llvm-project/pull/116033
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -183,40 +210,47 @@ void UseStartsEndsWithCheck::check(const
MatchFinder::MatchResult &Result) {
const auto *EndsWithFunction =
Result.Nodes.getNodeAs("ends_with_fun");
assert(bool(StartsWithFunction) != bool(EndsWithFunction));
+
const CXXMethodDecl *Replacemen
@@ -240,6 +240,9 @@ void UseStartsEndsWithCheck::check(const
MatchFinder::MatchResult &Result) {
ReplacementFunction->getName());
// Replace arguments and everything after the function call.
+ if (FindExpr->getNumArgs() == 0) {
+r
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/116033
>From 23b4bcdf52041aad1c5581e0f7dc01028770a154 Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Wed, 13 Nov 2024 12:52:36 +0100
Subject: [PATCH 01/12] [clang-tidy] Enhance modernize-use-starts-ends-with
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/118074
>From cb748c34d35b8c0c9ca93a67b111dcf5d7665b34 Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Fri, 29 Nov 2024 10:17:49 +0100
Subject: [PATCH 01/22] [clang-tidy] Add modernize-use-span-first-last check
@@ -0,0 +1,24 @@
+.. title:: clang-tidy - readability-use-span-first-last
+
+readability-use-span-first-last
+===
+
+Checks for uses of ``std::span::subspan()`` that can be replaced with clearer
+``first()`` or ``last()`` member functions. These dedicat
https://github.com/hjanuschka edited
https://github.com/llvm/llvm-project/pull/120055
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/120055
>From 8b2dc9adf4fae2065823e5beb3a1cd851686913c Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Mon, 16 Dec 2024 08:24:14 +0100
Subject: [PATCH 01/11] [clang-tidy] Add readability-string-view-substr chec
hjanuschka wrote:
@PiotrZSL feedback addressed
@5chmidti - thank you for your feedback, i have now invested multiple days over
a few weeks to somehow make this work.
started multiple attempts from scratch, at this point i don't even know what i
have tried and what not, the last commit.
https
https://github.com/hjanuschka updated
https://github.com/llvm/llvm-project/pull/120055
>From 8b2dc9adf4fae2065823e5beb3a1cd851686913c Mon Sep 17 00:00:00 2001
From: Helmut Januschka
Date: Mon, 16 Dec 2024 08:24:14 +0100
Subject: [PATCH 01/12] [clang-tidy] Add readability-string-view-substr chec
101 - 157 of 157 matches
Mail list logo