[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] [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-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-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] 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] [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] [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] 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-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] 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-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] 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] 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] 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] 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] 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 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: @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] 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] 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-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-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-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 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
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-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] 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] 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
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] 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] [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] [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] [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
@@ -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
@@ -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,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,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
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,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,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] 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] 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] [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
@@ -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 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] 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] 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] 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] 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-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-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] 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] 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-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] 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] [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] [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 {}; + +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 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-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] a4bdeb9 - [clang-tidy][NFC] replace some redundant std::string creations

2022-01-19 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2022-01-19T18:36:35Z New Revision: a4bdeb9a563475fd989d97138971895f606f45d3 URL: https://github.com/llvm/llvm-project/commit/a4bdeb9a563475fd989d97138971895f606f45d3 DIFF: https://github.com/llvm/llvm-project/commit/a4bdeb9a563475fd989d97138971895f606f45d3.diff LOG:

[clang-tools-extra] 39f779a - [clang-tidy][NFC] Remove redundant string creation for comparison

2022-01-20 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2022-01-20T22:20:10Z New Revision: 39f779afb35420c51e2c7094b2643a53baed9f59 URL: https://github.com/llvm/llvm-project/commit/39f779afb35420c51e2c7094b2643a53baed9f59 DIFF: https://github.com/llvm/llvm-project/commit/39f779afb35420c51e2c7094b2643a53baed9f59.diff LOG:

[clang-tools-extra] c57b8ca - [clang-tidy] Provide fine control of color in run-clang-tidy

2022-02-20 Thread Nathan James via cfe-commits
Author: Kesavan Yogeswaran Date: 2022-02-20T22:00:28Z New Revision: c57b8ca721dd2e88ed96b7df65a518fdab738445 URL: https://github.com/llvm/llvm-project/commit/c57b8ca721dd2e88ed96b7df65a518fdab738445 DIFF: https://github.com/llvm/llvm-project/commit/c57b8ca721dd2e88ed96b7df65a518fdab738445.diff

[clang] c34d898 - [ASTMatchers] Expand isInline matcher to VarDecl

2022-02-23 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2022-02-23T08:34:00Z New Revision: c34d89818341b3c7c96bc8f59e3f98063d4ae9fd URL: https://github.com/llvm/llvm-project/commit/c34d89818341b3c7c96bc8f59e3f98063d4ae9fd DIFF: https://github.com/llvm/llvm-project/commit/c34d89818341b3c7c96bc8f59e3f98063d4ae9fd.diff LOG:

[clang-tools-extra] 79353f9 - [clang-tidy][NFC] Remove Tristate from CachedGlobList

2022-02-23 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2022-02-23T08:35:31Z New Revision: 79353f940cf441e69f32af0a78a48baee89e8517 URL: https://github.com/llvm/llvm-project/commit/79353f940cf441e69f32af0a78a48baee89e8517 DIFF: https://github.com/llvm/llvm-project/commit/79353f940cf441e69f32af0a78a48baee89e8517.diff LOG:

[clang-tools-extra] 858a958 - [clang-query] Add check to prevent setting srcloc when no introspection is available.

2021-04-28 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-04-28T11:21:35+01:00 New Revision: 858a9583e1fed24aa57e5f2769f4117883264ceb URL: https://github.com/llvm/llvm-project/commit/858a9583e1fed24aa57e5f2769f4117883264ceb DIFF: https://github.com/llvm/llvm-project/commit/858a9583e1fed24aa57e5f2769f4117883264ceb.diff

[clang-tools-extra] c3846bc - [clangd][NFC] Reserve storage when creating semantic token encoding.

2021-04-28 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-04-28T22:39:54+01:00 New Revision: c3846bcfe1cc6d6421a543757b5046ea841d4610 URL: https://github.com/llvm/llvm-project/commit/c3846bcfe1cc6d6421a543757b5046ea841d4610 DIFF: https://github.com/llvm/llvm-project/commit/c3846bcfe1cc6d6421a543757b5046ea841d4610.diff

[clang-tools-extra] 6815037 - [clangd][NFC] Remove unnecessary string captures in lambdas.

2021-04-30 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-04-30T13:27:24+01:00 New Revision: 6815037085945be8bb758c23b1a5daabe0a8667d URL: https://github.com/llvm/llvm-project/commit/6815037085945be8bb758c23b1a5daabe0a8667d DIFF: https://github.com/llvm/llvm-project/commit/6815037085945be8bb758c23b1a5daabe0a8667d.diff

[clang-tools-extra] 172a801 - [clang-tidy][NFC] Remove redudnant expr and qualType matchers from bugprone-sizeof-expression.

