[clang-tools-extra] [clang-tidy] Improve `bugprone-infinite-loop` check by adding handing for structured bindings (PR #144213)

2025-07-22 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor closed https://github.com/llvm/llvm-project/pull/144213 ___ 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 false positives in `bugprone-signed-char-misuse` (PR #149790)

2025-07-22 Thread Baranov Victor via cfe-commits
=?utf-8?q?Björn?= Svensson , =?utf-8?q?Björn?= Svensson Message-ID: In-Reply-To: @@ -75,16 +86,21 @@ void SignedCharMisuseCheck::registerMatchers(MatchFinder *Finder) { const auto UnSignedCharCastExpr = charCastExpression(false, IntegerType, "unsignedCastExpression")

[clang-tools-extra] [clang-tidy] Fix false positives in `bugprone-signed-char-misuse` (PR #149790)

2025-07-22 Thread Baranov Victor via cfe-commits
=?utf-8?q?Bj=C3=B6rn?= Svensson , =?utf-8?q?Bj=C3=B6rn?= Svensson Message-ID: In-Reply-To: @@ -0,0 +1,91 @@ +// RUN: %check_clang_tidy %s bugprone-signed-char-misuse %t -- -- -std=c23 vbvictor wrote: Oh, thank you, didn't know that. Let it be as is. https://g

[clang-tools-extra] [clang-tidy] Proofread Contributing.rst (PR #149831)

2025-07-21 Thread Baranov Victor via cfe-commits
vbvictor wrote: I'm not sure on the `false positive` -> `false-positive` change. We typically use `false positive`, you could grep docs or look at [release notes](https://github.com/llvm/llvm-project/blob/release/21.x/clang-tools-extra/docs/ReleaseNotes.rst). https://github.com/llvm/llvm-projec

[clang-tools-extra] [clang-tidy] Make `bugprone-unhandled-self-assignment` check more general (PR #147066)

2025-07-21 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/147066 ___ 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 parallel execution by default in 'run-clang-tidy' and 'clang-tidy-diff' (PR #149739)

2025-07-21 Thread Baranov Victor via cfe-commits
vbvictor wrote: > LGTM! > > Not sure if possible but a less aggressive option would be to have a "-l" > flag like "make" has, which uses as many threads as requested while keeping > track on the load of the system and adjusting accordingly. Can the load factor be platform independent? AFAIK w

[clang] [clang][Diagnostic] Clarify error message for auto (PR #149781)

2025-07-21 Thread Baranov Victor via cfe-commits
vbvictor wrote: Hi, thank you for your contribution! Please add comprehensive test-cases for your change to make sure everything work as expected and continue to do so in the future. Please add an entry in `clang/docs/ReleaseNotes.rst` to let everyone know about your fix. Please add "Fixes http

[clang-tools-extra] [clang-tidy] Fix false positives in `bugprone-signed-char-misuse` (PR #149790)

2025-07-21 Thread Baranov Victor via cfe-commits
=?utf-8?q?Bj=C3=B6rn?= Svensson Message-ID: In-Reply-To: @@ -0,0 +1,91 @@ +// RUN: %check_clang_tidy %s bugprone-signed-char-misuse %t -- -- -std=c23 vbvictor wrote: ```suggestion // RUN: %check_clang_tidy -std=c23-or-later %s bugprone-signed-char-misuse %t ``

[clang-tools-extra] [clang-tidy] Fix false positives in `bugprone-signed-char-misuse` (PR #149790)

2025-07-21 Thread Baranov Victor via cfe-commits
=?utf-8?q?Björn?= Svensson Message-ID: In-Reply-To: @@ -75,16 +86,21 @@ void SignedCharMisuseCheck::registerMatchers(MatchFinder *Finder) { const auto UnSignedCharCastExpr = charCastExpression(false, IntegerType, "unsignedCastExpression"); - // Catch assignments w

[clang-tools-extra] [clang-tidy] Fix false positives in `bugprone-signed-char-misuse` (PR #149790)

2025-07-21 Thread Baranov Victor via cfe-commits
=?utf-8?q?Björn?= Svensson Message-ID: In-Reply-To: @@ -75,16 +86,21 @@ void SignedCharMisuseCheck::registerMatchers(MatchFinder *Finder) { const auto UnSignedCharCastExpr = charCastExpression(false, IntegerType, "unsignedCastExpression"); - // Catch assignments w

[clang-tools-extra] [clang-tidy] Make `bugprone-unhandled-self-assignment` check more general (PR #147066)

2025-07-21 Thread Baranov Victor via cfe-commits
@@ -69,6 +69,28 @@ void UnhandledSelfAssignmentCheck::registerMatchers(MatchFinder *Finder) { cxxMethodDecl(unless(hasDescendant(cxxMemberCallExpr(callee(cxxMethodDecl( hasName("operator="), ofClass(equalsBoundNode("class"; + // Checking that some ki

[clang-tools-extra] [clang-tidy] Make `bugprone-unhandled-self-assignment` check more general (PR #147066)

2025-07-21 Thread Baranov Victor via cfe-commits
@@ -69,6 +69,28 @@ void UnhandledSelfAssignmentCheck::registerMatchers(MatchFinder *Finder) { cxxMethodDecl(unless(hasDescendant(cxxMemberCallExpr(callee(cxxMethodDecl( hasName("operator="), ofClass(equalsBoundNode("class"; + // Checking that some ki

[clang-tools-extra] [clang-tidy] Make `bugprone-unhandled-self-assignment` check more general (PR #147066)

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

[clang-tools-extra] [clang-tidy] Make `bugprone-unhandled-self-assignment` check more general (PR #147066)

2025-07-21 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/147066 ___ 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 parallel execution by default in 'run-clang-tidy' and 'clang-tidy-diff' (PR #149739)

2025-07-20 Thread Baranov Victor via cfe-commits
vbvictor wrote: Note about [comment](https://github.com/llvm/llvm-project/issues/148624#issuecomment-3069680087) by Eugene: `run-clang-tidy` already tried to run on max cpu cores by default, so problem with LFS was here for 11 years since birth of the file in https://reviews.llvm.org/D5188.

[clang-tools-extra] [clang-tidy] Add parallel execution by default in 'run-clang-tidy' and 'clang-tidy-diff' (PR #149739)

2025-07-20 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/149739 Change the default value of `-j` from `1` to `0` in `clang-tidy-diff.py` script to autodetect number of CPU cores to run on. Script `run-clang-tidy.py` already had this behavior by default. Both scripts now al

[clang-tools-extra] [clang-tidy] modernize-use-std-print, format: Fix checks with Abseil functions (PR #142312)

2025-07-20 Thread Baranov Victor via cfe-commits
vbvictor wrote: > @vbvictor Thanks for the review. I've rebased (fixing conflicts on the > release notes) and squashed the changes. I don't have commit access. Please > can you land the change for me if you're still happy with it? Sure, I'll merge in a couple of days in case anyone will want t

[clang-tools-extra] [clang-tidy] Add MLIR check for old op builder usage. (PR #149148)

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

[clang] [clang][docs] Add all clang-tools-extra to 'ClangTools.rst' (PR #148622)

2025-07-19 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor closed https://github.com/llvm/llvm-project/pull/148622 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Teach `readability-uppercase-literal-suffix` about C++23 and C23 suffixes (PR #148275)

2025-07-19 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,162 @@ +// TODO: When Clang adds support for decimal floating point types, enable these tests by: +//1. Removing all the #if 0 + #endif guards. +//2. Removing all occurrences of the string "DISABLED-" in this file. +//3. Deleting this message. + +// RUN: %c

[clang-tools-extra] [clang-tidy] Teach `readability-uppercase-literal-suffix` about C++23 and C23 suffixes (PR #148275)

2025-07-19 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,248 @@ +// TODO: When Clang adds support for C++23 floating-point types, enable these tests by: +//1. Removing all the #if 0 + #endif guards. +//2. Removing all occurrences of the string "DISABLED-" in this file. +//3. Deleting this message. +// These suffi

[clang-tools-extra] [clang-tidy] Teach `readability-uppercase-literal-suffix` about C++23 and C23 suffixes (PR #148275)

2025-07-19 Thread Baranov Victor via cfe-commits
@@ -225,6 +226,89 @@ void integer_complex_suffix() { static_assert(v28 == 1J, ""); } +// This is a C++23 feature, but Clang supports it in earlier language modes +// as an extension, so we test it unconditionally. vbvictor wrote: I think we should not depen

[clang-tools-extra] [clang-tidy] Teach `readability-uppercase-literal-suffix` about C++23 and C23 suffixes (PR #148275)

2025-07-19 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,248 @@ +// TODO: When Clang adds support for C++23 floating-point types, enable these tests by: +//1. Removing all the #if 0 + #endif guards. +//2. Removing all occurrences of the string "DISABLED-" in this file. +//3. Deleting this message. +// These suffi

[clang-tools-extra] [clang-tidy] Teach `readability-uppercase-literal-suffix` about C++23 and C23 suffixes (PR #148275)

2025-07-19 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,248 @@ +// TODO: When Clang adds support for C++23 floating-point types, enable these tests by: +//1. Removing all the #if 0 + #endif guards. +//2. Removing all occurrences of the string "DISABLED-" in this file. +//3. Deleting this message. +// These suffi

[clang-tools-extra] [clang-tidy] Make `bugprone-unhandled-self-assignment` check more general (PR #147066)

2025-07-19 Thread Baranov Victor via cfe-commits
@@ -540,6 +547,89 @@ class NotACopyAssignmentOperator { Uy *getUy() const { return Ptr2; } }; +// Support "extended" copy/move constructors +class AllocatorAwareClass { vbvictor wrote: Could you add cases when the check will fire (I suppose it at least): -

[clang-tools-extra] [clang-tidy] Make `bugprone-unhandled-self-assignment` check more general (PR #147066)

2025-07-19 Thread Baranov Victor via cfe-commits
@@ -69,6 +69,28 @@ void UnhandledSelfAssignmentCheck::registerMatchers(MatchFinder *Finder) { cxxMethodDecl(unless(hasDescendant(cxxMemberCallExpr(callee(cxxMethodDecl( hasName("operator="), ofClass(equalsBoundNode("class"; + // Checking that some ki

[clang-tools-extra] [clang-tidy] Add MLIR check for old op builder usage. (PR #149148)

2025-07-19 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,51 @@ +// RUN: %check_clang_tidy --match-partial-fixes %s llvm-mlir-op-builder %t + +namespace mlir { +class Location {}; +class OpBuilder { +public: + template + OpTy create(Location location, Args &&...args) { +return OpTy(args...); + } + Location getUnknownL

[clang-tools-extra] [clang-tidy] Add MLIR check for old op builder usage. (PR #149148)

2025-07-19 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,103 @@ +//===--- MLIROpBuilderCheck.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 MLIR check for old op builder usage. (PR #149148)

2025-07-19 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,21 @@ +.. title:: clang-tidy - llvm-mlir-op-builder + +llvm-mlir-op-builder + + +Flags usage of old form of invoking create on MLIR's ``OpBuilder`` and suggests +new form. vbvictor wrote: I think we should write why the user should

[clang-tools-extra] [clang-tidy] Add MLIR check for old op builder usage. (PR #149148)

2025-07-19 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,103 @@ +//===--- MLIROpBuilderCheck.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 MLIR check for old op builder usage. (PR #149148)

2025-07-19 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/149148 ___ 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 MLIR check for old op builder usage. (PR #149148)

2025-07-19 Thread Baranov Victor via cfe-commits
@@ -40,6 +41,7 @@ class LLVMModule : public ClangTidyModule { CheckFactories.registerCheck( "llvm-qualified-auto"); CheckFactories.registerCheck("llvm-twine-local"); +CheckFactories.registerCheck("llvm-mlir-op-builder"); vbvictor wrote: Ple

[clang-tools-extra] [clang-tidy] Add MLIR check for old op builder usage. (PR #149148)

2025-07-19 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,29 @@ +//===--- MLIROpBuilderCheck.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] [clang-tidy] Add MLIR check for old op builder usage. (PR #149148)

2025-07-19 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor commented: I think we need a more verbose check name for users to understand what is the check about, e.g. `llvm-prefer-new-mlir-op-builder` `llvm-use-new-mlir-op-builder` `llvm-use-static-function-mlir-op-builder` https://github.com/llvm/llvm-project/pull/149148 ___

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

2025-07-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,311 @@ +//===--- 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-07-18 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-07-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,471 @@ +// RUN: %check_clang_tidy -std=c++17-or-later %s modernize-use-scoped-lock %t -- -- -isystem %clang_tidy_headers -fno-delayed-template-parsing + +#include + +void Positive() { + std::mutex m; + { +std::lock_guard l(m); +// CHECK-MESSAGES: :[[@LINE-1]

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

2025-07-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,471 @@ +// RUN: %check_clang_tidy -std=c++17-or-later %s modernize-use-scoped-lock %t -- -- -isystem %clang_tidy_headers -fno-delayed-template-parsing + +#include + +void Positive() { + std::mutex m; + { +std::lock_guard l(m); +// CHECK-MESSAGES: :[[@LINE-1]

[clang-tools-extra] [clang-tidy] add modernize-use-constexpr check (PR #146553)

2025-07-17 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,972 @@ +//===--- UseConstexprCheck.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 modernize-use-constexpr check (PR #146553)

2025-07-17 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor commented: Gave this a very rought look, so only a couple of general questions/suggestions. Could we do something with methods that repeat in some of the visitors, e.g. `bool TraverseType(QualType QT)` and others. Maybe macros..? I can't think of a better idea right

[clang-tools-extra] [clang-tidy] add modernize-use-constexpr check (PR #146553)

2025-07-17 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,972 @@ +//===--- UseConstexprCheck.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 modernize-use-constexpr check (PR #146553)

2025-07-17 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,972 @@ +//===--- UseConstexprCheck.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 modernize-use-constexpr check (PR #146553)

2025-07-17 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,972 @@ +//===--- UseConstexprCheck.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 modernize-use-constexpr check (PR #146553)

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

[clang-tools-extra] [clang-tools-extra][NFC] Fix link to code review in README.txt (PR #148384)

2025-07-17 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor closed https://github.com/llvm/llvm-project/pull/148384 ___ 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] Add mention of running 'clang-tidy' on changes in Contributing.rst (PR #148547)

2025-07-17 Thread Baranov Victor via cfe-commits
vbvictor wrote: > Clang-Tidy pull requests are usually small, so is `-j` really necessary? Do you have anything against `-j` anymore? Otherwise, I'd merge this PR https://github.com/llvm/llvm-project/pull/148547 ___ cfe-commits mailing list cfe-commit

[clang-tools-extra] [clang-tidy][NFC] Enable 'performance-move-const-arg' in '.clang-tidy' config (PR #148549)

2025-07-17 Thread Baranov Victor via cfe-commits
vbvictor wrote: > Are they really need to "std::move" in the patch? I think `MixData` is > meaningless since it is still need to copy all field. Do you mean with `CheckTriviallyCopyableMove` set to `true`? Technically, there would probably be no performance benefit. However, from author's poin

[clang-tools-extra] Cleanout clang-tools-extra ReleaseNotes (PR #149306)

2025-07-17 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor approved this pull request. LGTM, Maybe better commit name will be "[clang-tools-extra] Bump ReleaseNotes to 22.0.0git" https://github.com/llvm/llvm-project/pull/149306 ___ cfe-commits mailing list cfe-commits@lists.llvm.or

[clang-tools-extra] [clang-tidy] Add MLIR check for old op builder usage. (PR #149148)

2025-07-17 Thread Baranov Victor via cfe-commits
vbvictor wrote: > Something like > https://github.com/llvm/llvm-project/compare/main...jpienaar:llvm-project:cleanout?expand=1 Looks good, that must be the patch needed. https://github.com/llvm/llvm-project/pull/149148

[clang-tools-extra] [clang-tidy] Add MLIR check for old op builder usage. (PR #149148)

2025-07-17 Thread Baranov Victor via cfe-commits
vbvictor wrote: Yes, Tobias didn't have time to make a PR with cleaning release notes. https://discord.com/channels/636084430946959380/654052269301694465/1394963436538040421. At this time of the week, I can't either:( We shouldn't merge anything before release n

[clang] [clang-tools-extra] [clang-tidy] bugprone-infinite-loop: Add support for tuple structured bindings (PR #147410)

2025-07-16 Thread Baranov Victor via cfe-commits
vbvictor wrote: Thank you for the PR! Did you try to address this issue https://github.com/llvm/llvm-project/issues/138842? There is an ongoing PR https://github.com/llvm/llvm-project/pull/144213 that essentially tries to handle the same case with structured bindings. To be fair with everyone,

[clang-tools-extra] [clang-tidy] Add MLIR check for old op builder usage. (PR #149148)

2025-07-16 Thread Baranov Victor via cfe-commits
vbvictor wrote: I think we should go through an RFC before creating a new module. TBH, I don't think we need a new module for MLIR in upstream since it is not a widely known thing in C++ community. Would it be viable for MLIR folks to use [plugins](https://clang.llvm.org/extra/clang-tidy/Contr

[clang] [clang][docs] Add all clang-tools-extra to 'ClangTools.rst' (PR #148622)

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

[clang] [clang][docs] Add all clang-tools-extra (PR #148622)

2025-07-16 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor approved this pull request. LGTM, but please wait some time for EugeneZelenko to leave a review. https://github.com/llvm/llvm-project/pull/148622 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org

[clang] [clang][docs] Add all clang-tools-extra (PR #148622)

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

[clang] [clang][docs] Add all clang-tools-extra (PR #148622)

2025-07-15 Thread Baranov Victor via cfe-commits
@@ -89,14 +89,53 @@ they'll be tracked here. The focus of this documentation is on the scope and features of the tools for other tool developers; each tool should provide its own user-focused documentation. -``clang-tidy`` +``Clang-Doc`` +- + +`Clang-Doc

[clang-tools-extra] [clang-tidy] added `IgnoreAliasing` option to `readability-qualified-auto check` (PR #147060)

2025-07-15 Thread Baranov Victor via cfe-commits
@@ -96,3 +96,49 @@ Note in the LLVM alias, the default value is `false`. matched against only the type name (i.e. ``Type``). E.g. to suppress reports for ``std::array`` iterators use `std::array<.*>::(const_)?iterator` string. The default is an empty string. + +.. option:

[clang-tools-extra] [clang-tidy] added `IgnoreAliasing` option to `readability-qualified-auto check` (PR #147060)

2025-07-15 Thread Baranov Victor via cfe-commits
@@ -96,3 +96,49 @@ Note in the LLVM alias, the default value is `false`. matched against only the type name (i.e. ``Type``). E.g. to suppress reports for ``std::array`` iterators use `std::array<.*>::(const_)?iterator` string. The default is an empty string. + +.. option:

[clang-tools-extra] [clang-tidy] added `IgnoreAliasing` option to `readability-qualified-auto check` (PR #147060)

2025-07-15 Thread Baranov Victor via cfe-commits
@@ -96,3 +96,49 @@ Note in the LLVM alias, the default value is `false`. matched against only the type name (i.e. ``Type``). E.g. to suppress reports for ``std::array`` iterators use `std::array<.*>::(const_)?iterator` string. The default is an empty string. + +.. option:

[clang-tools-extra] [clang-tidy] added `IgnoreAliasing` option to `readability-qualified-auto check` (PR #147060)

2025-07-15 Thread Baranov Victor via cfe-commits
@@ -134,14 +136,26 @@ void QualifiedAutoCheck::registerMatchers(MatchFinder *Finder) { auto IsBoundToType = refersToType(equalsBoundNode("type")); auto UnlessFunctionType = unless(hasUnqualifiedDesugaredType(functionType())); - auto IsAutoDeducedToPointer = [](const std

[clang-tools-extra] [clang-tidy] added `IgnoreAliasing` option to `readability-qualified-auto check` (PR #147060)

2025-07-15 Thread Baranov Victor via cfe-commits
@@ -96,3 +96,49 @@ Note in the LLVM alias, the default value is `false`. matched against only the type name (i.e. ``Type``). E.g. to suppress reports for ``std::array`` iterators use `std::array<.*>::(const_)?iterator` string. The default is an empty string. + +.. option:

[clang-tools-extra] [clang-tidy] Speed up `misc-header-include-cycle` (PR #148757)

2025-07-14 Thread Baranov Victor via cfe-commits
vbvictor wrote: Could you use `-enable-check-profile` and get a benchmark for standalone `clang-tidy` before and after the patch? https://clang.llvm.org/extra/clang-tidy/Contributing.html#on-checks-profiling https://github.com/llvm/llvm-project/pull/148757 _

[clang-tools-extra] [clang-tidy] do not diagnose array types within implicit instantiations of a template (PR #132924)

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

[clang-tools-extra] [clang-tidy] do not diagnose array types within implicit instantiations of a template (PR #132924)

2025-07-14 Thread Baranov Victor via cfe-commits
@@ -66,22 +89,45 @@ void AvoidCArraysCheck::registerMatchers(MatchFinder *Finder) { hasParent(varDecl(isExternC())), hasParent(fieldDecl( hasParent(recordDecl(isExternCContext(), -

[clang-tools-extra] [clang-tidy] do not diagnose array types within implicit instantiations of a template (PR #132924)

2025-07-14 Thread Baranov Victor via cfe-commits
@@ -66,22 +89,45 @@ void AvoidCArraysCheck::registerMatchers(MatchFinder *Finder) { hasParent(varDecl(isExternC())), hasParent(fieldDecl( hasParent(recordDecl(isExternCContext(), -

[clang-tools-extra] [clang-tidy] do not diagnose array types within implicit instantiations of a template (PR #132924)

2025-07-14 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor commented: Tests lgtm, minor comments on code. Please rebase on fresh main https://github.com/llvm/llvm-project/pull/132924 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listi

[clang] [clang][docs] Add all clang-tools-extra (PR #148622)

2025-07-14 Thread Baranov Victor via cfe-commits
@@ -97,6 +97,41 @@ linter tool. It provides an extensible framework for building compiler-based static analyses detecting and fixing bug-prone patterns, performance, portability and maintainability issues. +``clang-include-fixer`` +--- + +`clang-include-fi

[clang] [clang][docs] Add all clang-tools-extra (PR #148622)

2025-07-14 Thread Baranov Victor via cfe-commits
@@ -97,6 +97,41 @@ linter tool. It provides an extensible framework for building compiler-based static analyses detecting and fixing bug-prone patterns, performance, portability and maintainability issues. +``clang-include-fixer`` +--- + +`clang-include-fi

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

2025-07-14 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor closed 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] Improve `bugprone-exception-escape`: add stacktrace of escaped exception (PR #134375)

2025-07-14 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][NFC] Do less unnecessary work in `NoLintDirectiveHandler` (PR #147553)

2025-07-14 Thread Baranov Victor via cfe-commits
@@ -93,15 +92,17 @@ class NoLintToken { // The location of the first character, "N", in "NOLINT". size_t Pos; + // A glob of the checks this NOLINT token disables. + std::unique_ptr ChecksGlob; vbvictor wrote: Do we need to put it in `public`? https://

[clang-tools-extra] [clang-tidy][NFC] Do less unnecessary work in `NoLintDirectiveHandler` (PR #147553)

2025-07-14 Thread Baranov Victor via cfe-commits
@@ -349,46 +369,21 @@ bool NoLintDirectiveHandler::Impl::diagHasNoLint( return false; // Do we have cached NOLINT block locations for this file? - if (Cache.count(*FileName) == 0) + if (!Cache.contains(*FileName)) // Warning: heavy operation - need to read entire

[clang-tools-extra] [clang-tidy] Update `confusables.txt` in `misc-confusable-identifiers` (PR #148399)

2025-07-14 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor closed https://github.com/llvm/llvm-project/pull/148399 ___ 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-07-14 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] Add new check: `readability-use-concise-preprocessor-directives` (PR #146830)

2025-07-14 Thread Baranov Victor via cfe-commits
vbvictor wrote: > A LLVM syncbot commit turned our buildbot red: > https://lab.llvm.org/buildbot/#/builders/123/builds/23254 > > The syncbot commit links to this PR. [edit] On a second look it looks more > like an infra issue on our end, I'll investigate. [/edit] Hi! Any logs/errors that are

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

2025-07-13 Thread Baranov Victor via cfe-commits
@@ -332,19 +376,42 @@ 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 structs and Nested Objects within modernize-use-emplace (PR #131969)

2025-07-13 Thread Baranov Victor via cfe-commits
@@ -332,19 +376,42 @@ 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 structs and Nested Objects within modernize-use-emplace (PR #131969)

2025-07-13 Thread Baranov Victor via cfe-commits
@@ -332,19 +376,42 @@ 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 structs and Nested Objects within modernize-use-emplace (PR #131969)

2025-07-13 Thread Baranov Victor via cfe-commits
@@ -1434,3 +1436,33 @@ void testWithPointerTypes() { // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: unnecessary temporary object created while calling emplace // CHECK-FIXES: sp->emplace(); } + +namespace GH1225740 { + +void CXX20testBracedInitTemporaries(){ + --

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

2025-07-13 Thread Baranov Victor via cfe-commits
@@ -1434,3 +1436,33 @@ void testWithPointerTypes() { // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: unnecessary temporary object created while calling emplace // CHECK-FIXES: sp->emplace(); } + +namespace GH1225740 { + +void CXX20testBracedInitTemporaries(){

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

2025-07-13 Thread Baranov Victor via cfe-commits
@@ -1434,3 +1436,33 @@ void testWithPointerTypes() { // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: unnecessary temporary object created while calling emplace // CHECK-FIXES: sp->emplace(); } + +namespace GH1225740 { + +void CXX20testBracedInitTemporaries(){ + + std::vector

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

2025-07-13 Thread Baranov Victor via cfe-commits
@@ -1434,3 +1436,33 @@ void testWithPointerTypes() { // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: unnecessary temporary object created while calling emplace // CHECK-FIXES: sp->emplace(); } + +namespace GH1225740 { vbvictor wrote: nit: After N years this

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

2025-07-13 Thread Baranov Victor via cfe-commits
@@ -1,4 +1,12 @@ -// RUN: %check_clang_tidy %s modernize-use-emplace %t -- \ +// RUN: %check_clang_tidy %s -std=c++11 modernize-use-emplace %t -- \ vbvictor wrote: ```suggestion // RUN: %check_clang_tidy %s -std=c++11,c++14,c++17 modernize-use-emplace %t -- \ ``

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

2025-07-13 Thread Baranov Victor via cfe-commits
@@ -1,4 +1,12 @@ -// RUN: %check_clang_tidy %s modernize-use-emplace %t -- \ +// RUN: %check_clang_tidy %s -std=c++11 modernize-use-emplace %t -- \ +// RUN: -config="{CheckOptions: \ +// RUN: {modernize-use-emplace.ContainersWithPushBack: \ +// RUN:':

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

2025-07-13 Thread Baranov Victor via cfe-commits
@@ -332,19 +376,42 @@ 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][NFC] Add mention of running 'clang-tidy' on changes in Contributing.rst (PR #148547)

2025-07-13 Thread Baranov Victor via cfe-commits
vbvictor wrote: IMO, we should implicitly use `multiprocessing.cpu_count()` in `run-clang-tidy` and `clang-tidy-diff` and use that number if user didn't specify `-j` explicitly. P.S. running lint over all clang-tidy is not so fast now:) ```bash $ time run-clang-tidy -p build/ clang-tools-extra

[clang-tools-extra] [clang-tidy][NFC] Add mention of running 'clang-tidy' on changes in Contributing.rst (PR #148547)

2025-07-13 Thread Baranov Victor via cfe-commits
vbvictor wrote: > Clang-Tidy pull requests are usually small, so is `-j` really necessary? I may say why not to use all cores when we can. If PR only touches 1 file, `clang-tidy-diff` will not load other cores. If PR touches multiple files, the user can have N times faster linting time, which i

[clang-tools-extra] [clang-tidy] modernize-use-std-print, format: Fix checks with Abseil functions (PR #142312)

2025-07-13 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor approved this pull request. LGTM As I understand now, `IgnoreImplicitAsWritten` does not skip `CXXConstructExpr` and other similar nodes but `IgnoreUnlessSpelledInSource` does. To drill down to the `StringLiteral` we need to use `IgnoreUnlessSpelledInSource`. https:/

[clang-tools-extra] [clang-tidy][NFC] Enable 'performance-move-const-arg' in '.clang-tidy' config (PR #148549)

2025-07-13 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/148549 Set `performance-move-const-arg.CheckTriviallyCopyableMove` option to `false` because "trivially copyable" is too strict and give warning for e.g. `MixData` class: https://github.com/llvm/llvm-project/blob/1f

[clang-tools-extra] [clang-tidy][NFC] Add mention of running 'clang-tidy' on changes in Contributing.rst (PR #148547)

2025-07-13 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/148547 ___ 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 filtering of check options by enabled checks in '--dump-config' (PR #147142)

2025-07-13 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor closed https://github.com/llvm/llvm-project/pull/147142 ___ 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] Add mention of running 'clang-tidy' on changes in Contributing.rst (PR #148547)

2025-07-13 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/148547 Follow up to https://github.com/llvm/llvm-project/pull/147793. Originally suggested in https://github.com/llvm/llvm-project/pull/147793#issuecomment-3059021433 >From 9ee0621a78423ee97d2dcafb6b8de35783222b4e M

[clang-tools-extra] [clang-tidy] Add new check: `readability-use-concise-preprocessor-directives` (PR #146830)

2025-07-13 Thread Baranov Victor via cfe-commits
vbvictor wrote: Buildbot failure seems unrelated https://github.com/llvm/llvm-project/pull/146830 ___ 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: `readability-use-concise-preprocessor-directives` (PR #146830)

2025-07-13 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor closed https://github.com/llvm/llvm-project/pull/146830 ___ 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-unchecked-optional-access`: handle `BloombergLP::bdlb:NullableValue::makeValue` to prevent false-positives (PR #144313)

2025-07-13 Thread Baranov Victor via cfe-commits
vbvictor wrote: Analysis reviewers, could you please take a look at this https://github.com/llvm/llvm-project/pull/144313#discussion_r2188585118. Your opinion is highly appreciated! https://github.com/llvm/llvm-project/pull/144313 ___ cfe-commits mai

[clang] [clang-tools-extra] [clang-tidy] `bugprone-unchecked-optional-access`: handle `BloombergLP::bdlb:NullableValue::makeValue` to prevent false-positives (PR #144313)

2025-07-13 Thread Baranov Victor via cfe-commits
@@ -985,6 +985,20 @@ auto buildTransferMatchSwitch() { isOptionalMemberCallWithNameMatcher(hasName("isNull")), transferOptionalIsNullCall) + // NullableValue::makeValue, NullableValue::makeValueInplace + // Only NullableValue has these methods, bu

[clang-tools-extra] Reland "[clang-tidy] Improve integer comparison by matching valid expressions outside implicitCastExpr for use-integer-sign-comparison" (PR #144240)

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

[clang-tools-extra] Reland [clang-tidy] Improve integer comparison by matching valid expressions outside implicitCastExpr for use-integer-sign-comparison (PR #144240)

2025-07-13 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/144240 ___ 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 integer comparison by matching valid expressions outside implicitCastExpr for use-integer-sign-comparison (PR #144240)

2025-07-13 Thread Baranov Victor via cfe-commits
vbvictor wrote: Ping @carlosgalvezp, @5chmidti, @HerrCai0907 as original reviewers of the check. You may have more thought here, second opinion in appreciated since this PR is a reland. https://github.com/llvm/llvm-project/pull/144240 ___ cfe-commits

[clang-tools-extra] [clang-tidy] Add filtering of check options by enabled checks in '--dump-config' (PR #147142)

2025-07-13 Thread Baranov Victor via cfe-commits
@@ -503,6 +503,21 @@ getCheckNames(const ClangTidyOptions &Options, return Factory.getCheckNames(); } +void filterCheckOptions(ClangTidyOptions &Options, +const std::vector &EnabledChecks) { + StringSet<> EnabledChecksSet(llvm::from_range, EnabledChe

  1   2   3   4   5   6   7   8   9   10   >