[clang-tools-extra] Add check 'cppcoreguidelines-use-enum-class' (PR #138282)

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

[clang-tools-extra] Add check 'cppcoreguidelines-use-enum-class' (PR #138282)

2025-06-04 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,40 @@ +//===--- UseEnumClassCheck.h - clang-tidy ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang-tools-extra] Add check 'cppcoreguidelines-use-enum-class' (PR #138282)

2025-06-04 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor approved this pull request. LGTM, few nits with docs. Ping, @HerrCai0907, @carlosgalvezp, @PiotrZSL if you wish to leave a review. I suppose in 1-2 weeks I'll land the PR. https://github.com/llvm/llvm-project/pull/138282 __

[clang-tools-extra] Add check 'cppcoreguidelines-use-enum-class' (PR #138282)

2025-06-04 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,40 @@ +//===--- UseEnumClassCheck.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][performance-unnecessary-value-param] Avoid in coroutines (PR #140912)

2025-06-04 Thread Baranov Victor via cfe-commits
vbvictor wrote: I have a mixed feeling about whether we should always exclude all coroutines by default or not. When a coroutine has only one `co-operator` and nothing else should be safe to use a reference parameter? Am I wrong? So I think to be "on a safe side" I'd suggest a new option "Ingo

[clang-tools-extra] [clang-tidy] Add new check `readability-use-numeric-limits` (PR #127430)

2025-06-04 Thread Baranov Victor via cfe-commits
vbvictor wrote: @stellar-aria, 21th LLVM release will be soon and the PR is 95% ready to land even if some corner-cases are not matched. Do you wish to rebase on fresh main and after a quick re-review the check should be ready to land. https://github.com/llvm/llvm-project/pull/127430 _

[clang-tools-extra] [clang-tidy] Add ClangQueryChecks config option (PR #123734)

2025-06-04 Thread Baranov Victor via cfe-commits
vbvictor wrote: @DeNiCoN, do you mind if this PR would be closed (or converted to draft at least)? I'm in the process of reviewing old PR to lower the number of open ones for ease of tracking. This PR could be reopened if needed. https://github.com/llvm/llvm-project/pull/123734 ___

[clang-tools-extra] added option `google-readability-namespace-comments.AllowNoNamespaceComments` (PR #124265)

2025-06-04 Thread Baranov Victor via cfe-commits
vbvictor wrote: @thorsten-klein, gentle ping, do you still wish to work on this check? 21th LLVM release will be soon, If you wish to have your changes in the upcoming release please rebase on main and fix issues suggested by HerrCai0907. https://github.com/llvm/llvm-project/pull/124265 ___

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

2025-06-04 Thread Baranov Victor via cfe-commits
vbvictor wrote: Gentle ping @PiotrZSL 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 ClangQueryChecks config option (PR #123734)

2025-06-04 Thread Baranov Victor via cfe-commits
vbvictor wrote: Closed as further review happens in https://github.com/llvm/llvm-project/pull/131804 https://github.com/llvm/llvm-project/pull/123734 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listin

[clang-tools-extra] [clang-tidy] Add AllowFalseEvaluated flag to clang-tidy noexcept-move-constructor check (PR #126897)

2025-06-04 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,63 @@ +// RUN: %check_clang_tidy %s performance-noexcept-move-constructor %t -- -- -fexceptions + +// RUN: %check_clang_tidy -check-suffix=CONFIG %s performance-noexcept-move-constructor,performance-noexcept-destructor %t -- \ +// RUN: -config="{CheckOptions: {perfor

[clang-tools-extra] [clang-tidy] Add AllowFalseEvaluated flag to clang-tidy noexcept-move-constructor check (PR #126897)

2025-06-04 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,63 @@ +// RUN: %check_clang_tidy %s performance-noexcept-move-constructor %t -- -- -fexceptions vbvictor wrote: Generally with options-test-file we do not need to check basic functionality since it should be covered in main test file https://github

[clang-tools-extra] [clang-tidy] Add AllowFalseEvaluated flag to clang-tidy noexcept-move-constructor check (PR #126897)

2025-06-04 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor commented: @Nechda, gentle ping, do you still wish to work on this PR? 21th LLVM release will be soon, If you wish to have your changes in the upcoming release please rebase on main and fix suggestions. https://github.com/llvm/llvm-project/pull/126897 __

[clang-tools-extra] [clang-tidy] `modernize-use-trailing-return-type`: add an option to apply to `void`-returning functions as well (PR #129406)

2025-06-04 Thread Baranov Victor via cfe-commits
vbvictor wrote: @khuldraeseth, gentle ping, do you still wish to work on this check? 21th LLVM release will be soon, If you wish to have your changes in the upcoming release please rebase on main and fix suggested issues https://github.com/llvm/llvm-project/pull/129406

[clang-tools-extra] [clang-tidy] Add AllowFalseEvaluated flag to clang-tidy noexcept-move-constructor check (PR #126897)

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

[clang-tools-extra] Add check 'cppcoreguidelines-use-enum-class' (PR #138282)

2025-06-04 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,35 @@ +.. title:: clang-tidy - cppcoreguidelines-use-enum-class + +cppcoreguidelines-use-enum-class + + +Finds unscoped (non-class) ``enum`` declarations and suggests using +``enum class`` instead. + +This check implements `Enum.3 ---

[clang-tools-extra] Add check 'cppcoreguidelines-use-enum-class' (PR #138282)

2025-06-04 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,35 @@ +.. title:: clang-tidy - cppcoreguidelines-use-enum-class + +cppcoreguidelines-use-enum-class + + +Finds unscoped (non-class) ``enum`` declarations and suggests using +``enum class`` instead. + +This check implements `Enum.3 ---

[clang-tools-extra] Add check 'cppcoreguidelines-use-enum-class' (PR #138282)

2025-06-04 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/138282 ___ 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 check for assignment or comparision operators' operand in `readability-math-missing-parentheses` (PR #141345)

2025-06-04 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/141345 ___ 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 check for assignment or comparision operators' operand in `readability-math-missing-parentheses` (PR #141345)

2025-06-04 Thread Baranov Victor via cfe-commits
@@ -157,3 +157,17 @@ namespace PR92516 { for (j = i + 1, 2; j < 1; ++j) {} } } + +namespace PR141249 { + void AssignAsParentBinOp(int* netChange, int* nums, int k, int i) { +//CHECK-MESSAGES: :[[@LINE+1]]:30: warning: '-' has higher precedence than '^'; add parenthe

[clang-tools-extra] [clang-tidy] Add check for assignment or comparision operators' operand in `readability-math-missing-parentheses` (PR #141345)

2025-06-04 Thread Baranov Victor via cfe-commits
@@ -157,3 +157,17 @@ namespace PR92516 { for (j = i + 1, 2; j < 1; ++j) {} } } + +namespace PR141249 { + void AssignAsParentBinOp(int* netChange, int* nums, int k, int i) { +//CHECK-MESSAGES: :[[@LINE+1]]:30: warning: '-' has higher precedence than '^'; add parenthe

[clang-tools-extra] [clang-tidy] Add check for assignment or comparision operators' operand in `readability-math-missing-parentheses` (PR #141345)

2025-06-04 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor commented: Sorry for late notice, but I see there is also CHECK-FIXES in this check, could you please add them and I can merge the PR. I don't know why tests didn't fail because of it, needs some investigation. https://github.com/llvm/llvm-project/pull/141345 __

[clang-tools-extra] [clang-tidy] Add new check `llvm-prefer-static-over-anonymous-namespace` (PR #142839)

2025-06-04 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/142839 Finds function and variable declarations inside anonymous namespace and suggests replacing them with ``static`` declarations. The check will enforce that [restrict-visibility](https://llvm.org/docs/CodingStan

[clang-tools-extra] [clang-tidy] Add new check `llvm-prefer-static-over-anonymous-namespace` (PR #142839)

2025-06-04 Thread Baranov Victor via cfe-commits
vbvictor wrote: @AaronBallman, may you give some feedback on how good/bad this check would play on LLVM project in general. I feel it may be even "too strict" for whole LLVM, but for clang-tidy project it may be very helpful in guiding new contributors writing the right way. https://github.co

[clang-tools-extra] [clang-tidy] Add performance-bool-bitwise-operation check (PR #142324)

2025-06-02 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,200 @@ +//===--- BoolBitwiseOperationCheck.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 performance-bool-bitwise-operation check (PR #142324)

2025-06-02 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,40 @@ +.. title:: clang-tidy - performance-bool-bitwise-operation + +performance-bool-bitwise-operation +== + +Finds potentially inefficient use of bitwise operators such as ``&``, +``|`` and their compound analogues on boolean values wh

[clang-tools-extra] [clang-tidy] Add performance-bool-bitwise-operation check (PR #142324)

2025-06-02 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,200 @@ +//===--- BoolBitwiseOperationCheck.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 performance-bool-bitwise-operation check (PR #142324)

2025-06-02 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,40 @@ +.. title:: clang-tidy - performance-bool-bitwise-operation + +performance-bool-bitwise-operation +== + +Finds potentially inefficient use of bitwise operators such as ``&``, +``|`` and their compound analogues on boolean values wh

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

2025-06-03 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor closed https://github.com/llvm/llvm-project/pull/90043 ___ 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() (PR #90043)

2025-06-03 Thread Baranov Victor via cfe-commits
vbvictor wrote: I'm in the process of looking at old/duplicate PRs to lower number of ongoing open requests (currently 87) so closing would be helpful. https://github.com/llvm/llvm-project/pull/90043 ___ cfe-commits mailing list cfe-commits@lists.llvm

[clang-tools-extra] [clang-tidy] Add bugprone-move-shared-pointer-contents check. (PR #67467)

2025-06-03 Thread Baranov Victor via cfe-commits
vbvictor wrote: @pizzud, you wish to continue work on this PR? 21th release of LLVM would be in late July, we have time to prepare and merge this check before the release. Also, It's okay to not cover all cases in the first iteration, some improvements can be added in later patches. Windows b

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

2025-06-03 Thread Baranov Victor via cfe-commits
vbvictor wrote: Closed as now review process is done in https://github.com/llvm/llvm-project/pull/95220 https://github.com/llvm/llvm-project/pull/90043 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/list

[clang-tools-extra] [clang-tidy] Add AllowFalseEvaluated flag to clang-tidy noexcept-move-constructor check (PR #126897)

2025-06-06 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor requested changes to this pull request. Since you de-facto added this option to `performance-noexcept-destructor` check too, please add it to `performance-noexcept-destructor.rst` docs (just copypaste), add to ReleaseNotes and add a separate test-file for noexcept d

[clang-tools-extra] [clang-tidy] Add AllowFalseEvaluated flag to clang-tidy noexcept-move-constructor check (PR #126897)

2025-06-06 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,46 @@ +// RUN: %check_clang_tidy -check-suffix=CONFIG %s performance-noexcept-move-constructor,performance-noexcept-destructor %t -- \ +// RUN: -config="{CheckOptions: {performance-noexcept-move-constructor.AllowFalseEvaluated: true}}" \ +// RUN: -- -fexceptions + +na

[clang-tools-extra] [clang-tidy] Add AllowFalseEvaluated flag to clang-tidy noexcept-move-constructor check (PR #126897)

2025-06-06 Thread Baranov Victor via cfe-commits
@@ -33,6 +34,10 @@ class NoexceptFunctionBaseCheck : public ClangTidyCheck { return TK_IgnoreUnlessSpelledInSource; } + void storeOptions(ClangTidyOptions::OptionMap &Opts) override { vbvictor wrote: Please place definition in .cpp file https://github

[clang-tools-extra] [clang-tidy] Add AllowFalseEvaluated flag to clang-tidy noexcept-move-constructor check (PR #126897)

2025-06-06 Thread Baranov Victor via cfe-commits
@@ -22,7 +22,8 @@ namespace clang::tidy::performance { class NoexceptFunctionBaseCheck : public ClangTidyCheck { public: NoexceptFunctionBaseCheck(StringRef Name, ClangTidyContext *Context) - : ClangTidyCheck(Name, Context) {} + : ClangTidyCheck(Name, Context),

[clang-tools-extra] [clang-tidy] Add AllowFalseEvaluated flag to clang-tidy noexcept-move-constructor check (PR #126897)

2025-06-06 Thread Baranov Victor via cfe-commits
@@ -110,6 +110,12 @@ Changes in existing checks ` check by providing additional examples and fixing some macro related false positives. +- Improved :doc:`performance-noexcept-move-constructor + ` check by adding + a new (off-by-default) option `AllowFalseEvaluated`, whic

[clang-tools-extra] [clang-tidy] Add AllowFalseEvaluated flag to clang-tidy noexcept-move-constructor check (PR #126897)

2025-06-06 Thread Baranov Victor via cfe-commits
@@ -253,6 +253,12 @@ Changes in existing checks ` check by fixing some false positives involving smart pointers to arrays. +- Improved :doc:`performance-noexcept-move-constructor vbvictor wrote: Please place this in alphabetical order (by check name). Sho

[clang-tools-extra] [clang-tidy] Add AllowFalseEvaluated flag to clang-tidy noexcept-move-constructor check (PR #126897)

2025-06-06 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/126897 ___ 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 AllowFalseEvaluated flag to clang-tidy noexcept-move-constructor check (PR #126897)

2025-06-06 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,46 @@ +// RUN: %check_clang_tidy -check-suffix=CONFIG %s performance-noexcept-move-constructor,performance-noexcept-destructor %t -- \ +// RUN: -config="{CheckOptions: {performance-noexcept-move-constructor.AllowFalseEvaluated: true}}" \ +// RUN: -- -fexceptions + +na

[clang-tools-extra] [clang-tidy] Add AllowFalseEvaluated flag to clang-tidy noexcept-move-constructor check (PR #126897)

2025-06-06 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,46 @@ +// RUN: %check_clang_tidy -check-suffix=CONFIG %s performance-noexcept-move-constructor,performance-noexcept-destructor %t -- \ +// RUN: -config="{CheckOptions: {performance-noexcept-move-constructor.AllowFalseEvaluated: true}}" \ +// RUN: -- -fexceptions + +na

[clang-tools-extra] [clang-tidy] Add AllowFalseEvaluated flag to clang-tidy noexcept-move-constructor check (PR #126897)

2025-06-06 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/126897 ___ 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 with deducing this in `readability-convert-member-functions-to-static` check (PR #141391)

2025-06-07 Thread Baranov Victor via cfe-commits
vbvictor wrote: Could you please rebase on fresh main, and I will land the changes. https://github.com/llvm/llvm-project/pull/141391 ___ 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] Potential dereference of nullptr. (PR #143145)

2025-06-06 Thread Baranov Victor via cfe-commits
vbvictor wrote: I think we generally discussed such changes in https://github.com/llvm/llvm-project/pull/138283, CC @nicovank. Maybe we need to come to consensus in clang-tidy whether we should write `assert()` after `Result.Nodes.getNodeAs<>`. (There are many-many places that has `assert` an

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

2025-06-06 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/131669 >From 2b4699fda6854235cf59c69d1bf511bd12799c43 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Fri, 6 Jun 2025 18:46:11 +0300 Subject: [PATCH 1/2] [clang-tidy] count ctor-initializers as statements in func

[clang-tools-extra] [clang-tidy] Improve integer comparison by matching valid expressions outside implicitCastExpr (PR #134188)

2025-06-05 Thread Baranov Victor via cfe-commits
@@ -39,21 +39,28 @@ intCastExpression(bool IsSigned, // std::cmp_{} functions trigger a compile-time error if either LHS or RHS // is a non-integer type, char, enum or bool // (unsigned char/ signed char are Ok and can be used). - auto IntTypeExpr = expr(hasType(hasCanon

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

2025-06-06 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/131669 ___ 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 `readability-function-size`: count class member initializers as statements (PR #131669)

2025-06-06 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/131669 >From 2b4699fda6854235cf59c69d1bf511bd12799c43 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Fri, 6 Jun 2025 18:46:11 +0300 Subject: [PATCH] [clang-tidy] count ctor-initializers as statements in function

[clang-tools-extra] added option `google-readability-namespace-comments.AllowNoNamespaceComments` (PR #124265)

2025-06-05 Thread Baranov Victor via cfe-commits
vbvictor wrote: Please add entry in ReleaseNotes.rst (should be in alphabetical order by check name) and fix carlosgalvezp's final comment. After that should be ready for merge https://github.com/llvm/llvm-project/pull/124265 ___ cfe-commits mailing

[clang-tools-extra] [clang-tidy] Add check for assignment or comparision operators' operand in `readability-math-missing-parentheses` (PR #141345)

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

[clang-tools-extra] added option `google-readability-namespace-comments.AllowNoNamespaceComments` (PR #124265)

2025-06-05 Thread Baranov Victor via cfe-commits
@@ -187,6 +187,11 @@ Changes in existing checks ` check by fixing a false positive where ``strerror`` was flagged as MT-unsafe. +- Improved :doc:`google-readability-namespace-comments vbvictor wrote: Could we add also an entry for `llvm-readability-namesp

[clang-tools-extra] [clang-tidy][performance-unnecessary-value-param] Avoid in coroutines (PR #140912)

2025-06-05 Thread Baranov Victor via cfe-commits
vbvictor wrote: I think the default behavior of the option should be to ignore all coroutines - that will be to make ordinary users safe. https://github.com/llvm/llvm-project/pull/140912 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://

[clang-tools-extra] added option `google-readability-namespace-comments.AllowNoNamespaceComments` (PR #124265)

2025-06-05 Thread Baranov Victor via cfe-commits
@@ -187,6 +187,11 @@ Changes in existing checks ` check by fixing a false positive where ``strerror`` was flagged as MT-unsafe. +- Improved :doc:`google-readability-namespace-comments vbvictor wrote: No need for new tests, I can see that previously tests

[clang-tools-extra] added option `google-readability-namespace-comments.AllowNoNamespaceComments` (PR #124265)

2025-06-05 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/124265 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Added bugprone-unsequenced-global-accesses check (PR #130421)

2025-06-10 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,86 @@ +.. title:: clang-tidy - bugprone-unsequenced-global-accesses + +bugprone-unsequenced-global-accesses + + +Finds unsequenced actions (i.e. unsequenced write and read/write) +on global variables nested in functions in the same tr

[clang-tools-extra] [clang-tidy] Added bugprone-unsequenced-global-accesses check (PR #130421)

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

[clang-tools-extra] [clang-tidy] Added bugprone-unsequenced-global-accesses check (PR #130421)

2025-06-10 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,72 @@ +.. title:: clang-tidy - bugprone-conflicting-global-accesses + +bugprone-conflicting-global-accesses + + +Finds conflicting accesses on global variables. + +Modifying twice or reading and modifying a memory location without a +

[clang-tools-extra] [clang-tidy] Add modernize-make-direct check (PR #118120)

2025-06-11 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor requested changes to this pull request. Generally good check idea, but needs some polishing. - Neither `modernize-make-function-to-direct` nor `modernize-make-direct` sounds clear to me (specifically `direct` part), the main purpose of this transformation is to use `

[clang-tools-extra] [clang-tidy] Add modernize-make-direct check (PR #118120)

2025-06-11 Thread Baranov Victor via cfe-commits
@@ -124,6 +124,12 @@ New checks pointer and store it as class members without handle the copy and move constructors and the assignments. +- New :doc:`modernize-make-direct ` check. + + Converts std::make_* function calls to direct constructor calls using CTAD. --

[clang-tools-extra] [clang-tidy] Add modernize-make-direct check (PR #118120)

2025-06-11 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,46 @@ +.. title:: clang-tidy - modernize-make-direct + +modernize-make-direct vbvictor wrote: Sync check name accross all files, somewhere you have "MakeFunctionToDirect". https://github.com/llvm/llvm-project/pull/118120 __

[clang-tools-extra] [clang-tidy] Add modernize-make-direct check (PR #118120)

2025-06-11 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,78 @@ +//===--- MakeFunctionToDirectCheck.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: Apach

[clang-tools-extra] [clang-tidy] Add modernize-make-direct check (PR #118120)

2025-06-11 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,39 @@ +//===--- MakeFunctionToDirectCheck.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: Apach

[clang-tools-extra] [clang-tidy] Add modernize-make-direct check (PR #118120)

2025-06-11 Thread Baranov Victor via cfe-commits
@@ -124,6 +124,12 @@ New checks pointer and store it as class members without handle the copy and move constructors and the assignments. +- New :doc:`modernize-make-direct ` check. vbvictor wrote: Please format alphabetically and place doc string same as

[clang-tools-extra] [clang-tidy] Add modernize-make-direct check (PR #118120)

2025-06-11 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/118120 ___ 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-make-direct check (PR #118120)

2025-06-11 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,78 @@ +//===--- MakeFunctionToDirectCheck.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: Apach

[clang-tools-extra] [clang-tidy] Add modernize-make-direct check (PR #118120)

2025-06-11 Thread Baranov Victor via cfe-commits
@@ -50,6 +50,7 @@ add_clang_library(clangTidyModernizeModule STATIC UseTransparentFunctorsCheck.cpp UseUncaughtExceptionsCheck.cpp UseUsingCheck.cpp + MakeFunctionToDirectCheck.cpp vbvictor wrote: Please format alphabetically https://github.com/llvm/ll

[clang-tools-extra] [clang-tidy] Add modernize-make-direct check (PR #118120)

2025-06-11 Thread Baranov Victor via cfe-commits
@@ -125,6 +126,8 @@ class ModernizeModule : public ClangTidyModule { CheckFactories.registerCheck( "modernize-use-uncaught-exceptions"); CheckFactories.registerCheck("modernize-use-using"); +CheckFactories.registerCheck( +"modernize-make-direct"); --

[clang-tools-extra] [clang-tidy] Add modernize-make-direct check (PR #118120)

2025-06-11 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,78 @@ +//===--- MakeFunctionToDirectCheck.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: Apach

[clang-tools-extra] [clang-tidy] add AllowedTypes option to misc-const-correctness (PR #122951)

2025-06-11 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,180 @@ +// RUN: %check_clang_tidy %s misc-const-correctness %t -- \ +// RUN: -config="{CheckOptions: {\ +// RUN: misc-const-correctness.AllowedTypes: '[Pp]ointer$;[Pp]tr$;[Rr]ef(erence)?$;qualified::Type;::fully::QualifiedType;ConstTemplate', \ +// RUN: misc

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

2025-06-09 Thread Baranov Victor via cfe-commits
@@ -207,13 +207,9 @@ FormatStringConverter::FormatStringConverter( ArgsOffset(FormatArgOffset + 1), LangOpts(LO) { assert(ArgsOffset <= NumArgs); FormatExpr = llvm::dyn_cast( - Args[FormatArgOffset]->IgnoreImplicitAsWritten()); + Args[FormatArgOffset]->Ignor

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

2025-06-09 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/142312 ___ 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] run clang-format over `abseil` and `altera` checks. (PR #143314)

2025-06-08 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/143314 For ease of future developing, I make a series of clang-format patches on all clang-tidy code. Typically, all new contributors should follow the existing style, so making it consistent will give a benefit in i

[clang-tools-extra] [clang-tidy][NFC] run clang-format over 'android', 'boost' and 'bugprone' checks (PR #143315)

2025-06-08 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/143315 None >From 52b8b3edae64a301646b63f15dfa46cc9af250b3 Mon Sep 17 00:00:00 2001 From: Baranov Victor Date: Sun, 8 Jun 2025 19:23:38 +0300 Subject: [PATCH] [clang-tidy][NFC] run clang-format over 'android', 'boost

[clang-tools-extra] [clang-tidy][NFC] run clang-format over clang-tidy checks and tool code. (PR #143324)

2025-06-08 Thread Baranov Victor via cfe-commits
vbvictor wrote: PRs are already checked by git-clang-format but sometimes it needs manual start by a member. We shouldn't forget about this behavior. https://github.com/llvm/llvm-project/pull/143324 ___ cfe-commits mailing list cfe-commits@lists.llvm.

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

2025-06-09 Thread Baranov Victor via cfe-commits
@@ -207,13 +207,9 @@ FormatStringConverter::FormatStringConverter( ArgsOffset(FormatArgOffset + 1), LangOpts(LO) { assert(ArgsOffset <= NumArgs); FormatExpr = llvm::dyn_cast( - Args[FormatArgOffset]->IgnoreImplicitAsWritten()); + Args[FormatArgOffset]->Ignor

[clang-tools-extra] [clang-tidy] add AllowedTypes option to misc-const-correctness (PR #122951)

2025-06-12 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,180 @@ +// RUN: %check_clang_tidy %s misc-const-correctness %t -- \ +// RUN: -config="{CheckOptions: {\ +// RUN: misc-const-correctness.AllowedTypes: '[Pp]ointer$;[Pp]tr$;[Rr]ef(erence)?$;qualified::Type;::fully::QualifiedType;ConstTemplate', \ +// RUN: misc

[clang-tools-extra] Revert "[clang-tidy] Improve integer comparison by matching valid expressions outside implicitCastExpr" (PR #143944)

2025-06-12 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor approved this pull request. https://github.com/llvm/llvm-project/pull/143944 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [WIP] Warn about misuse of sizeof operator in loops. (PR #143205)

2025-06-11 Thread Baranov Victor via cfe-commits
@@ -561,6 +561,20 @@ Improvements to Clang's diagnostics Improvements to Clang's time-trace -- +Improvements to clang-tidy +-- + +New checks +^^ + +Changes in existing checks +^^ +-Improved

[clang-tools-extra] [clang-tidy][NFC] fix 'misc-use-internal-linkage' check warnings (PR #143482)

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

[clang-tools-extra] [clang-tidy] Added bugprone-unsequenced-global-accesses check (PR #130421)

2025-06-10 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,72 @@ +.. title:: clang-tidy - bugprone-conflicting-global-accesses + +bugprone-conflicting-global-accesses + + +Finds conflicting accesses on global variables. + +Modifying twice or reading and modifying a memory location without a +

[clang-tools-extra] [clang-tidy][NFC] change patterns 'anyOf(..., anything())' to 'optionally(...)' (PR #143558)

2025-06-10 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/143558 Writing `optionally()` instead of `anyOf(..., anything())` lowers code size and gives the author's intention better. >From 177faff965a73efdd22d460c38ff61004c065392 Mon Sep 17 00:00:00 2001 From: Victor Baranov

[clang-tools-extra] [clang-tidy] add 'IgnoreMarcos' option to 'avoid-goto' check (PR #143554)

2025-06-10 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/143554 None >From 5c975c6b59c02b0464a9bfc1b424b89b4d7dd662 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Tue, 10 Jun 2025 18:27:12 +0300 Subject: [PATCH] [clang-tidy] add 'IgnoreMarcos' option to 'avoid-goto' c

[clang-tools-extra] [clang-tidy] add 'IgnoreMarcos' option to 'avoid-goto' check (PR #143554)

2025-06-10 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/143554 >From 5c975c6b59c02b0464a9bfc1b424b89b4d7dd662 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Tue, 10 Jun 2025 18:27:12 +0300 Subject: [PATCH 1/2] [clang-tidy] add 'IgnoreMarcos' option to 'avoid-goto' ch

[clang-tools-extra] [clang-tidy][NFC] fix 'misc-use-internal-linkage' check warnings (PR #143482)

2025-06-10 Thread Baranov Victor via cfe-commits
@@ -1904,13 +1908,16 @@ AST_MATCHER(FunctionDecl, isOverloadedUnaryOrBinaryOperator) { } } +} // namespace + /// Returns the DefaultMinimumLength if the Value of requested minimum length /// is less than 2. Minimum lengths of 0 or 1 are not accepted. static inline unsign

[clang-tools-extra] [clang-tidy][NFC] fix 'misc-use-internal-linkage' check warnings (PR #143482)

2025-06-10 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/143482 >From 3c4c5d5b5fa85c4aa76b5ee6d654a4556c2d1e0b Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Tue, 10 Jun 2025 09:39:49 +0300 Subject: [PATCH 1/3] [clang-tidy] fix 'misc-internal-linkage' check warnings -

[clang-tools-extra] [clang-tidy] add 'IgnoreMarcos' option to 'special-member-functions' check (PR #143550)

2025-06-10 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/143550 None >From 229141e0e7c8b81f3522cea0e559660822265745 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Tue, 10 Jun 2025 18:12:35 +0300 Subject: [PATCH 1/3] [clang-tidy] add 'IgnoreMarcos' option to 'special-

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

2025-07-03 Thread Baranov Victor via cfe-commits
vbvictor wrote: If you are finished with the work on the check, please convert PR to "ready for review". I feel that this check should be `readability` section. https://github.com/llvm/llvm-project/pull/146830 ___ cfe-commits mailing list cfe-commits

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

2025-07-03 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,105 @@ +//===--- UseConcisePreprocessorDirectivesCheck.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] [analyzer] Fix crash when modelling 'getline' function in checkers (PR #145229)

2025-06-25 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,127 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix -verify %s -DTEST_CORRECT +// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix -verify %s -DTEST_GETLINE_1 +// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix -verify %s -DTEST_GETLINE_2 +// RUN: %

[clang-tools-extra] [clang-tidy] fix false negatives with type aliases in `cppcoreguidlines-pro-bounds-pointer-arithmetic` check (PR #139430)

2025-06-25 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/139430 >From 9737402a9cef1ce5bb1fc35898441eb3d14da6bb Mon Sep 17 00:00:00 2001 From: Baranov Victor Date: Sun, 11 May 2025 05:22:55 +0300 Subject: [PATCH] [clang-tidy] fix false positives with type aliases in pro-bou

[clang] [clang][analyzer] fix crash when modelling 'getline' function in checkers (PR #145229)

2025-06-25 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/145229 >From ba9f1edfc2ea1fb1e41366721ccbf795ec998707 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Mon, 23 Jun 2025 23:55:57 +0300 Subject: [PATCH 1/2] [clang][analyzer] fix crash when modelling 'getline' func

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

2025-06-25 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] [analyzer] Fix crash when modelling 'getline' function in checkers (PR #145229)

2025-06-25 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/145229 >From ba9f1edfc2ea1fb1e41366721ccbf795ec998707 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Mon, 23 Jun 2025 23:55:57 +0300 Subject: [PATCH 1/6] [clang][analyzer] fix crash when modelling 'getline' func

[clang] [analyzer][NFC] Fix clang-tidy warning in Malloc and UnixApi checkers (PR #145719)

2025-06-25 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/145719 Mostly `else-after-return` and `else-after-continue` warnings >From a4563c7adccfc8b9820413a7e0c5d86503b50add Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Wed, 25 Jun 2025 18:12:29 +0300 Subject: [PATCH]

[clang] [analyzer] Fix crash on compound literals with bitfields in unions (PR #146418)

2025-07-03 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/146418 >From 3611049b862e1738237c0092f1e13c08f409663f Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Mon, 30 Jun 2025 23:34:33 +0300 Subject: [PATCH 1/2] [analyzer] Fix crash on compound literals with bitfields

[clang] [analyzer] Fix crash on compound literals with bitfields in unions (PR #146418)

2025-07-03 Thread Baranov Victor via cfe-commits
@@ -2187,7 +2187,10 @@ std::optional RegionStoreManager::getBindingForDerivedDefaultValue( // Lazy bindings are usually handled through getExistingLazyBinding(). // We should unify these two code paths at some point. -if (isa(val)) +// 'nonloc::ConcreteInt' va

[clang] [ASTMatchers][NFC] improve 'isInteger' docs to show matching of unsigned (PR #147012)

2025-07-04 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/147012 None >From 5d172003421b0f45f2aeabb50f3890a3d98c8aa1 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Fri, 4 Jul 2025 10:36:38 +0300 Subject: [PATCH] [ASTMatchers][NFC] improve docs of 'isInteger' to show m

[clang-tools-extra] [clang-tidy] Add modernize-avoid-fundamental-integer-types (PR #146970)

2025-07-03 Thread Baranov Victor via cfe-commits
vbvictor wrote: > Decide whether to provide an autofix. I have chosen not to, because it will > depend on the context one is using a type in. I don't think we need any fixes for this check - it's a tricky field, and we should let the user decide how to resolve these warnings. > Decide whether

[clang-tools-extra] [clang-tidy] Fix false positives with template in `misc-unconventional-assign-operator` check (PR #143292)

2025-07-04 Thread Baranov Victor via cfe-commits
@@ -163,3 +163,16 @@ struct TemplateTypeAlias { Alias3 &operator=(double) { return *this; } // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: operator=() should return 'TemplateTypeAlias&' [misc-unconventional-assign-operator] }; + +namespace issue143237 { +template +struct B {

[clang-tools-extra] [clang-tidy] Fix false positives with template in `misc-unconventional-assign-operator` check (PR #143292)

2025-07-04 Thread Baranov Victor via cfe-commits
@@ -163,3 +163,16 @@ struct TemplateTypeAlias { Alias3 &operator=(double) { return *this; } // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: operator=() should return 'TemplateTypeAlias&' [misc-unconventional-assign-operator] }; + +namespace issue143237 { vbvic

<    5   6   7   8   9   10   11   12   13   >