[clang-tools-extra] [clang-tidy][C++20] Add support for aggregate types within modernize-use-emplace (PR #131969)

2025-03-19 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,86 @@ +// RUN: %check_clang_tidy %s -std=c++20 modernize-use-emplace %t -- \ vbvictor wrote: Consider mergin this file `use-emplace.cpp` using 2 RUN commands with specified custom suffix. This will remove unnecessary deplication of `vector` and `init

[clang-tools-extra] [clang-tidy][C++20] Add support for aggregate types within modernize-use-emplace (PR #131969)

2025-03-19 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,86 @@ +// RUN: %check_clang_tidy %s -std=c++20 modernize-use-emplace %t -- \ +// RUN: -config="{CheckOptions: \ +// RUN: {modernize-use-emplace.ContainersWithPushBack: \ +// RUN:'::std::vector; ::std::list; ::std::deque; llvm::LikeASmallVe

[clang-tools-extra] [clang-tidy] add new check: modernize-use-scoped-lock (PR #126434)

2025-03-19 Thread Baranov Victor via cfe-commits
vbvictor wrote: @PiotrZSL Ping https://github.com/llvm/llvm-project/pull/126434 ___ 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 check: modernize-use-scoped-lock (PR #126434)

2025-03-19 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/126434 ___ 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 check: modernize-use-scoped-lock (PR #126434)

2025-03-19 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/126434 ___ 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 check: modernize-use-scoped-lock (PR #126434)

2025-03-19 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,342 @@ +//===--- UseScopedLockCheck.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] [clang-tidy] add new check: modernize-use-scoped-lock (PR #126434)

2025-03-19 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/126434 ___ 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 check: modernize-use-scoped-lock (PR #126434)

2025-03-19 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/126434 >From bc1b4ada7615d407c2df009f414d62da3857ee86 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Mon, 3 Mar 2025 09:25:03 +0300 Subject: [PATCH 1/9] [clang-tidy] add scoped-lock-check --- .../clang-tidy/mod

[clang-tools-extra] [clang-tidy][NFC][doc] improve "options" sections of `misc-`, `cppcore-` and other checks (PR #133694)

2025-04-04 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/133694 >From 3f2086a843ccbc2dca5185199bbb91c366bcae06 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Mon, 31 Mar 2025 13:12:23 +0300 Subject: [PATCH 1/4] [clang-tidy] improve docs for various checks --- .../che

[clang-tools-extra] [clang-tidy] Improve `bugprone-capturing-this-in-member-variable` check: add support of `bind` functions. (PR #132635)

2025-04-05 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/132635 >From d9ccb7b48405fbe6831bf23e4357465a8ae83908 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sun, 23 Mar 2025 23:57:15 +0300 Subject: [PATCH 1/3] [clang-tidy] Add support of `bind` function calls that ca

[clang-tools-extra] [clang-tidy][C++20] Add support for Initialization Forwarding in structs and Nested Objects within modernize-use-emplace (PR #131969)

2025-04-05 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/131969 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][misc-const-correctness] fix fp when using const array type. (PR #133018)

2025-04-05 Thread Baranov Victor via cfe-commits
@@ -169,6 +172,7 @@ void ConstCorrectnessCheck::check(const MatchFinder::MatchResult &Result) { if (ArrayT->getElementType()->isPointerType()) VC = VariableCategory::Pointer; } + llvm::errs() << (int)VC << "\n"; vbvictor wrote: This also unintent

[clang-tools-extra] [clang-tidy][bugprone-unintended-char-ostream-output] add `WarnOnExplicitCast` option (PR #133639)

2025-04-05 Thread Baranov Victor via cfe-commits
@@ -39,6 +39,17 @@ Or cast to char to explicitly indicate that output should be a character. std::cout << static_cast(v); +Options +--- + +.. option:: WarnOnExplicitCast + + When `WarnOnExplicitCast` is set to `false`, the check will not warn when + output of ostream

[clang-tools-extra] [clang-tidy] add new check: modernize-use-scoped-lock (PR #126434)

2025-04-05 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/126434 >From bc1b4ada7615d407c2df009f414d62da3857ee86 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Mon, 3 Mar 2025 09:25:03 +0300 Subject: [PATCH 01/10] [clang-tidy] add scoped-lock-check --- .../clang-tidy/m

[clang-tools-extra] [clang-tidy][NFC][doc] improve "options" sections of `bugprone-` and `modernize-` checks (PR #133525)

2025-04-05 Thread Baranov Victor via cfe-commits
@@ -163,7 +163,11 @@ Options Semicolon-separated list of containers without their template parameters and some ``emplace``-like method of the container. Example: ``vector::emplace_back``. Those methods will be checked for improper use and -the check will report

[clang-tools-extra] [clang-tidy] Fix `thread_local` false positives in `misc-use-internal-linkage` check (PR #132573)

2025-04-05 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/132573 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][C++20] Add support for Initialization Forwarding in Nested Objects (PR #131969)

2025-03-26 Thread Baranov Victor via cfe-commits
@@ -1289,7 +1305,11 @@ void testBracedInitTemporaries() { v2.push_back(NonTrivialWithVector{{0}}); v2.push_back({{0}}); v2.push_back(NonTrivialWithVector{std::vector{0}}); + // CHECK-MESSAGES-CPP20: :[[@LINE-1]]:6: warning: use emplace_back instead of push_back

[clang-tools-extra] [clang-tidy][C++20] Add support for Initialization Forwarding in Nested Objects (PR #131969)

2025-03-26 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor deleted https://github.com/llvm/llvm-project/pull/131969 ___ 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 check: modernize-use-scoped-lock (PR #126434)

2025-03-27 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,342 @@ +//===--- UseScopedLockCheck.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] [clang-tidy] Fix false positives in `bugprone-crtp-constructor-accessibility` check (PR #132543)

2025-03-26 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/132543 >From 814972e0398507a5137a1ee6c69e7bba3704eb6b Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sat, 22 Mar 2025 14:39:43 +0300 Subject: [PATCH 1/2] [clang-tidy] Fix false positives in crtp-constructor-acce

[clang-tools-extra] [clang-tidy] Fix false positives in `bugprone-crtp-constructor-accessibility` check (PR #132543)

2025-03-26 Thread Baranov Victor via cfe-commits
vbvictor wrote: > maybe we should mention it in check's doc also. Added mention of this behavior in docs. https://github.com/llvm/llvm-project/pull/132543 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/

[clang-tools-extra] [clang-tidy] Improve `bugprone-capturing-this-in-member-variable` check: add support of `bind` functions. (PR #132635)

2025-03-26 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/132635 >From c91ad611e7a64b08a243a4a7f07a7f51e96b8ac0 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sun, 23 Mar 2025 23:57:15 +0300 Subject: [PATCH 1/3] [clang-tidy] Add support of `bind` function calls that ca

[clang-tools-extra] [clang-tidy] Improve `bugprone-capturing-this-in-member-variable` check: add support of `bind` functions. (PR #132635)

2025-03-26 Thread Baranov Victor via cfe-commits
@@ -87,33 +94,54 @@ void CapturingThisInMemberVariableCheck::registerMatchers(MatchFinder *Finder) { // [self = this] capturesVar(varDecl(hasInitializer(cxxThisExpr()); auto IsLambdaCapturingThis = - lambdaExpr(hasAnyCapture(CaptureThis.bind("capture")))

[clang-tools-extra] [clang-tidy][misc-const-correctness] fix fp when using const array type. (PR #133018)

2025-03-26 Thread Baranov Victor via cfe-commits
@@ -161,6 +163,7 @@ void ConstCorrectnessCheck::check(const MatchFinder::MatchResult &Result) { VariableCategory VC = VariableCategory::Value; const QualType VT = Variable->getType(); + VT->dump(); vbvictor wrote: Is this left unintentionally? https://

[clang-tools-extra] [clang-tidy] Improve `bugprone-exception-escape`: add stacktrace of escaped exception (PR #134375)

2025-04-10 Thread Baranov Victor via cfe-commits
vbvictor wrote: Some more real-world examples how it was before ![image](https://github.com/user-attachments/assets/7fe19331-2baa-4615-90e1-6c763ad8179f) and after ![image](https://github.com/user-attachments/assets/970b387c-83c2-4569-b752-c5d66d46e237) https://github.com/llvm/llvm-project/pul

[clang-tools-extra] [clang-tidy] Improve `bugprone-exception-escape`: add stacktrace of escaped exception (PR #134375)

2025-04-10 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/134375 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-04-08 Thread Baranov Victor via cfe-commits
=��___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-04-08 Thread Baranov Victor via cfe-commits
=��___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Improve `bugprone-exception-escape`: add stacktrace of escaped exception (PR #134375)

2025-04-10 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/134375 ___ 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 `cert-err33-c` to ignore functions with same prefixes as target (PR #135160)

2025-04-10 Thread Baranov Victor via cfe-commits
=?utf-8?q?Björn?= Svensson Message-ID: In-Reply-To: https://github.com/vbvictor commented: I think we should provide an entry in `ReleaseNotes.rst` since the change alters behavior of the check. https://github.com/llvm/llvm-project/pull/135160 ___

[clang-tools-extra] [clang-tidy][NFC] improve documentation for `bugprone-argument-comment` check (PR #133436)

2025-03-28 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/133436 Improve docs for `bugprone-argument-comment` check by writing explicitly default values for options. Before this change, it was unclear what values are default. >From 916062c02019d805f94f494e9ded33c0f40462e2 M

[clang-tools-extra] [clang-tidy] Add new `construct-reusable-objects-once` check (PR #131455)

2025-03-28 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/131455 >From 0b98489770f380f209d7b7a0a9223dd80c782478 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sat, 15 Mar 2025 17:36:23 +0300 Subject: [PATCH 1/2] add new construct-reusable-objects-once check --- .../cl

[clang-tools-extra] [clang-tidy][C++20] Add support for Initialization Forwarding in Nested Objects (PR #131969)

2025-03-28 Thread Baranov Victor via cfe-commits
@@ -305,6 +320,38 @@ void UseEmplaceCheck::registerMatchers(MatchFinder *Finder) { this); } +const Expr *unwrapInnerExpression(const Expr *E) { vbvictor wrote: This function should be made `static` to restrict visibility https://github.com/llvm/llvm-p

[clang-tools-extra] [clang-tidy][NFC] improve documentation for `bugprone-argument-comment` check (PR #133436)

2025-03-28 Thread Baranov Victor via cfe-commits
vbvictor wrote: @carlosgalvezp, when all checks are passed, could you merge this please, thank you. https://github.com/llvm/llvm-project/pull/133436 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinf

[clang-tools-extra] [clang-tidy][C++20] Add support for Initialization Forwarding in Nested Objects (PR #131969)

2025-03-28 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor commented: Few nits. Thought, I'm not very familiar this kind of AST-matchers and PR needs review from someone else. https://github.com/llvm/llvm-project/pull/131969 ___ cfe-commits mailing list cfe-commits@lists.llvm.org h

[clang-tools-extra] [clang-tidy] Fix `thread_local` false positives in `misc-use-internal-linkage` check (PR #132573)

2025-03-28 Thread Baranov Victor via cfe-commits
vbvictor wrote: @PiotrZSL, could you please merge this PR when you have time, thank you. https://github.com/llvm/llvm-project/pull/132573 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commit

[clang-tools-extra] [clang-tidy] add new check: modernize-use-scoped-lock (PR #126434)

2025-03-28 Thread Baranov Victor via cfe-commits
vbvictor wrote: @PiotrZSL, Ping https://github.com/llvm/llvm-project/pull/126434 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][NFC][doc] improve "options" sections of `bugprone-` and `modernize-` checks (PR #133525)

2025-03-30 Thread Baranov Victor via cfe-commits
@@ -163,7 +163,11 @@ Options Semicolon-separated list of containers without their template parameters and some ``emplace``-like method of the container. Example: ``vector::emplace_back``. Those methods will be checked for improper use and -the check will report

[clang-tools-extra] [clang-tidy][NFC][doc] improve "options" sections of `bugprone-` and `modernize-` checks (PR #133525)

2025-03-30 Thread Baranov Victor via cfe-commits
@@ -163,7 +163,11 @@ Options Semicolon-separated list of containers without their template parameters and some ``emplace``-like method of the container. Example: ``vector::emplace_back``. Those methods will be checked for improper use and -the check will report

[clang-tools-extra] [clang-tidy][C++20] Add support for Initialization Forwarding in structs and Nested Objects within modernize-use-emplace (PR #131969)

2025-03-30 Thread Baranov Victor via cfe-commits
@@ -305,6 +320,36 @@ void UseEmplaceCheck::registerMatchers(MatchFinder *Finder) { this); } +static const CXXConstructExpr *unwrapToConstructorExpr(const Expr *E) { + + while (E) { + vbvictor wrote: ```suggestion ``` https://github.com/llvm/llvm-proj

[clang-tools-extra] [clang-tidy][bugprone-unintended-char-ostream-output] add `WarnOnExplicitCast` option (PR #133639)

2025-03-30 Thread Baranov Victor via cfe-commits
@@ -39,6 +39,17 @@ Or cast to char to explicitly indicate that output should be a character. std::cout << static_cast(v); +Options vbvictor wrote: Could you please rebase on fresh main, this must be added by https://github.com/llvm/llvm-project/commit/52

[clang-tools-extra] [clang-tidy][bugprone-unintended-char-ostream-output] add `WarnOnExplicitCast` option (PR #133639)

2025-03-30 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/133639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][C++20] Add support for Initialization Forwarding in structs and Nested Objects within modernize-use-emplace (PR #131969)

2025-03-30 Thread Baranov Victor via cfe-commits
@@ -1285,11 +1289,9 @@ void testBracedInitTemporaries() { // These should not be noticed or fixed; after the correction, the code won't - // compile. + // compile in version previous to C++20. vbvictor wrote: This is not needed anymore since those cases

[clang-tools-extra] [clang-tidy][C++20] Add support for Initialization Forwarding in structs and Nested Objects within modernize-use-emplace (PR #131969)

2025-03-30 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/131969 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][NFC][doc] improve "options" sections of `bugprone-` and `modernize-` checks (PR #133525)

2025-03-30 Thread Baranov Victor via cfe-commits
vbvictor wrote: @carlosgalvezp, Can you please help land this PR? Thank you https://github.com/llvm/llvm-project/pull/133525 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][NFC][doc] improve "options" sections of `bugprone-` and `modernize-` checks (PR #133525)

2025-03-30 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/133525 >From 9b88fc69e06d08fd06b60af24b5a9c12749185ef Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sat, 29 Mar 2025 00:46:22 +0300 Subject: [PATCH 1/3] improve docs options of `bugprone-` and `modernize-` chec

[clang-tools-extra] [clang-tidy][bugprone-unintended-char-ostream-output] add `WarnOnExplicitCast` option (PR #133639)

2025-03-30 Thread Baranov Victor via cfe-commits
@@ -39,6 +39,17 @@ Or cast to char to explicitly indicate that output should be a character. std::cout << static_cast(v); +Options +--- + +.. option:: WarnOnExplicitCast + + When `WarnOnExplicitCast` is set to `false`, the check will not warn when + output of ostream

[clang-tools-extra] [clang-tidy][bugprone-unintended-char-ostream-output] add `WarnOnExplicitCast` option (PR #133639)

2025-03-30 Thread Baranov Victor via cfe-commits
@@ -39,6 +39,17 @@ Or cast to char to explicitly indicate that output should be a character. std::cout << static_cast(v); +Options +--- + +.. option:: WarnOnExplicitCast + + When `WarnOnExplicitCast` is set to `false`, the check will not warn when + output of ostream

[clang-tools-extra] [clang-tidy] Add new `construct-reusable-objects-once` check (PR #131455)

2025-03-15 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/131455 New check to find variable declarations of expensive-to-construct classes that are constructed from only constant literals and so can be reused to avoid repeated construction costs on each function invocation.

[clang-tools-extra] [clang-tidy] Add new `construct-reusable-objects-once` check (PR #131455)

2025-03-15 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/131455 >From 0b98489770f380f209d7b7a0a9223dd80c782478 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sat, 15 Mar 2025 17:36:23 +0300 Subject: [PATCH] add new construct-reusable-objects-once check --- .../clang-

[clang-tools-extra] [clang-tidy] support different precisions (PR #130540)

2025-03-15 Thread Baranov Victor via cfe-commits
@@ -136,6 +136,10 @@ Changes in existing checks ` check by updating suppress warnings logic for ``nullptr`` in ``std::find``. +- Improved :doc:`modernize-use-std-numbers + ` check to support math functions vbvictor wrote: Please make lines no more than

[clang-tools-extra] [clang-tidy][NFC] clean ReleaseNotes.rst (PR #130626)

2025-03-15 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/130626 1. Fixed ordering to be alphabetical 2. Made lines no more than 80 characters long 3. Fixed typos >From 2add09ddbc3cdeeb77257170de9f349bf3a47b94 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Mon, 10 Mar

[clang-tools-extra] [clang-tidy] add new check: modernize-use-scoped-lock (PR #126434)

2025-03-15 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/126434 >From 45d80294dd6fdab4bd85d51b0f952b515486bc8b Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Mon, 3 Mar 2025 09:25:03 +0300 Subject: [PATCH 1/4] [clang-tidy] add scoped-lock-check --- .../clang-tidy/mod

[clang-tools-extra] [clang-tidy] Add new check bugprone-capture-this-by-field (PR #130297)

2025-03-15 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,124 @@ +//===--- CapturingThisInMemberVariableCheck.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] [clang-tidy] Add new check bugprone-capture-this-by-field (PR #130297)

2025-03-14 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,36 @@ +.. title:: clang-tidy - bugprone-capturing-this-in-member-variable + +bugprone-capturing-this-in-member-variable +== + +Finds lambda captures that capture the ``this`` pointer and store it as class +members without handle t

[clang-tools-extra] [clang-tidy] Add new check bugprone-capture-this-by-field (PR #130297)

2025-03-14 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,36 @@ +.. title:: clang-tidy - bugprone-capturing-this-in-member-variable + +bugprone-capturing-this-in-member-variable +== + +Finds lambda captures that capture the ``this`` pointer and store it as class +members without handle t

[clang-tools-extra] [clang-tidy] add new check: modernize-use-scoped-lock (PR #126434)

2025-03-15 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,102 @@ +.. title:: clang-tidy - modernize-use-scoped-lock + +modernize-use-scoped-lock += + +Finds uses of ``std::lock_guard`` and suggests replacing them with C++17's +alternative ``std::scoped_lock``. The check will automatically transform only

[clang-tools-extra] [clang-tidy] add new check: modernize-use-scoped-lock (PR #126434)

2025-03-15 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/126434 >From bc1b4ada7615d407c2df009f414d62da3857ee86 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Mon, 3 Mar 2025 09:25:03 +0300 Subject: [PATCH 1/6] [clang-tidy] add scoped-lock-check --- .../clang-tidy/mod

[clang-tools-extra] [clang-tidy] Improve `readability-function-size`: count class member initializers as statements (PR #131669)

2025-03-17 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/131669 Improve `readability-function-size` by counting class member initializers as statements. Relates to https://github.com/llvm/llvm-project/issues/131126#issuecomment-2725906714. This PR in draft state until htt

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

2025-04-08 Thread Baranov Victor 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)

2025-04-08 Thread Baranov Victor 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)

2025-04-08 Thread Baranov Victor 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)

2025-04-08 Thread Baranov Victor via cfe-commits
Paul =?utf-8?q?Heidekr=C3=BCger?= , Paul =?utf-8?q?Heidekr=C3=BCger?= , Paul =?utf-8?q?Heidekr=C3=BCger?= , Paul =?utf-8?q?Heidekr=C3=BCger?= , Paul =?utf-8?q?Heidekr=C3=BCger?= , Paul =?utf-8?q?Heidekr=C3=BCger?= , Paul =?utf-8?q?Heidekr=C3=BCger?= , Paul =?utf-8?q?Heidekr=C3=BCger?= , Paul =?utf-

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

2025-04-08 Thread Baranov Victor 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)

2025-04-09 Thread Baranov Victor 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] Add support for lambda-expression in `use-trailing-return-type` check (PR #135383)

2025-04-11 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/135383 Add support for lambda-expression in `use-trailing-return-type` check. Added two new options: 1. `TransformFunctions` will trigger function declarations to use trailing return type. Values can be `true` or `fa

[clang-tools-extra] [clang-tidy] Add support for lambda-expression in `use-trailing-return-type` check (PR #135383)

2025-04-11 Thread Baranov Victor via cfe-commits
@@ -494,4 +554,75 @@ void UseTrailingReturnTypeCheck::check(const MatchFinder::MatchResult &Result) { << FixItHint::CreateInsertion(InsertionLoc, " -> " + ReturnType); } +void UseTrailingReturnTypeCheck::diagOnLambda( +const LambdaExpr *Lambda, +const ast_matche

[clang-tools-extra] [clang-tidy] Add support for lambda-expression in `use-trailing-return-type` check (PR #135383)

2025-04-11 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor converted_to_draft https://github.com/llvm/llvm-project/pull/135383 ___ 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 support for lambda-expression in `use-trailing-return-type` check (PR #135383)

2025-04-11 Thread Baranov Victor via cfe-commits
vbvictor wrote: Converted to draft to fix windows compilation https://github.com/llvm/llvm-project/pull/135383 ___ 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 support for lambda-expression in `use-trailing-return-type` check (PR #135383)

2025-04-11 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/135383 >From 4a7cdb4a9f4de5503eba1488306e238b7334912a Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Fri, 11 Apr 2025 20:26:49 +0300 Subject: [PATCH] [clang-tidy] add support for lambdas in use-trailing-return-t

[clang-tools-extra] [clang-tidy] Add support for lambda-expression in `use-trailing-return-type` check (PR #135383)

2025-04-11 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/135383 ___ 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 support for lambda-expression in `use-trailing-return-type` check (PR #135383)

2025-04-11 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor ready_for_review https://github.com/llvm/llvm-project/pull/135383 ___ 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 support for lambda-expression in `use-trailing-return-type` check (PR #135383)

2025-04-11 Thread Baranov Victor via cfe-commits
@@ -494,4 +554,75 @@ void UseTrailingReturnTypeCheck::check(const MatchFinder::MatchResult &Result) { << FixItHint::CreateInsertion(InsertionLoc, " -> " + ReturnType); } +void UseTrailingReturnTypeCheck::diagOnLambda( +const LambdaExpr *Lambda, +const ast_matche

[clang-tools-extra] [clang-tidy][NFC][doc] improve "options" sections of `misc-`, `cppcore-` and other checks (PR #133694)

2025-03-31 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/133694 >From 3f2086a843ccbc2dca5185199bbb91c366bcae06 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Mon, 31 Mar 2025 13:12:23 +0300 Subject: [PATCH 1/2] [clang-tidy] improve docs for various checks --- .../che

[clang-tools-extra] [clang-tidy][NFC][doc] improve "options" sections of `bugprone-` and `modernize-` checks (PR #133525)

2025-03-29 Thread Baranov Victor via cfe-commits
@@ -53,4 +53,4 @@ Options If set to non-zero, the check does not suggest edits that will transform vbvictor wrote: yes, thanks for the notice https://github.com/llvm/llvm-project/pull/133525 ___ cfe-commits maili

[clang-tools-extra] [clang-tidy][NFC][doc] improve "options" sections of `bugprone-` and `modernize-` checks (PR #133525)

2025-03-29 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/133525 >From 9b88fc69e06d08fd06b60af24b5a9c12749185ef Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sat, 29 Mar 2025 00:46:22 +0300 Subject: [PATCH 1/2] improve docs options of `bugprone-` and `modernize-` chec

[clang-tools-extra] [clang-tidy][C++20] Add support for Initialization Forwarding in Nested Objects (PR #131969)

2025-03-28 Thread Baranov Victor via cfe-commits
@@ -305,6 +320,38 @@ void UseEmplaceCheck::registerMatchers(MatchFinder *Finder) { this); } +const Expr *unwrapInnerExpression(const Expr *E) { + + while (true) { vbvictor wrote: you could write `while(E)` and get rid of if ```cpp if (!E) break;

[clang-tools-extra] [clang-tidy][NFC][doc] improve "options" sections of `misc-`, `cppcore-` and other checks (PR #133694)

2025-03-31 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/133694 >From 3f2086a843ccbc2dca5185199bbb91c366bcae06 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Mon, 31 Mar 2025 13:12:23 +0300 Subject: [PATCH 1/3] [clang-tidy] improve docs for various checks --- .../che

[clang-tools-extra] [clang-tidy][NFC][doc] improve "options" sections of `misc-`, `cppcore-` and other checks (PR #133694)

2025-03-31 Thread Baranov Victor via cfe-commits
@@ -45,8 +45,8 @@ Options A semicolon-separated list of qualified types which should not be allowed to persist across suspension points. -Eg: ``my::lockable; a::b;::my::other::lockable;`` -The default value of this option is `"std::lock_guard;std::scoped_lock"

[clang-tools-extra] [clang-tidy][NFC][doc] improve "options" sections of `misc-`, `cppcore-` and other checks (PR #133694)

2025-03-31 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/133694 Improved "options" sections of various checks: 1. Added Options keyword to be a delimiter between "body" and "options" parts of docs 2. Added default values where were absent. 3. Changed double-tick to single-

[clang-tools-extra] [clang-tidy][bugprone-unintended-char-ostream-output] add `WarnOnExplicitCast` option (PR #133639)

2025-03-30 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/133639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][bugprone-unintended-char-ostream-output] add `WarnOnExplicitCast` option (PR #133639)

2025-03-30 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,40 @@ +// RUN: %check_clang_tidy %s bugprone-unintended-char-ostream-output %t -check-suffix=WARN-EXPLICIT-CAST +// RUN: %check_clang_tidy %s bugprone-unintended-char-ostream-output %t \ +// RUN: -config='{CheckOptions: { \ +// RUN: bugprone-unintended-char-ost

[clang-tools-extra] [clang-tidy][NFC][doc] improve "options" sections of `misc-`, `cppcore-` and other checks (PR #133694)

2025-03-31 Thread Baranov Victor via cfe-commits
@@ -45,8 +45,8 @@ Options A semicolon-separated list of qualified types which should not be allowed to persist across suspension points. -Eg: ``my::lockable; a::b;::my::other::lockable;`` -The default value of this option is `"std::lock_guard;std::scoped_lock"

[clang-tools-extra] [clang-tidy] Improve `bugprone-capturing-this-in-member-variable` check: add support of `bind` functions. (PR #132635)

2025-04-04 Thread Baranov Victor via cfe-commits
vbvictor wrote: @HerrCai0907, Could you please merge this? Thank you https://github.com/llvm/llvm-project/pull/132635 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Improve `bugprone-exception-escape`: add stacktrace of escaped exception (PR #134375)

2025-04-04 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/134375 >From 9865b1a58d03cb4ac721748da9ff710e8a21 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Fri, 4 Apr 2025 15:50:09 +0300 Subject: [PATCH] [clang-tidy] add stacktrace to exception-escape --- .../bugpr

[clang-tools-extra] [clang-tidy] Improve `bugprone-exception-escape`: add stacktrace of escaped exception (PR #134375)

2025-04-04 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/134375 This PR add stacktrace of escaped exception to `bugprone-exception-escape` check. Changes: 1. Modified `ExceptionAnalyzer` and `ExceptionInfo` classes to hold stacktrace of escaped exception in `llvm::SetVecto

[clang-tools-extra] [clang-tidy][NFC][doc] improve "options" sections of `misc-`, `cppcore-` and other checks (PR #133694)

2025-04-04 Thread Baranov Victor via cfe-commits
vbvictor wrote: Could anyone merge this please? Thank you Hopefully default values of all check will be fixed with this commit:) https://github.com/llvm/llvm-project/pull/133694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm

[clang-tools-extra] [clang-tidy][C++20] Add support for Initialization Forwarding in structs and Nested Objects within modernize-use-emplace (PR #131969)

2025-04-04 Thread Baranov Victor via cfe-commits
@@ -1289,7 +1305,11 @@ void testBracedInitTemporaries() { v2.push_back(NonTrivialWithVector{{0}}); v2.push_back({{0}}); v2.push_back(NonTrivialWithVector{std::vector{0}}); + // CHECK-MESSAGES-CPP20: :[[@LINE-1]]:6: warning: use emplace_back instead of push_back

[clang-tools-extra] [clang-tidy] 'modernize-use-starts-ends-with': fixed false positives on `find` and `rfind` (PR #129564)

2025-03-22 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/129564 >From e72ae0e2ee12265ec69b0c5ff726261eb7466caa Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sat, 22 Mar 2025 13:29:20 +0300 Subject: [PATCH] [clang-tidy] fixed false positives on find and rfind --- ...

[clang-tools-extra] [clang-tidy] Fix `thread_local` false positives in `misc-use-internal-linkage` check (PR #132573)

2025-03-22 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/132573 Based on C++ standard (see issue https://github.com/llvm/llvm-project/issues/131679) and [StackOverflow](https://stackoverflow.com/questions/22794382/are-c11-thread-local-variables-automatically-static) `thre

[clang-tools-extra] [clang-tidy] add new check: modernize-use-scoped-lock (PR #126434)

2025-03-22 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,342 @@ +//===--- UseScopedLockCheck.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] [clang-tidy] Fixed bugprone-non-zero-enum-to-bool-conversion (PR #131407)

2025-03-19 Thread Baranov Victor via cfe-commits
@@ -19,16 +19,22 @@ namespace clang::tidy::bugprone { namespace { -AST_MATCHER(EnumDecl, isCompleteAndHasNoZeroValue) { +AST_MATCHER(EnumDecl, isCompleteNonEmptyAndHasNoZeroValue) { const EnumDecl *Definition = Node.getDefinition(); return Definition && Node.isComplete(

[clang-tools-extra] [clang-tidy][NFC][doc] improve "options" sections of `bugprone-` and `modernize-` checks (PR #133525)

2025-03-28 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/133525 Improved "options" sections of `bugprone-` and `modernize-` checks: 1. Added `Options` keyword to be a delimiter between "body" and "options" parts of docs 2. Added default values where was absent. 3. Improved

[clang-tools-extra] [clang-tidy] add new check: modernize-use-scoped-lock (PR #126434)

2025-03-28 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/126434 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][C++20] Add support for Initialization Forwarding in Nested Objects (PR #131969)

2025-03-28 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor deleted https://github.com/llvm/llvm-project/pull/131969 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][C++20] Add support for Initialization Forwarding in Nested Objects (PR #131969)

2025-03-28 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/131969 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][C++20] Add support for Initialization Forwarding in Nested Objects (PR #131969)

2025-03-28 Thread Baranov Victor via cfe-commits
@@ -305,6 +320,38 @@ void UseEmplaceCheck::registerMatchers(MatchFinder *Finder) { this); } +const Expr *unwrapInnerExpression(const Expr *E) { + + while (true) { vbvictor wrote: you could write `while(E)` and get rid of if ```cpp if (!E) break; ```

[clang-tools-extra] [clang-tidy][C++20] Add support for Initialization Forwarding in Nested Objects (PR #131969)

2025-03-28 Thread Baranov Victor via cfe-commits
@@ -332,19 +380,44 @@ void UseEmplaceCheck::check(const MatchFinder::MatchResult &Result) { }(); assert(Call && "No call matched"); - assert((CtorCall || MakeCall) && "No push_back parameter matched"); + assert((CtorCall || MakeCall || AggInitCall) && + "No push

[clang-tools-extra] [clang-tidy][C++20] Add support for Initialization Forwarding in Nested Objects (PR #131969)

2025-03-28 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/131969 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][C++20] Add support for Initialization Forwarding in Nested Objects (PR #131969)

2025-03-28 Thread Baranov Victor via cfe-commits
@@ -1289,7 +1305,11 @@ void testBracedInitTemporaries() { v2.push_back(NonTrivialWithVector{{0}}); v2.push_back({{0}}); v2.push_back(NonTrivialWithVector{std::vector{0}}); + // CHECK-MESSAGES-CPP20: :[[@LINE-1]]:6: warning: use emplace_back instead of push_back

<    1   2   3   4   5   >