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

2025-06-14 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor closed https://github.com/llvm/llvm-project/pull/143558 ___ 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] Warn about misuse of sizeof operator in loops. (PR #143205)

2025-06-12 Thread Baranov Victor via cfe-commits
@@ -164,6 +164,53 @@ int Test2(MyConstChar* A) { return sum; } +struct A { + int array[10]; +}; + +struct B { + struct A a; +}; + +void loop_access_elements(int num, struct B b) { +struct A arr[10]; +char buf[20]; + +// CHECK-MESSAGES: :[[@LINE+1]]:5: warning:

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

2025-06-13 Thread Baranov Victor via cfe-commits
@@ -164,6 +164,53 @@ int Test2(MyConstChar* A) { return sum; } +struct A { + int array[10]; +}; + +struct B { + struct A a; +}; + +void loop_access_elements(int num, struct B b) { +struct A arr[10]; +char buf[20]; + +// CHECK-MESSAGES: :[[@LINE+1]]:5: warning:

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

2025-06-13 Thread Baranov Victor via cfe-commits
@@ -353,6 +367,19 @@ void SizeofExpressionCheck::check(const MatchFinder::MatchResult &Result) { diag(E->getBeginLoc(), "suspicious usage of 'sizeof(char*)'; do you mean 'strlen'?") << E->getSourceRange(); + } else if (const auto *E = Result.Nodes.getNode

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

2025-06-13 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor deleted https://github.com/llvm/llvm-project/pull/143205 ___ 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] Warn about misuse of sizeof operator in loops. (PR #143205)

2025-06-13 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor deleted https://github.com/llvm/llvm-project/pull/143205 ___ 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] Warn about misuse of sizeof operator in loops. (PR #143205)

2025-06-13 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/143205 ___ 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] Warn about misuse of sizeof operator in loops. (PR #143205)

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

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

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

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

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

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

2025-06-13 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,65 @@ +// RUN: %check_clang_tidy -std=c++20-or-later %s performance-unnecessary-value-param %t -- -fix-errors vbvictor wrote: Do we need to have all 3 run commands? I suppose only 2 are needed, for `Coroutines = true` and `Coroutines = false` https:

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

2025-06-13 Thread Baranov Victor via cfe-commits
@@ -63,7 +65,11 @@ void UnnecessaryValueParamCheck::registerMatchers(MatchFinder *Finder) { Finder->addMatcher( traverse( TK_AsIs, - functionDecl(hasBody(stmt()), isDefinition(), unless(isImplicit()), + functionDecl(hasBody(IsAllowedInCorout

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

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

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

2025-06-13 Thread Baranov Victor via cfe-commits
@@ -63,7 +65,11 @@ void UnnecessaryValueParamCheck::registerMatchers(MatchFinder *Finder) { Finder->addMatcher( traverse( TK_AsIs, - functionDecl(hasBody(stmt()), isDefinition(), unless(isImplicit()), + functionDecl(hasBody(IsAllowedInCorout

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

2025-06-13 Thread Baranov Victor via cfe-commits
vbvictor wrote: Thank you for your long and detailed answer! Indeed, the check can benefit a lot from path-sensitive analysis: - Easier traversing with less boilerplate code. - Easier handling of edge-cases like struct fields and unions, support of local variables. - Fewer false-positives with

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

2025-06-14 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,208 @@ +//===--- 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-14 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,208 @@ +//===--- 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-14 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,208 @@ +//===--- 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-14 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,208 @@ +//===--- 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-14 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,208 @@ +//===--- 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-14 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,208 @@ +//===--- 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-14 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,208 @@ +//===--- 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-14 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/142324 ___ 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 performance-bool-bitwise-operation check (PR #142324)

2025-06-14 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/142324 ___ 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 performance-bool-bitwise-operation check (PR #142324)

2025-06-14 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,208 @@ +//===--- 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-14 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,208 @@ +//===--- 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-14 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,208 @@ +//===--- 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 new check `readability-use-numeric-limits` (PR #127430)

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,163 @@ +//===--- UseNumericLimitsCheck.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 `readability-use-numeric-limits` (PR #127430)

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -117,6 +117,13 @@ Improvements to clang-tidy New checks ^^ +- New :doc:`readability-use-numeric-limits vbvictor wrote: Please delete this entry, looks like wrong merge artifact https://github.com/llvm/llvm-project/pull/127430 _

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

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,163 @@ +//===--- UseNumericLimitsCheck.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 `readability-use-numeric-limits` (PR #127430)

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,31 @@ +.. title:: clang-tidy - readability-use-numeric-limits + +readability-use-numeric-limits +== + + Replaces certain integer literals with equivalent calls to + ``std::numeric_limits::min()`` or ``std::numeric_limits::max()``. ---

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

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,163 @@ +//===--- UseNumericLimitsCheck.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 `readability-use-numeric-limits` (PR #127430)

2025-06-15 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor deleted https://github.com/llvm/llvm-project/pull/127430 ___ 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-numeric-limits` (PR #127430)

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,163 @@ +//===--- UseNumericLimitsCheck.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] [Clang] Improve diagnostics for 'placement new' with const storage argument (PR #144270)

2025-06-15 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/144270 ___ 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-numeric-limits` (PR #127430)

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,163 @@ +//===--- UseNumericLimitsCheck.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 `readability-use-numeric-limits` (PR #127430)

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,163 @@ +//===--- UseNumericLimitsCheck.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 `readability-use-numeric-limits` (PR #127430)

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,163 @@ +//===--- UseNumericLimitsCheck.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 `readability-use-numeric-limits` (PR #127430)

2025-06-15 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor approved this pull request. LGTM, with few with nits https://github.com/llvm/llvm-project/pull/127430 ___ 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-numeric-limits` (PR #127430)

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,90 @@ +// RUN: %check_clang_tidy %s readability-use-numeric-limits %t +#include vbvictor wrote: Please don't use real headers for your test file. All you need is to mimic a small portion of `typedef`'s for `int8_t`, `uint8_t` etc.. Write them yourse

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

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,90 @@ +// RUN: %check_clang_tidy %s readability-use-numeric-limits %t +#include + vbvictor wrote: Please add CHECK-FIXES for the header you include (look at other tests for reference) https://github.com/llvm/llvm-project/pull/127430

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

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,38 @@ +//===--- UseNumericLimitsCheck.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 new check `readability-use-numeric-limits` (PR #127430)

2025-06-15 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/127430 ___ 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-numeric-limits` (PR #127430)

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,31 @@ +.. title:: clang-tidy - readability-use-numeric-limits + +readability-use-numeric-limits +== + +Replaces certain integer literals with equivalent calls to +``std::numeric_limits::min()`` or ``std::numeric_limits::max()``. -

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

2025-06-15 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/127430 ___ 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-numeric-limits` (PR #127430)

2025-06-15 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/127430 ___ 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-numeric-limits` (PR #127430)

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

[clang] [Clang] Improve diagnostics for 'placement new' with const storage argument (PR #144270)

2025-06-15 Thread Baranov Victor via cfe-commits
vbvictor wrote: Failed "[Test documentation build](https://github.com/llvm/llvm-project/actions/runs/15665481196/job/44129065574?pr=144270)" also fails without my commit, so it is unrelated https://github.com/llvm/llvm-project/pull/144270 ___ cfe-com

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

2025-06-13 Thread Baranov Victor via cfe-commits
@@ -353,6 +367,19 @@ void SizeofExpressionCheck::check(const MatchFinder::MatchResult &Result) { diag(E->getBeginLoc(), "suspicious usage of 'sizeof(char*)'; do you mean 'strlen'?") << E->getSourceRange(); + } else if (const auto *E = Result.Nodes.getNode

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

2025-06-13 Thread Baranov Victor via cfe-commits
@@ -164,6 +164,53 @@ int Test2(MyConstChar* A) { return sum; } +struct A { + int array[10]; +}; + +struct B { + struct A a; +}; + +void loop_access_elements(int num, struct B b) { +struct A arr[10]; +char buf[20]; + +// CHECK-MESSAGES: :[[@LINE+1]]:5: warning:

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

2025-06-13 Thread Baranov Victor via cfe-commits
@@ -316,3 +316,11 @@ Options When `true`, the check will warn on pointer arithmetic where the element count is obtained from a division with ``sizeof(...)``, e.g., ``Ptr + Bytes / sizeof(*T)``. Default is `true`. + +.. option:: WarnOnSizeOfInLoopTermination + + When

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

2025-06-13 Thread Baranov Victor via cfe-commits
@@ -353,6 +367,19 @@ void SizeofExpressionCheck::check(const MatchFinder::MatchResult &Result) { diag(E->getBeginLoc(), "suspicious usage of 'sizeof(char*)'; do you mean 'strlen'?") << E->getSourceRange(); + } else if (const auto *E = Result.Nodes.getNode

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

2025-06-13 Thread Baranov Victor via cfe-commits
@@ -219,6 +219,12 @@ Changes in existing checks tolerating fix-it breaking compilation when functions is used as pointers to avoid matching usage of functions within the current compilation unit. +- Improved :doc: `bugprone-sizeof-expression + ` check. + + Introduced WarnO

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

2025-06-13 Thread Baranov Victor via cfe-commits
@@ -164,6 +164,53 @@ int Test2(MyConstChar* A) { return sum; } +struct A { + int array[10]; +}; + +struct B { + struct A a; +}; + +void loop_access_elements(int num, struct B b) { +struct A arr[10]; +char buf[20]; + +// CHECK-MESSAGES: :[[@LINE+1]]:5: warning:

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

2025-06-13 Thread Baranov Victor via cfe-commits
vbvictor wrote: I agree that modelling `assert(sp.use_count() == 1);` is not easy in `clang-tidy` itself. In one of my checks I needed to check that two `declStmt` are placed one after another in `compoundStmt` and I ended up manually traversing all `stmt` within `compoundStmt` - not a very pl

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

2025-06-13 Thread Baranov Victor via cfe-commits
vbvictor wrote: Please ping me when you're done working and want to test CI build I need to approve every CI build/format run... not very convenient. https://github.com/llvm/llvm-project/pull/67467 ___ cfe-commits mailing list cfe-commits@lists.llvm.or

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

2025-06-13 Thread Baranov Victor via cfe-commits
@@ -132,8 +133,41 @@ void jump_out_backwards() { for (int j = 0; j < 10; ++j) { if (i * j > 80) goto before_the_loop; - // CHECK-NOTES: [[@LINE-1]]:9: warning: avoid using 'goto' for flow control - // CHECK-NOTES: [[@LINE-8]]:1: note: label defined

[clang] [Clang] Improve diagnostics for 'placement new' with const storage argument (PR #144270)

2025-06-15 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/144270 Before this patch, the following code gave misleading diagnostics about absence of `#include `: ```cpp struct X { int n; }; int foo() { const X cx = {5}; // error: no matching 'operator new' function for no

[clang] [Clang] Fix '-Wformat-overflow' FP when floats had field-width and plus prefix (PR #144274)

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

[clang] [Clang] Fix '-Wformat-overflow' FP when floats had field-width and plus prefix (PR #144274)

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

[clang] [Clang] Fix '-Wformat-overflow' FP when floats had field-width and plus prefix (PR #144274)

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

[clang] [Clang] Fix '-Wformat-overflow' FP when floats had field-width and plus prefix (PR #144274)

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

[clang] [Clang] Fix '-Wformat-overflow' FP when floats had field-width and plus prefix (PR #144274)

2025-06-26 Thread Baranov Victor via cfe-commits
@@ -43,6 +43,11 @@ void call_snprintf(double d, int n, int *ptr) { __builtin_snprintf(node_name, sizeof(node_name), "%pOFn", ptr); // nonkprintf-warning {{'snprintf' will always be truncated; specified size is 6, but format string expands to at least 7}} __builtin_snprintf

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

2025-06-26 Thread Baranov Victor via cfe-commits
vbvictor wrote: Ping @HerrCai0907 if you wish to re-review tests 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 false negatives with type aliases in `cppcoreguidlines-pro-bounds-pointer-arithmetic` check (PR #139430)

2025-06-26 Thread Baranov Victor via cfe-commits
vbvictor wrote: Ping, changes are quite easy https://github.com/llvm/llvm-project/pull/139430 ___ 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] [Modules] Skip checking decls in clang-tidy (PR #145630)

2025-06-26 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,29 @@ +// RUN: rm -fr %t vbvictor wrote: Test file should be placed inside `clang-tools-extra/test/clang-tidy/infrastructure` https://github.com/llvm/llvm-project/pull/145630 ___ cfe-commits mailing list cf

[clang] [clang-tools-extra] [clang-tidy] [Modules] Skip checking decls in clang-tidy (PR #145630)

2025-06-26 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/145630 ___ 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] [Modules] Skip checking decls in clang-tidy (PR #145630)

2025-06-26 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/145630 ___ 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] [Modules] Skip checking decls in clang-tidy (PR #145630)

2025-06-26 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor commented: > I think modules are not system headers. For the example in the issue, the > module interface is not system nor headers. It is another TU but we just can > get AST from it. Indeed, they are handled different. Left a minor comment. https://github.com/llv

[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 updated https://github.com/llvm/llvm-project/pull/145719 >From a4563c7adccfc8b9820413a7e0c5d86503b50add Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Wed, 25 Jun 2025 18:12:29 +0300 Subject: [PATCH 1/2] [analyzer][NFC] Fix clang-tidy warning and typos in Mallo

[clang] [Clang] Fix '-Wformat-overflow' FP when floats had field-width and plus prefix (PR #144274)

2025-06-26 Thread Baranov Victor via cfe-commits
@@ -43,6 +43,11 @@ void call_snprintf(double d, int n, int *ptr) { __builtin_snprintf(node_name, sizeof(node_name), "%pOFn", ptr); // nonkprintf-warning {{'snprintf' will always be truncated; specified size is 6, but format string expands to at least 7}} __builtin_snprintf

[clang-tools-extra] [clang-tidy] unnecessary-value-param: Allow moving of value arguments. (PR #145871)

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

[clang-tools-extra] [clang-tidy] unnecessary-value-param: Allow moving of value arguments. (PR #145871)

2025-06-26 Thread Baranov Victor via cfe-commits
vbvictor wrote: To sum up: With `std::move` it's 1 copy 1 move for lvalue or 1 move for rvalue With `const&` it's 1 copy for lvalue or rvalue small repro https://godbolt.org/z/EosczKoo7 For me it this patch adds inconsistency for the check: if we have ```cpp void NegativeMoved(ExpensiveToCopyTyp

[clang-tools-extra] [clang-tidy] unnecessary-value-param: Allow moving of value arguments. (PR #145871)

2025-06-26 Thread Baranov Victor via cfe-commits
vbvictor wrote: void NegativeMoved(ExpensiveToCopyType A) { ExpensiveToCopyType Copy = std::move(A); } https://github.com/llvm/llvm-project/pull/145871 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/lis

[clang-tools-extra] [clang-tidy] unnecessary-value-param: Allow moving of value arguments. (PR #145871)

2025-06-26 Thread Baranov Victor via cfe-commits
vbvictor wrote: Sorry for closing, My mouse slipped https://github.com/llvm/llvm-project/pull/145871 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] unnecessary-value-param: Allow moving of value arguments. (PR #145871)

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

[clang] [clang][analyzer] Fix the false positive ArgInitializedness warning on unnamed bit-field (PR #145066)

2025-06-27 Thread Baranov Victor via cfe-commits
vbvictor wrote: Please fix formatting issues. For first-time contributors, build workflows don't run automatically, members need to start them on each commit manually. https://github.com/llvm/llvm-project/pull/145066 ___ cfe-commits mailing list cfe-

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

2025-06-27 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor closed https://github.com/llvm/llvm-project/pull/145719 ___ 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
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 __

<    4   5   6   7   8   9   10   11   12   13   >