2021-05-01 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-05-01T08:54:00+01:00 New Revision: 172a8016788c08fff6eed71f0a8eccf0ce1ef26d URL: https://github.com/llvm/llvm-project/commit/172a8016788c08fff6eed71f0a8eccf0ce1ef26d DIFF: https://github.com/llvm/llvm-project/commit/172a8016788c08fff6eed71f0a8eccf0ce1ef26d.diff

[clang-tools-extra] 53df522 - [clang-tidy][NFC] Short circuit getting enum options suggestions.

2021-05-03 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-05-03T11:20:27+01:00 New Revision: 53df522a0c536d32a60c0ed571097a78ce2541a7 URL: https://github.com/llvm/llvm-project/commit/53df522a0c536d32a60c0ed571097a78ce2541a7 DIFF: https://github.com/llvm/llvm-project/commit/53df522a0c536d32a60c0ed571097a78ce2541a7.diff

[clang-tools-extra] e1c729c - [clang-tidy][NFC] Update tests and Default options to use boolean value

2021-05-04 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-05-04T18:17:56+01:00 New Revision: e1c729c56829d3b9502b9ac2439003f87231db50 URL: https://github.com/llvm/llvm-project/commit/e1c729c56829d3b9502b9ac2439003f87231db50 DIFF: https://github.com/llvm/llvm-project/commit/e1c729c56829d3b9502b9ac2439003f87231db50.diff

[clang] 61dc0f2 - [Format] Don't sort includes if DisableFormat is true

2021-05-04 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-05-04T19:04:12+01:00 New Revision: 61dc0f2b593da149a4c0cea67819cd7bdbdd50b8 URL: https://github.com/llvm/llvm-project/commit/61dc0f2b593da149a4c0cea67819cd7bdbdd50b8 DIFF: https://github.com/llvm/llvm-project/commit/61dc0f2b593da149a4c0cea67819cd7bdbdd50b8.diff

[clang-tools-extra] 8b88ff0 - [clangd] Add option to use dirty file contents when building preambles.

2022-01-17 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2022-01-17T10:55:35Z New Revision: 8b88ff08038c5525bdb5d22b050550ca3b34ad77 URL: https://github.com/llvm/llvm-project/commit/8b88ff08038c5525bdb5d22b050550ca3b34ad77 DIFF: https://github.com/llvm/llvm-project/commit/8b88ff08038c5525bdb5d22b050550ca3b34ad77.diff LOG:

[clang-tools-extra] 9a5af54 - [clang-tidy] Remove readability-deleted-default

2021-03-16 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-03-16T14:03:33Z New Revision: 9a5af541ee058b85a92113ecf9d38a06ef2b313d URL: https://github.com/llvm/llvm-project/commit/9a5af541ee058b85a92113ecf9d38a06ef2b313d DIFF: https://github.com/llvm/llvm-project/commit/9a5af541ee058b85a92113ecf9d38a06ef2b313d.diff LOG:

[clang] 48ab967 - [ASTMatchers][NFC] Use move semantics when passing matchers around.

2021-03-17 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-03-17T22:03:08Z New Revision: 48ab9674b21be2c6206ccc04602d4a3e4c812953 URL: https://github.com/llvm/llvm-project/commit/48ab9674b21be2c6206ccc04602d4a3e4c812953 DIFF: https://github.com/llvm/llvm-project/commit/48ab9674b21be2c6206ccc04602d4a3e4c812953.diff LOG:

[clang-tools-extra] 4dd92d6 - [clang-tidy] Fix bugprone-terminating-continue when continue appears inside a switch

2021-03-20 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-03-20T10:59:37Z New Revision: 4dd92d61dbc4b3c51a98e1d0bfccabed24759ba9 URL: https://github.com/llvm/llvm-project/commit/4dd92d61dbc4b3c51a98e1d0bfccabed24759ba9 DIFF: https://github.com/llvm/llvm-project/commit/4dd92d61dbc4b3c51a98e1d0bfccabed24759ba9.diff LOG:

[clang] 8298899 - [ASTMatchers][NFC] Use SmallVector when building variadic matcher descriptor

2021-03-23 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-03-23T16:38:45Z New Revision: 8298899e56cdf89c68215853010352c45398ab10 URL: https://github.com/llvm/llvm-project/commit/8298899e56cdf89c68215853010352c45398ab10 DIFF: https://github.com/llvm/llvm-project/commit/8298899e56cdf89c68215853010352c45398ab10.diff LOG:

[clang] 279ea93 - [clang] Add fixit for Wreorder-ctor

