[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Nicolas van Kempen via cfe-commits
nicovank wrote: Addressed feedback, renamed to `performance-use-starts-ends-with`, relaxed use of `auto`. https://github.com/llvm/llvm-project/pull/72385 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/72385 >From fd3e09fddae97549c327cf224d66de144221fe83 Mon Sep 17 00:00:00 2001 From: Nicolas van Kempen Date: Wed, 15 Nov 2023 01:13:10 -0800 Subject: [PATCH] [clang-tidy] Add new modernize-string-find-startswith

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/72385 >From 5d66e404d9b6536814f004a64e1c7f0d27bd1f03 Mon Sep 17 00:00:00 2001 From: Nicolas van Kempen Date: Wed, 15 Nov 2023 01:13:10 -0800 Subject: [PATCH] [clang-tidy] Add new modernize-string-find-startswith

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/72385 >From 9c6123e91f6a075a6a4cc7c2aba8c76152539ae2 Mon Sep 17 00:00:00 2001 From: Nicolas van Kempen Date: Wed, 15 Nov 2023 01:13:10 -0800 Subject: [PATCH] [clang-tidy] Add new modernize-string-find-startswith

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/72385 >From 35a78d8fa7d16c60f7b40b3f0b53cc38c26b58b9 Mon Sep 17 00:00:00 2001 From: Nicolas van Kempen Date: Wed, 15 Nov 2023 01:13:10 -0800 Subject: [PATCH] [clang-tidy] Add new modernize-string-find-startswith

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: Performance is fine, go ahead. https://github.com/llvm/llvm-project/pull/72385 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread via cfe-commits
@@ -0,0 +1,105 @@ +//===--- StringFindStartswithCheck.cpp - clang-tidy ---===// +// +// 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:

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread via cfe-commits
https://github.com/EugeneZelenko edited https://github.com/llvm/llvm-project/pull/72385 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread via cfe-commits
https://github.com/EugeneZelenko requested changes to this pull request. https://github.com/llvm/llvm-project/pull/72385 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Nicolas van Kempen via cfe-commits
nicovank wrote: I like `XXX-use-starts-ends-with`. I would rather move it to `performance` than `readability` if not `modernize`. @PiotrZSL thoughts before I go ahead and do the renaming? Also move it somewhere else? https://github.com/llvm/llvm-project/pull/72385

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: > contains We already got one check for contains, its readability-container-contains, not sure how it apply for std::string, but maybe instead of calling this check modernize it could be readability, otherwise all checks would be modernize.

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: Maybe modernize-use-starts-ends-with https://github.com/llvm/llvm-project/pull/72385 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Oliver Stöneberg via cfe-commits
firewave wrote: > Any thoughts on open-ended check name instead? `modernize-string-find-affix` > (affix = prefix | suffix)? `modernize-string-startswith-endswith` is the first what popped into my head but it would not have been my first choice. Would this also be the check you would

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Nicolas van Kempen via cfe-commits
@@ -0,0 +1,41 @@ +//===--- StringFindStartswithCheck.h - 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:

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Nicolas van Kempen via cfe-commits
nicovank wrote: > Detect the `str.compare("marker", 0, 6) == 0` pattern. This is actually in my notes for making this check / codemod. No performance impact so not tackling yet, maybe in the future. > Support `ends_with` in same check. Similar as above, matching for that length argument is a

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Oliver Stöneberg via cfe-commits
firewave wrote: > would be to support also endswith in same check +1 On a side note: I will be looking into the related patterns and their performance soon as I am getting very strange code/performance when they are used outside of a benchmark - especially with Clang.

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Nicolas van Kempen via cfe-commits
@@ -0,0 +1,105 @@ +//===--- StringFindStartswithCheck.cpp - clang-tidy ---===// +// +// 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:

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Piotr Zegar via cfe-commits
@@ -181,6 +181,14 @@ New checks points in a coroutine. Such hostile types include scoped-lockable types and types belonging to a configurable denylist. +- New :doc:`modernize-string-find-startswith + ` check. + + Checks whether a ``std::string::find()`` or

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,41 @@ +//===--- StringFindStartswithCheck.h - 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:

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,105 @@ +//===--- StringFindStartswithCheck.cpp - clang-tidy ---===// +// +// 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:

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,105 @@ +//===--- StringFindStartswithCheck.cpp - clang-tidy ---===// +// +// 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:

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank edited https://github.com/llvm/llvm-project/pull/72385 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,105 @@ +//===--- StringFindStartswithCheck.cpp - clang-tidy ---===// +// +// 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:

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: would be to support also endswith in same check, so i'm not so sure about check name. https://github.com/llvm/llvm-project/pull/72385 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/72385 >From d31148a9d99004f1a64dc6dc1bce85a58985aa0f Mon Sep 17 00:00:00 2001 From: Nicolas van Kempen Date: Wed, 15 Nov 2023 01:13:10 -0800 Subject: [PATCH] [clang-tidy] Add new modernize-string-find-startswith

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Oliver Stöneberg via cfe-commits
firewave wrote: I wonder if this should also detect the `str.compare("marker", 0, 6) == 0` pattern. There is possibly some kind of pattern involving `std::equal()` as well. Could as well be a different check though. Not sure if it would have a performance impact to use `starts_with()` instead

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/72385 >From d9995b339e787374452b65fcffa8b3acf4aade3d Mon Sep 17 00:00:00 2001 From: Nicolas van Kempen Date: Wed, 15 Nov 2023 01:13:10 -0800 Subject: [PATCH] [clang-tidy] Add new modernize-string-find-startswith

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/72385 >From 2b01f9d8cb945d8332a271947492ec0fe7a6f7c0 Mon Sep 17 00:00:00 2001 From: Nicolas van Kempen Date: Wed, 15 Nov 2023 01:13:10 -0800 Subject: [PATCH] [clang-tidy] Add new modernize-string-find-startswith

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-tidy Author: Nicolas van Kempen (nicovank) Changes Matchers are copied over from abseil-string-find-startswith, only the error message is different and suggests `std::{string|string_view}::starts_with` instead of the Abseil equivalent. --- Full

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank ready_for_review https://github.com/llvm/llvm-project/pull/72385 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/72385 >From 58e1392e140f0d5b932fce683a07fb799ef6b89f Mon Sep 17 00:00:00 2001 From: Nicolas van Kempen Date: Wed, 15 Nov 2023 01:13:10 -0800 Subject: [PATCH] [clang-tidy] Add new modernize-string-find-startswith

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 2060bfcdc7eb704647c64bf925cdceb94c1f535f 5e5a2bac0f7373e6b1830fddc609e97dc61df9d4 --

[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

2023-11-15 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank created https://github.com/llvm/llvm-project/pull/72385 Matchers are copied over from abseil-string-find-startswith, only the error message is different and suggests `std::{string|string_view}::starts_with` instead of the Abseil equivalent. >From