[clang-tools-extra] Rename CODE_OWNERS -> Maintainers (PR #114544)

2024-11-01 Thread Nathan James via cfe-commits
njames93 wrote: I just no longer have the time needed to hold maintainer status. I'll still contribute as and when I have the time. https://github.com/llvm/llvm-project/pull/114544 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.

[clang-tools-extra] [clang-tidy] Update TODO comment check (PR #104868)

2024-08-20 Thread Nathan James via cfe-commits
https://github.com/njames93 requested changes to this pull request. https://github.com/llvm/llvm-project/pull/104868 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang-tidy] bugprone-implicit-widening ignores unsigned consts (PR #101073)

2024-08-09 Thread Nathan James via cfe-commits
njames93 wrote: > Thats a good question. @njames93 What do you thing, current tests are > sufficient ? There should definitely be a test in the clang side of things to ensure correct handling of the `Expr::getIntegerConstantExpr` method with this new parameter https://github.com/llvm/llvm-pro

[clang] [clang-tools-extra] [clang-tidy] bugprone-implicit-widening ignores unsigned consts (PR #101073)

2024-08-09 Thread Nathan James via cfe-commits
@@ -569,7 +573,8 @@ class Expr : public ValueStmt { /// Note: This does not perform the implicit conversions required by C++11 /// [expr.const]p5. bool isCXX11ConstantExpr(const ASTContext &Ctx, APValue *Result = nullptr, - SourceLocation *Loc =

[clang-tools-extra] [clang-tidy] Create bugprone-public-enable-shared-from-this check (PR #102299)

2024-08-08 Thread Nathan James via cfe-commits
njames93 wrote: Actually an ASTVisitor approach could be better here, this way you could create a set of all the `CXXRecordDecls` that publicly inherit from or transitively inherit from `::std::enable_shared_from_this` during traversal https://github.com/llvm/llvm-project/pull/102299 _

[clang-tools-extra] [clang-tidy] Create bugprone-public-enable-shared-from-this check (PR #102299)

2024-08-08 Thread Nathan James via cfe-commits
njames93 wrote: > > How are classes that derive other classes that implement > > `enable_shared_from_this` > > > > ```c++ > > class A : public std::enable_shared_from_this {}; > > class B : private A{}; > > ``` > > Looking at the AST dump that clang-check gives, it seems that B doesn't have >

[clang-tools-extra] [clang-tidy] Create bugprone-public-enable-shared-from-this check (PR #102299)

2024-08-07 Thread Nathan James via cfe-commits
https://github.com/njames93 commented: How are classes that derive other classes that implement `enable_shared_from_this` ```cpp class A : public std::enable_shared_from_this {}; class B : private A{}; ``` https://github.com/llvm/llvm-project/pull/102299 _

[clang-tools-extra] [clang-tidy] Create bugprone-public-enable-shared-from-this check (PR #102299)

2024-08-07 Thread Nathan James via cfe-commits
@@ -0,0 +1,45 @@ +// RUN: %check_clang_tidy %s bugprone-public-enable-shared-from-this %t -- -- + +namespace std { + +template class enable_shared_from_this {}; + +class BadExample : enable_shared_from_this {}; +// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: class BadExa

[clang-tools-extra] [clang-tidy] Create bugprone-public-enable-shared-from-this check (PR #102299)

2024-08-07 Thread Nathan James via cfe-commits
@@ -0,0 +1,45 @@ +// RUN: %check_clang_tidy %s bugprone-public-enable-shared-from-this %t -- -- + +namespace std { + +template class enable_shared_from_this {}; + +class BadExample : enable_shared_from_this {}; +// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: class BadExa

[clang-tools-extra] [clang-tidy] Create bugprone-public-enable-shared-from-this check (PR #102299)

2024-08-07 Thread Nathan James via cfe-commits
https://github.com/njames93 edited https://github.com/llvm/llvm-project/pull/102299 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Create bugprone-public-enable-shared-from-this check (PR #102299)

2024-08-07 Thread Nathan James via cfe-commits
@@ -0,0 +1,45 @@ +// RUN: %check_clang_tidy %s bugprone-public-enable-shared-from-this %t -- -- + +namespace std { + +template class enable_shared_from_this {}; njames93 wrote: Clang-format is disabled for test files https://github.com/llvm/llvm-project/pul

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() [Cont.] (PR #95220)

2024-08-02 Thread Nathan James via cfe-commits
Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heide

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() [Cont.] (PR #95220)

2024-08-02 Thread Nathan James via cfe-commits
Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heide

[clang-tools-extra] Create a new check to look for mis-use in calls that take iterators (PR #99917)

2024-08-02 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/99917 >From d0cf6a5250f78d03eaf793035c58e3afc37e0788 Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 23 Jul 2024 10:59:45 +0100 Subject: [PATCH] Create a new check to look for mis-use in calls that take iterat

[clang-tools-extra] Create a new check to look for mis-use in calls that take iterators (PR #99917)

2024-08-01 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/99917 >From e4d6c8e0fc65771b3fe67b0e3463f5df6115a2e3 Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 23 Jul 2024 10:59:45 +0100 Subject: [PATCH] Create a new check to look for mis-use in calls that take iterat

[clang-tools-extra] Create a new check to look for mis-use in calls that take iterators (PR #99917)

2024-08-01 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/99917 >From e604ce226ddccd0ae11cf685adfed98be9b8223e Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 23 Jul 2024 10:59:45 +0100 Subject: [PATCH] Create a new check to look for mis-use in calls that take iterat

[clang-tools-extra] [clang-tidy] Add modernize-use-cpp-style-comments check (PR #99713)

2024-07-29 Thread Nathan James via cfe-commits
njames93 wrote: > I am moving this under readability, i will also post some code on how am i > planning to output a fix. For now i don't have a good way to handle > > ``` > int a = /*some value */ 5; > ``` There is no way to handle that and you shouldn't try. Best you could do is just emit a

[clang-tools-extra] Create a new check to look for mis-use in calls that take iterators (PR #99917)

2024-07-29 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/99917 >From 4762dc02504b63ad8ee5922e0f051aff6c4b1f15 Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 23 Jul 2024 10:59:45 +0100 Subject: [PATCH] Create a new check to look for mis-use in calls that take iterat

[clang] Fix hasName matcher assertion with inline namespaces (PR #100975)

2024-07-29 Thread Nathan James via cfe-commits
https://github.com/njames93 closed https://github.com/llvm/llvm-project/pull/100975 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Create a new check to look for mis-use in calls that take iterators (PR #99917)

2024-07-29 Thread Nathan James via cfe-commits
njames93 wrote: > The `++` and `--` operators could be mis-used as well, similar to `+` and > `-`. And there are some control statements with a single statement that has a > compound statement around it, please remove those. The `++` and `--` operators work on lvalues only(`std::end(Range)++`

[clang] Fix hasName matcher assertion with inline namespaces (PR #100975)

2024-07-29 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/100975 >From b208791fbdc9fe665f2b8ecd44c9b15a5d729f6f Mon Sep 17 00:00:00 2001 From: Nathan James Date: Mon, 29 Jul 2024 07:21:53 +0100 Subject: [PATCH] Fix hasName matcher assertion with inline namespaces Fix handli

[clang] Fix hasName matcher assertion with inline namespaces (PR #100975)

2024-07-29 Thread Nathan James via cfe-commits
njames93 wrote: > I can't get the assertion to reproduce, but I can see the behavioral change > with the first matcher: https://godbolt.org/z/TcsYPoGEh > > So this should probably come with a release note for the fix? The assertions are only shown on debug build, but it comes from [here](http

[clang] Fix hasName matcher assertion with inline namespaces (PR #100975)

2024-07-28 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/100975 >From 9e3f5ae48fa75d5db8b132162d96004191618956 Mon Sep 17 00:00:00 2001 From: Nathan James Date: Mon, 29 Jul 2024 07:21:53 +0100 Subject: [PATCH] Fix hasName matcher assertion with inline namespaces Fix handli

[clang] Fix hasName matcher assertion with inline namespaces (PR #100975)

2024-07-28 Thread Nathan James via cfe-commits
https://github.com/njames93 created https://github.com/llvm/llvm-project/pull/100975 Fix handling of nodes which can be skipped in the fast path for the hasName matcher #100973 >From 8d1aeca42a0d544582823ff2bae0a217e14d1c02 Mon Sep 17 00:00:00 2001 From: Nathan James Date: Mon, 29 Jul 2024

[clang-tools-extra] Create a new check to look for mis-use in calls that take iterators (PR #99917)

2024-07-27 Thread Nathan James via cfe-commits
njames93 wrote: @5chmidti I decided to run this version of the check on llvm and clang https://gist.github.com/njames93/6f8863573972cb07c388ac19e8a20467 Seems like most of the warnings detected are when we are deliberately exceeding the bounds of a range when we know its a slice of a bigger ran

[clang-tools-extra] Create a new check to look for mis-use in calls that take iterators (PR #99917)

2024-07-27 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/99917 >From c79951fdc4f866413f83a94b1eaa16f3ffb10aa4 Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 23 Jul 2024 10:59:45 +0100 Subject: [PATCH] Create a new check to look for mis-use in calls that take iterat

[clang-tools-extra] Create a new check to look for mis-use in calls that take iterators (PR #99917)

2024-07-27 Thread Nathan James via cfe-commits
njames93 wrote: Added some detection for trying to advance past the end or before the start of a range. https://github.com/llvm/llvm-project/pull/99917 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/list

[clang-tools-extra] Create a new check to look for mis-use in calls that take iterators (PR #99917)

2024-07-27 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/99917 >From e1c3086cf28f7c075d631c128c984bc25109cd81 Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 23 Jul 2024 10:59:45 +0100 Subject: [PATCH] Create a new check to look for mis-use in calls that take iterat

[clang-tools-extra] Extend support for specifying languages and version in add_new_check.py (PR #100129)

2024-07-27 Thread Nathan James via cfe-commits
https://github.com/njames93 closed https://github.com/llvm/llvm-project/pull/100129 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Extend support for specifying languages and version in add_new_check.py (PR #100129)

2024-07-27 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/100129 >From b76a506ad12f3923dbca13063b66bb83a336f0c2 Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 23 Jul 2024 15:24:52 +0100 Subject: [PATCH] Extend support for specifying languages and version in add_new_

[clang-tools-extra] Create a new check to look for mis-use in calls that take iterators (PR #99917)

2024-07-27 Thread Nathan James via cfe-commits
@@ -0,0 +1,756 @@ +//===--- IncorrectIteratorsCheck.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: Ap

[clang-tools-extra] Create a new check to look for mis-use in calls that take iterators (PR #99917)

2024-07-27 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/99917 >From bbf32f3ca89e8950d82fe920b232fee4b82cb43e Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 23 Jul 2024 10:59:45 +0100 Subject: [PATCH] Create a new check to look for mis-use in calls that take iterat

[clang-tools-extra] Extend support for specifying languages and version in add_new_check.py (PR #100129)

2024-07-26 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/100129 >From ed5cdfdd4696f4af2f6cd3dd09d4104744b74cc5 Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 23 Jul 2024 15:24:52 +0100 Subject: [PATCH] Extend support for specifying languages and version in add_new_

[clang] [ASTMatchers] Extend hasName matcher when matching templates (PR #100349)

2024-07-26 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/100349 >From a81c1b2ee0bd0d0622abf1d5ec06846a2e2e3a27 Mon Sep 17 00:00:00 2001 From: Nathan James Date: Wed, 24 Jul 2024 12:43:39 +0100 Subject: [PATCH] [ASMMatchers] Extend hasName matcher when matching templates Al

[clang-tools-extra] Add a description parameter to the add_new_check script (PR #100111)

2024-07-26 Thread Nathan James via cfe-commits
https://github.com/njames93 closed https://github.com/llvm/llvm-project/pull/100111 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ASTMatchers] Extend hasName matcher when matching templates (PR #100349)

2024-07-25 Thread Nathan James via cfe-commits
njames93 wrote: @AaronBallman That's a good point, I didn't account for how defaulted template arguments aren't printed. Would using `<*>` or a more rustic approach of `<_>` be a good alternative? https://github.com/llvm/llvm-project/pull/100349 ___ c

[clang-tools-extra] [clang-tidy] Fix crash in C language in readability-non-const-parameter (PR #100461)

2024-07-24 Thread Nathan James via cfe-commits
https://github.com/njames93 approved this pull request. https://github.com/llvm/llvm-project/pull/100461 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Fix crash in modernize-use-ranges (PR #100427)

2024-07-24 Thread Nathan James via cfe-commits
njames93 wrote: No release notes added as this will likely want to get backported https://github.com/llvm/llvm-project/pull/100427 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Fix crash in modernize-use-ranges (PR #100427)

2024-07-24 Thread Nathan James via cfe-commits
https://github.com/njames93 created https://github.com/llvm/llvm-project/pull/100427 Crash seems to be caused by the check function not handling inline namespaces correctly for some instances. Changed how the Replacer is got from the MatchResult now which should alleviate any potential issues

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() [Cont.] (PR #95220)

2024-07-24 Thread Nathan James via cfe-commits
Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heide

[clang] [ASMMatchers] Extend hasName matcher when matching templates (PR #100349)

2024-07-24 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/100349 >From d623ba571fb8091f53637ae5810b68a69cb772b2 Mon Sep 17 00:00:00 2001 From: Nathan James Date: Wed, 24 Jul 2024 12:43:39 +0100 Subject: [PATCH] [ASMMatchers] Extend hasName matcher when matching templates Al

[clang] [ASMMatchers] Extend hasName matcher when matching templates (PR #100349)

2024-07-24 Thread Nathan James via cfe-commits
https://github.com/njames93 created https://github.com/llvm/llvm-project/pull/100349 Allow users to match all record instantiations by using <> as a wildcard. With ```cpp template struct Foo { void Bar(); }; ``` The following code: ```cpp Foo{}.Bar(); ``` Will match against: ``` callExpr(ca

[clang-tools-extra] clang-tidy: readability-redundant-smartptr-get does not remove (#97964) (PR #100177)

2024-07-23 Thread Nathan James via cfe-commits
@@ -20,6 +20,47 @@ struct shared_ptr { explicit operator bool() const noexcept; }; +template +struct vector { + vector(); + bool operator==(const vector& other) const; + bool operator!=(const vector& other) const; + unsigned long size() const; + bool empty() const; + +

[clang-tools-extra] clang-tidy: readability-redundant-smartptr-get does not remove (#97964) (PR #100177)

2024-07-23 Thread Nathan James via cfe-commits
https://github.com/njames93 edited https://github.com/llvm/llvm-project/pull/100177 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] clang-tidy: readability-redundant-smartptr-get does not remove (#97964) (PR #100177)

2024-07-23 Thread Nathan James via cfe-commits
https://github.com/njames93 requested changes to this pull request. https://github.com/llvm/llvm-project/pull/100177 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Extend support for specifying languages and version in add_new_check.py (PR #100129)

2024-07-23 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/100129 >From 2624c965ffe61e50abeebc4e7c391395878ef66a Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 23 Jul 2024 15:24:52 +0100 Subject: [PATCH] Extend support for specifying languages and version in add_new_

[clang-tools-extra] Extend support for specifying languages and version in add_new_check.py (PR #100129)

2024-07-23 Thread Nathan James via cfe-commits
@@ -53,7 +55,18 @@ def adapt_cmake(module_path, check_name_camel): # Adds a header for the new check. -def write_header(module_path, module, namespace, check_name, check_name_camel): +def write_header( +module_path, module, namespace, check_name, check_name_camel, lang_re

[clang-tools-extra] Add a description parameter to the add_new_check script (PR #100111)

2024-07-23 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/100111 >From f9f3cd6b29f72edfb8aad10cd0b77f7b5341a6a5 Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 23 Jul 2024 13:05:56 +0100 Subject: [PATCH] Add a description parameter to the add_new_check script Adds a

[clang-tools-extra] Extend support for specifying languages and version in add_new_check.py (PR #100129)

2024-07-23 Thread Nathan James via cfe-commits
https://github.com/njames93 created https://github.com/llvm/llvm-project/pull/100129 - Allow specifying a language standard when adding a new check - Simplify the language standards(and or-later) handlnig in check_clang_tidy >From 738bf3ae0530895a14e6f0a4a0b6c2e9ca328fa3 Mon Sep 17 00:00:00 200

[clang-tools-extra] Add a description parameter to the add_new_check script (PR #100111)

2024-07-23 Thread Nathan James via cfe-commits
https://github.com/njames93 created https://github.com/llvm/llvm-project/pull/100111 Adds a description parameter that automatically fills in the Release notes and first line of the checks documentation. If omitted the usually FIXME markers are left in their place. >From 2e7e63806ad643e43ef62

[clang-tools-extra] Create a new check to look for mis-use in calls that take iterators (PR #99917)

2024-07-23 Thread Nathan James via cfe-commits
https://github.com/njames93 edited https://github.com/llvm/llvm-project/pull/99917 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Create a new check to look for mis-use in calls that take iterators (PR #99917)

2024-07-23 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/99917 >From 1b91c22714179e44cc494b6a7adcde2f4b6bc6d6 Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 23 Jul 2024 10:59:45 +0100 Subject: [PATCH] Create a new check to look for mis-use in calls that take iterat

[clang-tools-extra] Create a new check to look for mis-use in calls that take iterators (PR #99917)

2024-07-23 Thread Nathan James via cfe-commits
https://github.com/njames93 edited https://github.com/llvm/llvm-project/pull/99917 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Draft: Create a new check to look for mis-use in calls that take iterators (PR #99917)

2024-07-23 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/99917 >From 7be8e9d71b61ae669fc80e1dd0eef5e963b1d20c Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 23 Jul 2024 10:59:45 +0100 Subject: [PATCH] Create a new check to look for mis-use in calls that take iterat

[clang-tools-extra] Draft: Create a new check to look for mis-use in calls that take iterators (PR #99917)

2024-07-23 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/99917 >From e71d153d953f1e30f7480973bcae2a16bf51711f Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 23 Jul 2024 10:59:45 +0100 Subject: [PATCH] Create a new check to look for mis-use in calls that take iterat

[clang-tools-extra] Draft: Create a new check to look for mis-use in calls that take iterators (PR #99917)

2024-07-22 Thread Nathan James via cfe-commits
https://github.com/njames93 created https://github.com/llvm/llvm-project/pull/99917 Looks for various patterns of functions that take arguments calling begin/end or similar for common mistakes. Still needs a bit of work, but open to suggestions of how this check could be improved >From a8eb

[clang-tools-extra] [clang-tidy] Add modernize-use-cpp-style-comments check (PR #99713)

2024-07-19 Thread Nathan James via cfe-commits
@@ -0,0 +1,12 @@ +.. title:: clang-tidy - modernize-use-cpp-style-comments + +modernize-use-cpp-style-comments + + +Finds C-style comments and suggests to use C++ style comments `//`. + + +.. code-block:: c++ + + memcpy(a, b, sizeof(int) * 5); /* u

[clang-tools-extra] [clang-tidy] Add modernize-use-cpp-style-comments check (PR #99713)

2024-07-19 Thread Nathan James via cfe-commits
@@ -0,0 +1,38 @@ +//===--- UseCppStyleCommentsCheck.h - 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: Apa

[clang-tools-extra] [clang-tidy] Add modernize-use-cpp-style-comments check (PR #99713)

2024-07-19 Thread Nathan James via cfe-commits
@@ -0,0 +1,38 @@ +//===--- UseCppStyleCommentsCheck.h - 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: Apa

[clang-tools-extra] [clang-tidy] Add modernize-use-cpp-style-comments check (PR #99713)

2024-07-19 Thread Nathan James via cfe-commits
@@ -0,0 +1,38 @@ +//===--- UseCppStyleCommentsCheck.h - 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: Apa

[clang-tools-extra] [clang-tidy] Add modernize-use-cpp-style-comments check (PR #99713)

2024-07-19 Thread Nathan James via cfe-commits
https://github.com/njames93 edited https://github.com/llvm/llvm-project/pull/99713 ___ 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 modernize-use-cpp-style-comments check (PR #99713)

2024-07-19 Thread Nathan James via cfe-commits
@@ -0,0 +1,12 @@ +.. title:: clang-tidy - modernize-use-cpp-style-comments + +modernize-use-cpp-style-comments + + +Finds C-style comments and suggests to use C++ style comments `//`. + + +.. code-block:: c++ + + memcpy(a, b, sizeof(int) * 5); /* u

[clang-tools-extra] [clang-tidy] Add modernize-use-cpp-style-comments check (PR #99713)

2024-07-19 Thread Nathan James via cfe-commits
@@ -0,0 +1,67 @@ +//===--- UseCppStyleCommentsCheck.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: A

[clang-tools-extra] [clang-tidy] Add modernize-use-cpp-style-comments check (PR #99713)

2024-07-19 Thread Nathan James via cfe-commits
@@ -0,0 +1,38 @@ +//===--- UseCppStyleCommentsCheck.h - 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: Apa

[clang-tools-extra] [clang-tidy] Add modernize-use-cpp-style-comments check (PR #99713)

2024-07-19 Thread Nathan James via cfe-commits
@@ -172,6 +172,11 @@ New checks Detects variables and functions that can be marked as static or moved into an anonymous namespace to enforce internal linkage. +- New :doc:`modernize-use-cpp-style-comments + ` check. + + Find C Style comments and suggests to use C++ style

[clang-tools-extra] [clang-tidy] Add modernize-use-cpp-style-comments check (PR #99713)

2024-07-19 Thread Nathan James via cfe-commits
https://github.com/njames93 requested changes to this pull request. https://github.com/llvm/llvm-project/pull/99713 ___ 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 modernize-use-cpp-style-comments check (PR #99713)

2024-07-19 Thread Nathan James via cfe-commits
@@ -0,0 +1,16 @@ +// RUN: %check_clang_tidy -std=c++11 %s modernize-use-cpp-style-comments %t + +static auto PI = 3.14159265; /* value of pi upto 8 decimal places */ +// CHECK-MESSAGES: :[[@LINE-1]]:30: warning: use C++ style comments '//' instead of C style comments '/*...*/' [m

[clang-tools-extra] [libc] clang-tidy: readability-redundant-smartptr-get does not remove -> (#97964) (PR #98757)

2024-07-18 Thread Nathan James via cfe-commits
@@ -235,3 +276,13 @@ void Negative() { if (MACRO(x) == nullptr) ; } + +void test_redundant_get() { + std::vector> v; + auto f = [](int) {}; + for (auto i = v.begin(); i != v.end(); ++i) { +f(*i->get()); njames93 wrote: I think he is saying have a

[clang-tools-extra] Ensure functions are anchored in the global namespace (PR #99084)

2024-07-18 Thread Nathan James via cfe-commits
njames93 wrote: Just a drive by comment, would it not have been nicer to use the `hasAnyName` matcher which understands `::` at the start means global namespace. https://github.com/llvm/llvm-project/pull/99084 ___ cfe-commits mailing list cfe-commits@

[clang-tools-extra] Add support for std::rotate(_copy) and inplace_merge to modernize-use-ranges (PR #99057)

2024-07-16 Thread Nathan James via cfe-commits
njames93 wrote: > LGTM, some tests for rotate_copy and implace_merge would be welcome but it > isn't must as it work similar to rotate. Yeah, like with the other supported algorithms, I didn't see the need to add a test for every single function, as long as there's a test for each kind of fun

[clang-tools-extra] Add support for std::rotate(_copy) and inplace_merge to modernize-use-ranges (PR #99057)

2024-07-16 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/99057 >From 5b5b5ff47fd077eb9b6e306f9fab1e356432ddbe Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 16 Jul 2024 17:28:01 +0100 Subject: [PATCH] Add support for std::rotate(_copy) and inplace_merge to moderniz

[clang-tools-extra] Add support for std::rotate(_copy) and inplace_merge to modernize-use-ranges (PR #99057)

2024-07-16 Thread Nathan James via cfe-commits
https://github.com/njames93 created https://github.com/llvm/llvm-project/pull/99057 These algorithms take 3 iterators for the range and we are only interested in the first and last iterator argument. The ranges versions of these take a range and an iterator(defined to be inside the range) so t

[clang-tools-extra] Allow specifying pipe syntax for use-ranges checks (PR #98696)

2024-07-13 Thread Nathan James via cfe-commits
https://github.com/njames93 edited https://github.com/llvm/llvm-project/pull/98696 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Allow specifying pipe syntax for use-ranges checks (PR #98696)

2024-07-13 Thread Nathan James via cfe-commits
@@ -166,6 +166,15 @@ utils::UseRangesCheck::ReplacerMap UseRangesCheck::getReplacerMap() const { return Result; } +UseRangesCheck::UseRangesCheck(StringRef Name, ClangTidyContext *Context) +: utils::UseRangesCheck(Name, Context), + UseReversePipe(Options.get("UseRe

[clang-tools-extra] Allow specifying pipe syntax for use-ranges checks (PR #98696)

2024-07-12 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/98696 >From c3431c0bedb23feac279efa43b51740353dcab8d Mon Sep 17 00:00:00 2001 From: Nathan James Date: Fri, 12 Jul 2024 23:04:42 +0100 Subject: [PATCH] Allow specifying pipe syntax for use-ranges checks Add `UseRever

[clang-tools-extra] Allow specifying pipe syntax for use-ranges checks (PR #98696)

2024-07-12 Thread Nathan James via cfe-commits
https://github.com/njames93 created https://github.com/llvm/llvm-project/pull/98696 Add `UseReversePipe` option to (boost|modernize)-use-ranges checks. This controls whether to create a reverse view using function syntax (`reverse(Range)`) or pipe syntax (`Range | reverse`) >From f709a09351a6

[clang-tools-extra] Fix the docs for the boost/modernize use-ranges checks (PR #98662)

2024-07-12 Thread Nathan James via cfe-commits
njames93 wrote: > Those functions could be listed as an bullet points. > But anyway lest, merge this and check if this fixes issues. Should be good, I actually built the docs this time rather than using a basic rst viewer to test it https://github.com/llvm/llvm-project/pull/98662 _

[clang-tools-extra] Fix the docs for the boost/modernize use-ranges checks (PR #98662)

2024-07-12 Thread Nathan James via cfe-commits
https://github.com/njames93 created https://github.com/llvm/llvm-project/pull/98662 The formatting looked a little off in the Release notes webpage. This should address those issues >From 58b0b788be914e6317be02a52322b2d2c2b3ffa6 Mon Sep 17 00:00:00 2001 From: Nathan James Date: Fri, 12 Jul 20

[clang-tools-extra] [clang-tidy] Ignore requires expr in bugprone-assignment-in-if-condition (PR #98079)

2024-07-11 Thread Nathan James via cfe-commits
https://github.com/njames93 approved this pull request. https://github.com/llvm/llvm-project/pull/98079 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] ignore uninitialized std::array in member init (PR #98134)

2024-07-09 Thread Nathan James via cfe-commits
@@ -422,6 +422,28 @@ static const char *getInitializer(QualType QT, bool UseAssignment) { } } +static bool isStdArray(QualType QT) { + const auto *RT = QT->getAs(); + if (!RT) +return false; + const auto *RD = RT->getDecl(); + if (!RD) +return false; + + const

[clang-tools-extra] [clang-tidy] ignore uninitialized std::array in member init (PR #98134)

2024-07-09 Thread Nathan James via cfe-commits
https://github.com/njames93 requested changes to this pull request. Please: - Update the Release Notes to include this fix. - Update the lit tests to demonstrate this new behaviour - Update the checks documentation to reflect this change https://github.com/llvm/llvm-project/pull/98134

[clang-tools-extra] [clang-tidy] ignore uninitialized std::array in member init (PR #98134)

2024-07-09 Thread Nathan James via cfe-commits
https://github.com/njames93 edited https://github.com/llvm/llvm-project/pull/98134 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Add checks to convert std library iterator algorithms into c++20 or boost ranges (PR #97764)

2024-07-08 Thread Nathan James via cfe-commits
njames93 wrote: I no longer have commit access, would you do the honours instead https://github.com/llvm/llvm-project/pull/97764 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Add checks to convert std library iterator algorithms into c++20 or boost ranges (PR #97764)

2024-07-07 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/97764 >From 4bb4d8258c7d68864b4c01c8f982fa1339e5006b Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 2 Jul 2024 14:25:44 +0100 Subject: [PATCH 1/2] Add a modernize-use-ranges check --- .../clang-tidy/moderniz

[clang-tools-extra] Add checks to convert std library iterator algorithms into c++20 or boost ranges (PR #97764)

2024-07-07 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/97764 >From 7bb1c44fb23a1ec0c90c5ce694cbd7d2245a00a6 Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 2 Jul 2024 14:25:44 +0100 Subject: [PATCH 1/2] Add a modernize-use-ranges check --- .../clang-tidy/moderniz

[clang-tools-extra] Add checks to convert std library iterator algorithms into c++20 or boost ranges (PR #97764)

2024-07-07 Thread Nathan James via cfe-commits
njames93 wrote: - Added some more functions for boost/range/numeric - Added support for Reverse range iteration https://github.com/llvm/llvm-project/pull/97764 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mail

[clang-tools-extra] Add checks to convert std library iterator algorithms into c++20 or boost ranges (PR #97764)

2024-07-07 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/97764 >From ecde6109c040741f6425d3c42464ffaa02f237f9 Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 2 Jul 2024 14:25:44 +0100 Subject: [PATCH 1/2] Add a modernize-use-ranges check --- .../clang-tidy/moderniz

[clang-tools-extra] Add checks to convert std library iterator algorithms into c++20 or boost ranges (PR #97764)

2024-07-07 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/97764 >From 56d452478fb2b002898e6b3dfc5e251b42894ca3 Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 2 Jul 2024 14:25:44 +0100 Subject: [PATCH 1/2] Add a modernize-use-ranges check --- .../clang-tidy/moderniz

[clang-tools-extra] Add checks to convert std library iterator algorithms into c++20 or boost ranges (PR #97764)

2024-07-07 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/97764 >From 065d343d5ab1706475fe5a1bc3a43e5368d1142b Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 2 Jul 2024 14:25:44 +0100 Subject: [PATCH 1/2] Add a modernize-use-ranges check --- .../clang-tidy/moderniz

[clang-tools-extra] Add checks to convert std library iterator algorithms into c++20 or boost ranges (PR #97764)

2024-07-05 Thread Nathan James via cfe-commits
@@ -0,0 +1,248 @@ +//===--- UseRangesCheck.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: Ap

[clang-tools-extra] Add checks to convert std library iterator algorithms into c++20 or boost ranges (PR #97764)

2024-07-05 Thread Nathan James via cfe-commits
@@ -0,0 +1,248 @@ +//===--- UseRangesCheck.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: Ap

[clang-tools-extra] Add checks to convert std library iterator algorithms into c++20 or boost ranges (PR #97764)

2024-07-05 Thread Nathan James via cfe-commits
@@ -0,0 +1,68 @@ +//===--- UseRangesCheck.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: Apa

[clang-tools-extra] Add checks to convert std library iterator algorithms into c++20 or boost ranges (PR #97764)

2024-07-05 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/97764 >From 86b21ee28d1b6efb5d5b4da97cb09a484337a92f Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 2 Jul 2024 14:25:44 +0100 Subject: [PATCH 1/2] Add a modernize-use-ranges check --- .../clang-tidy/moderniz

[clang-tools-extra] Add checks to convert std library iterator algorithms into c++20 or boost ranges (PR #97764)

2024-07-05 Thread Nathan James via cfe-commits
@@ -0,0 +1,36 @@ +//===--- UseRangesCheck.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: Apa

[clang-tools-extra] Add checks to convert std library iterator algorithms into c++20 or boost ranges (PR #97764)

2024-07-05 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/97764 >From 98746ac4cb477b44280de471113138e706147242 Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 2 Jul 2024 14:25:44 +0100 Subject: [PATCH 1/2] Add a modernize-use-ranges check --- .../clang-tidy/moderniz

[clang-tools-extra] Add checks to convert std library iterator algorithms into c++20 or boost ranges (PR #97764)

2024-07-05 Thread Nathan James via cfe-commits
@@ -0,0 +1,24 @@ +.. title:: clang-tidy - modernize-use-ranges + +modernize-use-ranges + + +Detects calls to standard library iterator algorithms that could be replaced +with a ranges version instead + njames93 wrote: I'm not sure how necessar

[clang-tools-extra] Add checks to convert std library iterator algorithms into c++20 or boost ranges (PR #97764)

2024-07-05 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/97764 >From ad55d54bf76a2b0a1544acb143446869135e224f Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 2 Jul 2024 14:25:44 +0100 Subject: [PATCH 1/2] Add a modernize-use-ranges check --- .../clang-tidy/moderniz

[clang-tools-extra] Add checks to convert std library iterator algorithms into c++20 or boost ranges (PR #97764)

2024-07-05 Thread Nathan James via cfe-commits
@@ -0,0 +1,253 @@ +//===--- UseRangesCheck.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: Ap

[clang-tools-extra] Add checks to convert std library iterator algorithms into c++20 or boost ranges (PR #97764)

2024-07-05 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/97764 >From dd529ead075012e4c74ff54fb534e1f34efe0c7f Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 2 Jul 2024 14:25:44 +0100 Subject: [PATCH 1/2] Add a modernize-use-ranges check --- .../clang-tidy/moderniz

[clang-tools-extra] Add checks to convert std library iterator algorithms into c++20 or boost ranges (PR #97764)

2024-07-05 Thread Nathan James via cfe-commits
https://github.com/njames93 updated https://github.com/llvm/llvm-project/pull/97764 >From ef9042357628f4c2e83d6be322f2d177a6170ebd Mon Sep 17 00:00:00 2001 From: Nathan James Date: Tue, 2 Jul 2024 14:25:44 +0100 Subject: [PATCH 1/2] Add a modernize-use-ranges check --- .../clang-tidy/moderniz

  1   2   3   4   5   >