2021-03-24 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-03-24T19:22:53Z New Revision: 279ea930fa21b283688b2598816095a48d0ca4d7 URL: https://github.com/llvm/llvm-project/commit/279ea930fa21b283688b2598816095a48d0ca4d7 DIFF: https://github.com/llvm/llvm-project/commit/279ea930fa21b283688b2598816095a48d0ca4d7.diff LOG:

[clang-tools-extra] 02d7ef3 - [clang-tidy] Fix mpi checks when running multiple TUs per clang-tidy process

2021-03-25 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-03-25T14:38:37Z New Revision: 02d7ef3181dd6a043a8ad16d747353dd02cbb5ef URL: https://github.com/llvm/llvm-project/commit/02d7ef3181dd6a043a8ad16d747353dd02cbb5ef DIFF: https://github.com/llvm/llvm-project/commit/02d7ef3181dd6a043a8ad16d747353dd02cbb5ef.diff LOG:

[clang] bcbea2a - [NFC] Remove redundant string copy

2021-04-12 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-04-12T15:13:59+01:00 New Revision: bcbea2ab84df87983fa9b30e94ea25eda0eb2338 URL: https://github.com/llvm/llvm-project/commit/bcbea2ab84df87983fa9b30e94ea25eda0eb2338 DIFF: https://github.com/llvm/llvm-project/commit/bcbea2ab84df87983fa9b30e94ea25eda0eb2338.diff

[clang-tools-extra] 27dfcd9 - [clang-tidy] Add include to misc-uniqueptr-reset-release

2021-04-12 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-04-12T23:32:15+01:00 New Revision: 27dfcd978edc94b4b46218b12a3dfbcdc47ae4c8 URL: https://github.com/llvm/llvm-project/commit/27dfcd978edc94b4b46218b12a3dfbcdc47ae4c8 DIFF: https://github.com/llvm/llvm-project/commit/27dfcd978edc94b4b46218b12a3dfbcdc47ae4c8.diff

[clang] b23abbe - [AST] Use IntrusiveRefCntPtr for Introspection LocationCall.

2021-04-14 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-04-15T00:12:22+01:00 New Revision: b23abbeab1d76376b4b46142d04e6c105c1074f0 URL: https://github.com/llvm/llvm-project/commit/b23abbeab1d76376b4b46142d04e6c105c1074f0 DIFF: https://github.com/llvm/llvm-project/commit/b23abbeab1d76376b4b46142d04e6c105c1074f0.diff

[clang] bfb6c28 - [AST][NFC] Remove temporary ASTTU file from Introspection generation.

2021-04-14 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-04-15T00:14:55+01:00 New Revision: bfb6c2874be830cc6f7595652d23192598edecf0 URL: https://github.com/llvm/llvm-project/commit/bfb6c2874be830cc6f7595652d23192598edecf0 DIFF: https://github.com/llvm/llvm-project/commit/bfb6c2874be830cc6f7595652d23192598edecf0.diff

[clang] 6890f30 - [AST][Introspection] Fix args not being set.

2021-04-14 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-04-15T00:19:40+01:00 New Revision: 6890f302f587ca4f6712be728bd9302da597fe0c URL: https://github.com/llvm/llvm-project/commit/6890f302f587ca4f6712be728bd9302da597fe0c DIFF: https://github.com/llvm/llvm-project/commit/6890f302f587ca4f6712be728bd9302da597fe0c.diff

[clang] 542e780 - [AST] Add a print method to Introspection LocationCall

2021-04-15 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-04-15T22:18:29+01:00 New Revision: 542e7806e61089da88a2ff467006073cbe8d URL: https://github.com/llvm/llvm-project/commit/542e7806e61089da88a2ff467006073cbe8d DIFF: https://github.com/llvm/llvm-project/commit/542e7806e61089da88a2ff467006073cbe8d.diff

[clang] f019e5f - [AST][Introspection] Add a check to detect if introspection is supported.

2021-04-15 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-04-15T22:21:41+01:00 New Revision: f019e5f73ed732b374e376f5ddbba5d1f67dca0c URL: https://github.com/llvm/llvm-project/commit/f019e5f73ed732b374e376f5ddbba5d1f67dca0c DIFF: https://github.com/llvm/llvm-project/commit/f019e5f73ed732b374e376f5ddbba5d1f67dca0c.diff

[clang] a0898f0 - [AST][Introspection][NFC] Remove unnecessary temporary strings.

2021-04-18 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-04-18T09:25:19+01:00 New Revision: a0898f0cecc78be913e885cfba727bd4d9c49aaf URL: https://github.com/llvm/llvm-project/commit/a0898f0cecc78be913e885cfba727bd4d9c49aaf DIFF: https://github.com/llvm/llvm-project/commit/a0898f0cecc78be913e885cfba727bd4d9c49aaf.diff

