[clang-tools-extra] [run-clang-tidy.py] Refactor, add progress indicator, add type hints (PR #89490)

2024-04-27 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/89490 >From 129187f336bf6351dae4604d690809f4095a2e7e Mon Sep 17 00:00:00 2001 From: Nicolas van Kempen Date: Sat, 20 Apr 2024 02:58:25 + Subject: [PATCH] [run-clang-tidy.py] Refactor, add progress indicator, add

[clang-tools-extra] [run-clang-tidy.py] Refactor, add progress indicator, add type hints (PR #89490)

2024-04-27 Thread Nicolas van Kempen via cfe-commits
nicovank wrote: Reproduced the buffering issue on my setup, but flushing didn't fix the problem. I could also reproduce with the current version of this script, which does also flush after writing. Python defaults input/output streams to buffered mode when it detects a pipe, and I don't think

[clang-tools-extra] [run-clang-tidy.py] Refactor, add progress indicator, add type hints (PR #89490)

2024-04-27 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/89490 >From 85700b3488ceb65adc73469c82137c1c3429b3f4 Mon Sep 17 00:00:00 2001 From: Nicolas van Kempen Date: Sat, 20 Apr 2024 02:58:25 + Subject: [PATCH] [run-clang-tidy.py] Refactor, add progress indicator, add

[clang-tools-extra] [run-clang-tidy.py] Refactor, add progress indicator, add type hints (PR #89490)

2024-04-25 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/89490 >From e27931b8a77c49f1c4cd47ca076addbe0ed19d87 Mon Sep 17 00:00:00 2001 From: Nicolas van Kempen Date: Sat, 20 Apr 2024 02:58:25 + Subject: [PATCH] [run-clang-tidy.py] Refactor, add progress indicator, add

[clang-tools-extra] [run-clang-tidy.py] Refactor, add progress indicator, add type hints (PR #89490)

2024-04-25 Thread Nicolas van Kempen via cfe-commits
nicovank wrote: > Does it work with Python 3.6? Actually, it can with one single change. `asyncio,run` was introduced in 3.7, and can be replaced. I'll just add this change and a comment. It worked on my 3.6 setup. Let me know if you run into any issues.

[clang-tools-extra] [run-clang-tidy.py] Refactor, add progress indicator, add type hints (PR #89490)

2024-04-25 Thread Nicolas van Kempen via cfe-commits
nicovank wrote: @PiotrZSL @carlosgalvezp Any thoughts on this change? https://github.com/llvm/llvm-project/pull/89490 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][modernize-use-starts-ends-with] Add support for compare() (PR #89530)

2024-04-22 Thread Nicolas van Kempen via 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

[clang-tools-extra] [clang-tidy][modernize-use-starts-ends-with] Add support for compare() (PR #89530)

2024-04-22 Thread Nicolas van Kempen via cfe-commits
@@ -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

[clang-tools-extra] [clang-tidy][modernize-use-starts-ends-with] Add support for compare() (PR #89530)

2024-04-22 Thread Nicolas van Kempen via cfe-commits
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.

[clang-tools-extra] [clang-tidy][modernize-use-starts-ends-with] Add support for compare() (PR #89530)

2024-04-22 Thread Nicolas van Kempen via cfe-commits
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

[clang-tools-extra] [clang-tidy][modernize-use-starts-ends-with] Add support for compare() (PR #89530)

2024-04-21 Thread Nicolas van Kempen via cfe-commits
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

[clang-tools-extra] [clang-tidy][modernize-use-starts-ends-with] Add support for compare() (PR #89530)

2024-04-21 Thread Nicolas van Kempen via cfe-commits
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

[clang-tools-extra] [clang-tidy][modernize-use-starts-ends-with] Add support for compare() (PR #89530)

2024-04-20 Thread Nicolas van Kempen via cfe-commits
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

[clang-tools-extra] [clang-tidy][modernize-use-starts-ends-with] Add support for compare() (PR #89530)

2024-04-20 Thread Nicolas van Kempen via cfe-commits
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

[clang-tools-extra] [clang-tidy][modernize-use-starts-ends-with] Add support for compare() (PR #89530)

2024-04-20 Thread Nicolas van Kempen via cfe-commits
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

[clang-tools-extra] [run-clang-tidy.py] Refactor, add progress indicator, add type hints (PR #89490)

2024-04-20 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/89490 >From 8b52200a0ccfa801471e7326859276ef9b46 Mon Sep 17 00:00:00 2001 From: Nicolas van Kempen Date: Sat, 20 Apr 2024 02:58:25 + Subject: [PATCH] [run-clang-tidy.py] Refactor, add progress indicator, add

[clang-tools-extra] [run-clang-tidy.py] Refactor, add progress indicator, add type hints (PR #89490)

2024-04-19 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank created https://github.com/llvm/llvm-project/pull/89490 [There is work](https://discourse.llvm.org/t/rfc-upgrading-llvms-minimum-required-python-version/67571) to make Python 3.8 the minimum Python version for LLVM. I edited this script because I wanted some

[clang-tools-extra] [lldb] [llvm] Apply modernize-use-starts-ends-with on llvm-project (PR #89140)

2024-04-19 Thread Nicolas van Kempen via cfe-commits
nicovank wrote: Maybe @kazutakahirata (or anyone else) can stamp the minor `clang-doc` change? I don't have commit access, feel free to hit merge when everything is in order  . https://github.com/llvm/llvm-project/pull/89140 ___ cfe-commits mailing

[clang-tools-extra] [lldb] [llvm] Apply modernize-use-starts-ends-with on llvm-project (PR #89140)

2024-04-19 Thread Nicolas van Kempen via cfe-commits
nicovank wrote: Added one missed instance due to CMake configuration options. https://github.com/llvm/llvm-project/pull/89140 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [lldb] [llvm] Apply modernize-use-starts-ends-with on llvm-project (PR #89140)

2024-04-19 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/89140 >From 2c82316a0f6641b93c666143211a87f06de8feab Mon Sep 17 00:00:00 2001 From: Nicolas van Kempen Date: Wed, 17 Apr 2024 14:27:42 -0400 Subject: [PATCH] Apply modernize-use-starts-ends-with on llvm-project ---

[clang-tools-extra] [llvm] Apply modernize-use-starts-ends-with on llvm-project (PR #89140)

2024-04-17 Thread Nicolas van Kempen via cfe-commits
nicovank wrote: `std::string::starts_with` is only available from C++20, and LLVM is limited to C++17 as far as I know. However, the two objects here are `StringRef` so this is safe. https://github.com/llvm/llvm-project/pull/89140 ___ cfe-commits

[clang-tools-extra] [llvm] Apply modernize-use-starts-ends-with on llvm-project (PR #89140)

2024-04-17 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank created https://github.com/llvm/llvm-project/pull/89140 Run `modernize-use-starts-ends-with` on llvm-project. Two instances are flagged, minor readability improvements, extremely minor performance improvements. ``` python3

[clang-tools-extra] [clang-tidy] Add new modernize-use-starts-ends-with check (PR #72385)

2023-12-04 Thread Nicolas van Kempen via cfe-commits
nicovank wrote: Changed author to `@meta` in latest push, hopefully this fixes it... Didn't realise `@fb` was still default on my server. 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-use-starts-ends-with check (PR #72385)

2023-12-04 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/72385 >From 2b7748352281eb1dfa85cc8e4672488dfadee277 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-use-starts-ends-with check

[clang-tools-extra] [clang-tidy] Add new modernize-use-starts-ends-with check (PR #72385)

2023-12-04 Thread Nicolas van Kempen via cfe-commits
nicovank wrote: I've made it my primary email, if it's not an option, `@fb`, `@gmail`, or the GitHub indirection is fine. https://github.com/llvm/llvm-project/assets/7906725/6ae684b4-429b-4f09-bb97-f4525422da39;> https://github.com/llvm/llvm-project/pull/72385

[clang-tools-extra] [clang-tidy] Add new modernize-use-starts-ends-with check (PR #72385)

2023-12-04 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/72385 >From c6b5aac2b5a3d90d11a8fc0d092c2e794cff5856 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-use-starts-ends-with check

[clang-tools-extra] [clang-tidy] Add new modernize-use-starts-ends-with check (PR #72385)

2023-12-04 Thread Nicolas van Kempen via cfe-commits
nicovank wrote: Thanks! There should be no more warning. I tried to edit my GitHub settings, great if it worked, otherwise GitHub or personal email is fine. https://github.com/llvm/llvm-project/pull/72385 ___ cfe-commits mailing list

[clang-tools-extra] [clang-tidy] Add new modernize-use-starts-ends-with check (PR #72385)

2023-12-01 Thread Nicolas van Kempen via cfe-commits
nicovank wrote: > Support for `ends_with`. Planning to look into it and other `starts_with` patterns. I do not have commit access, please merge for me (`Nicolas van Kempen `). https://github.com/llvm/llvm-project/pull/72385 ___ cfe-commits mailing

[clang-tools-extra] [clang-tidy] Add new modernize-use-starts-ends-with check (PR #72385)

2023-12-01 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/72385 >From 86292b1489a6e3998afb52e0625f0c38ff7657a5 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-use-starts-ends-with check

[clang-tools-extra] [clang-tidy] Add new modernize-use-starts-ends-with check (PR #72385)

2023-12-01 Thread Nicolas van Kempen via cfe-commits
nicovank wrote: Thank you!! Modernize wins the vote, I've renamed the check. 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-use-starts-ends-with check (PR #72385)

2023-12-01 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-use-starts-ends-with check (PR #72385)

2023-12-01 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 performance-use-starts-ends-with check (PR #72385)

2023-12-01 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/72385 >From 316b45d612c63f8eea8f847d1cd39992898516f3 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-use-starts-ends-with check

[clang-tools-extra] [clang-tidy] Add new performance-use-starts-ends-with check (PR #72385)

2023-11-28 Thread Nicolas van Kempen via cfe-commits
nicovank wrote: Ping. @carlosgalvezp could you please weigh in? modernize / performance? Anyone else? I have no real preference either way. Now that modernize is fully integrated in Clang-Tidy, I don't think historical reasons should lead to modernize overbloat. If this check was only

[clang-tools-extra] [clang-tidy] Add new performance-use-starts-ends-with check (PR #72385)

2023-11-22 Thread Nicolas van Kempen via cfe-commits
nicovank wrote: @EugeneZelenko We've had this discussion, see here and the couple comments below: https://github.com/llvm/llvm-project/pull/72385#issuecomment-1812801402. I guess I can rename one more time if there is consensus. https://github.com/llvm/llvm-project/pull/72385

[clang-tools-extra] [clang-tidy] Add new performance-use-starts-ends-with check (PR #72385)

2023-11-22 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/72385 >From 0dc3f43049ca8558442ee2a6fbaf15da1510a9a3 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 performance-use-starts-ends-with

[clang-tools-extra] [clang-tidy] Add new performance-use-starts-ends-with check (PR #72385)

2023-11-22 Thread Nicolas van Kempen via cfe-commits
nicovank wrote: Updates. I've been running into issues when the begin location of the entire expression is a macro. The prefix removal, which should include the macro text, is not working as I expect it to. If you know of any checks that have similar logic I can take a look and copy. I just

[clang-tools-extra] [clang-tidy] Add new performance-use-starts-ends-with check (PR #72385)

2023-11-22 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/72385 >From e0074d270f2b78f8202c822a61a0d723e1adb2a3 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 performance-use-starts-ends-with

[clang-tools-extra] [clang-tidy] Add new performance-use-starts-ends-with check (PR #72385)

2023-11-22 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/72385 >From 22caf9b39e927e61eaef0499266dd7ab8e252ba0 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 performance-use-starts-ends-with

[clang-tools-extra] [clang-tidy] Add new performance-use-starts-ends-with check (PR #72385)

2023-11-17 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/72385 >From 7a9703f27897af0846d272ca7393bc72eff11e55 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 performance-use-starts-ends-with

[clang-tools-extra] [clang-tidy] Add new performance-use-starts-ends-with check (PR #72385)

2023-11-17 Thread Nicolas van Kempen via cfe-commits
@@ -0,0 +1,109 @@ +//===--- UseStartsEndsWithCheck.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 performance-use-starts-ends-with check (PR #72385)

2023-11-17 Thread Nicolas van Kempen via cfe-commits
@@ -12,4 +12,4 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t; typedef __SIZE_TYPE__ size_t; -#endif _STDDEF_H_ +#endif // _STDDEF_H_ nicovank wrote: This was just issuing a warning in some tests. https://github.com/llvm/llvm-project/pull/72385

[clang-tools-extra] [clang-tidy] Add new performance-use-starts-ends-with check (PR #72385)

2023-11-17 Thread Nicolas van Kempen via cfe-commits
nicovank wrote: Major changes: - Now matching on any class that has a `starts_with`, `startsWith`, or `startswith` function. This is done in order (prioritising functions in subclasses, but this could be changed). Experimenting on making this an option, not sure it's worth it without

[clang-tools-extra] [clang-tidy] Add new performance-use-starts-ends-with check (PR #72385)

2023-11-17 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/72385 >From ddac6dc91c443bf81d4b6cc3f75686ea56801094 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 performance-use-starts-ends-with

[clang-tools-extra] [clang-tidy] Add new performance-use-starts-ends-with 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 96e00378116ca5fbfad6edb220e86326dc4f9897 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 performance-use-starts-ends-with

[clang-tools-extra] [clang-tidy] Add new performance-use-starts-ends-with 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 performance-use-starts-ends-with 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 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 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 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 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 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 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 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 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 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

[clang-tools-extra] [clang-tidy][abseil-string-find-startswith] Add string_view to default string-like classes (PR #72283)

2023-11-14 Thread Nicolas van Kempen via cfe-commits
nicovank wrote: Addressed feedback. I do not have commit access, can you please merge after CI is green? Assuming GitHub will properly populate information, if not you can use `Nicolas van Kempen `. https://github.com/llvm/llvm-project/pull/72283

[clang-tools-extra] [clang-tidy][abseil-string-find-startswith] Add string_view to default string-like classes (PR #72283)

2023-11-14 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/72283 >From cf4a78c252c5aac820581b90c28c6581c6e41cfb Mon Sep 17 00:00:00 2001 From: Nicolas van Kempen Date: Tue, 14 Nov 2023 08:31:05 -0800 Subject: [PATCH] [clang-tidy][abseil-string-find-startswith] Add

[clang-tools-extra] [clang-tidy][abseil-string-find-startswith] Add string_view to default string-like classes (PR #72283)

2023-11-14 Thread Nicolas van Kempen via cfe-commits
nicovank wrote: > Copy this check. Got it. Thanks for the pointer! > Documentation, string header. I think I covered everything, had to add a couple of skeletons to that `string` common header. https://github.com/llvm/llvm-project/pull/72283 ___

[clang-tools-extra] [clang-tidy][abseil-string-find-startswith] Add string_view to default string-like classes (PR #72283)

2023-11-14 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/72283 >From 42364ebb6f3e5771947133599a1142522c511337 Mon Sep 17 00:00:00 2001 From: Nicolas van Kempen Date: Tue, 14 Nov 2023 08:31:05 -0800 Subject: [PATCH] [clang-tidy][abseil-string-find-startswith] Add

[clang-tools-extra] [clang-tidy][abseil-string-find-startswith] Add string_view to default string-like classes (PR #72283)

2023-11-14 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/72283 >From 1761f02f54f125948b10d2321807af2154dbbc3f Mon Sep 17 00:00:00 2001 From: Nicolas van Kempen Date: Tue, 14 Nov 2023 08:31:05 -0800 Subject: [PATCH] [clang-tidy][abseil-string-find-startswith] Add

[clang-tools-extra] [clang-tidy][abseil-string-find-startswith] Add string_view to default string-like classes (PR #72283)

2023-11-14 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/72283 >From a7361968b8a1acc48c4ef563c70f5c56f2633eac Mon Sep 17 00:00:00 2001 From: Nicolas van Kempen Date: Tue, 14 Nov 2023 08:31:05 -0800 Subject: [PATCH] [clang-tidy][abseil-string-find-startswith] Add

[clang-tools-extra] [clang-tidy][abseil-string-find-startswith] Add string_view to default string-like classes (PR #72283)

2023-11-14 Thread Nicolas van Kempen via cfe-commits
nicovank wrote: First time with LLVM GitHub PR workflow. Am I supposed to tag potential reviewers? @gribozavr @hokein @njames93 https://github.com/llvm/llvm-project/pull/72283 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang-tools-extra] [clang-tidy][abseil-string-find-startswith] Add string_view to default string-like classes (PR #72283)

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

[clang-tools-extra] [clang-tidy][abseil-string-find-startswith] Add string_view to default string-like classes (PR #72283)

2023-11-14 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/72283 >From dc890dc762a3400937a6a5d91963dead024c3569 Mon Sep 17 00:00:00 2001 From: Nicolas van Kempen Date: Tue, 14 Nov 2023 08:31:05 -0800 Subject: [PATCH] [clang-tidy][abseil-string-find-startswith] Add

[clang-tools-extra] [clang-tidy][abseil-string-find-startswith] Add string_view to default string-like classes (PR #72283)

2023-11-14 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank updated https://github.com/llvm/llvm-project/pull/72283 >From 3abdf06b2128fbd6ccc03f804a8d3bdde6d772c9 Mon Sep 17 00:00:00 2001 From: Nicolas van Kempen Date: Tue, 14 Nov 2023 08:31:05 -0800 Subject: [PATCH] [clang-tidy][abseil-string-find-startswith] Add

[clang-tools-extra] [clang-tidy][abseil-string-find-startswith] Add string_view to default string-like classes (PR #72283)

2023-11-14 Thread Nicolas van Kempen via cfe-commits
@@ -22,6 +22,21 @@ struct basic_string { typedef basic_string string; typedef basic_string wstring; +template +class basic_string_view { +public: + basic_string_view(); + basic_string_view(const basic_string_view &); + basic_string_view(const C *); +

[clang-tools-extra] [clang-tidy][abseil-string-find-startswith] Add string_view to default string-like classes (PR #72283)

2023-11-14 Thread Nicolas van Kempen via cfe-commits
https://github.com/nicovank created https://github.com/llvm/llvm-project/pull/72283 As per title. A small improvement to this check, `string_view` should work out of the box. I am slowly looking into adding an option to this check to recommend C++20's API `starts_with`, and move it to