[clang] db75db8 - [Introspection] Dont emit json if unchanged.

2021-04-18 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-04-18T20:22:09+01:00 New Revision: db75db85f231bf194912c3b0dd918f2bc497d603 URL: https://github.com/llvm/llvm-project/commit/db75db85f231bf194912c3b0dd918f2bc497d603 DIFF: https://github.com/llvm/llvm-project/commit/db75db85f231bf194912c3b0dd918f2bc497d603.diff

[clang-tools-extra] 6b4e8f8 - [clangd] Use dirty filesystem when performing cross file tweaks

2021-04-20 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-04-20T17:13:44+01:00 New Revision: 6b4e8f82a3f85c6612997e5f9fce8da6f8cb4526 URL: https://github.com/llvm/llvm-project/commit/6b4e8f82a3f85c6612997e5f9fce8da6f8cb4526 DIFF: https://github.com/llvm/llvm-project/commit/6b4e8f82a3f85c6612997e5f9fce8da6f8cb4526.diff

[clang-tools-extra] c3b9d85 - [clang-tidy][NFC] Remove unnecessary headers

2020-12-28 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2020-12-28T15:01:51Z New Revision: c3b9d85bd4b7249af9efe3594c6c152a032f83f8 URL: https://github.com/llvm/llvm-project/commit/c3b9d85bd4b7249af9efe3594c6c152a032f83f8 DIFF: https://github.com/llvm/llvm-project/commit/c3b9d85bd4b7249af9efe3594c6c152a032f83f8.diff LOG:

[clang-tools-extra] 7af6a13 - [NFC] Switch up some dyn_cast calls

2021-01-02 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-01-02T19:56:27Z New Revision: 7af6a134508cd1c7f75c6e3441ce436f220f30a4 URL: https://github.com/llvm/llvm-project/commit/7af6a134508cd1c7f75c6e3441ce436f220f30a4 DIFF: https://github.com/llvm/llvm-project/commit/7af6a134508cd1c7f75c6e3441ce436f220f30a4.diff LOG:

[clang-tools-extra] 59810c5 - [clang-tidy] Fix windows tests

2021-01-03 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-01-04T00:39:34Z New Revision: 59810c51e761f241f23f45a120d5c3518983d2d8 URL: https://github.com/llvm/llvm-project/commit/59810c51e761f241f23f45a120d5c3518983d2d8 DIFF: https://github.com/llvm/llvm-project/commit/59810c51e761f241f23f45a120d5c3518983d2d8.diff LOG:

[clang-tools-extra] 0bfe100 - [NFC] Test case refactor

2021-01-06 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-01-06T20:00:15Z New Revision: 0bfe100145634988e4a914da776b55509ba0bec0 URL: https://github.com/llvm/llvm-project/commit/0bfe100145634988e4a914da776b55509ba0bec0 DIFF: https://github.com/llvm/llvm-project/commit/0bfe100145634988e4a914da776b55509ba0bec0.diff LOG:

[clang-tools-extra] 3505d8d - [clangd][NFC] Use PathRef for getCorrespondingHeaderOrSource

2021-01-06 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-01-07T02:41:19Z New Revision: 3505d8dc07427b3d9165538d8f1cee574ea66804 URL: https://github.com/llvm/llvm-project/commit/3505d8dc07427b3d9165538d8f1cee574ea66804 DIFF: https://github.com/llvm/llvm-project/commit/3505d8dc07427b3d9165538d8f1cee574ea66804.diff LOG:

[clang-tools-extra] 467cbd2 - [clangd][NFC] Remove unnecessary copy in CodeComplete

2021-01-08 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-01-09T02:32:23Z New Revision: 467cbd2981840745a84dda07855c4e41501f6903 URL: https://github.com/llvm/llvm-project/commit/467cbd2981840745a84dda07855c4e41501f6903 DIFF: https://github.com/llvm/llvm-project/commit/467cbd2981840745a84dda07855c4e41501f6903.diff LOG:

[clang-tools-extra] 31732e6 - [clangd] Remove ScratchFS from tests

2021-01-11 Thread Nathan James via cfe-commits
Author: Nathan James Date: 2021-01-11T16:14:26Z New Revision: 31732e6f52c8e5e722d3e4cca053db793dae3b8c URL: https://github.com/llvm/llvm-project/commit/31732e6f52c8e5e722d3e4cca053db793dae3b8c DIFF: https://github.com/llvm/llvm-project/commit/31732e6f52c8e5e722d3e4cca053db793dae3b8c.diff LOG:

<    1   2   3   4   5   >