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

2025-03-11 Thread Baranov Victor via cfe-commits
@@ -91,8 +91,12 @@ struct MatchBuilder { auto matchMathCall(const StringRef FunctionName, const Matcher ArgumentMatcher) const { +auto HasAnyPrecisionName = +anyOf(hasName(FunctionName), hasName((FunctionName + "l").str()), v

[clang-tools-extra] [clang-tidy] support pointee mutation check in misc-const-correctness (PR #130494)

2025-03-11 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,50 @@ +// RUN: %check_clang_tidy %s misc-const-correctness %t \ vbvictor wrote: Consider adding a test with both `WarnPointersAsValues` and `WarnPointersAsPointers` set to `true`. According to the code it should add two `const` keywords. https://gith

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

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

[clang-tools-extra] [clang-tidy] support pointee mutation check in misc-const-correctness (PR #130494)

2025-03-11 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,50 @@ +// RUN: %check_clang_tidy %s misc-const-correctness %t \ vbvictor wrote: I suppose this behavior comes from overlapping diag-messages, so guess we need to change diag-message inside `CheckPointee` lambda. https://github.com/llvm/llvm-project/p

[clang-tools-extra] [clang-tidy] support pointee mutation check in misc-const-correctness (PR #130494)

2025-03-11 Thread Baranov Victor via cfe-commits
@@ -145,64 +165,90 @@ void ConstCorrectnessCheck::check(const MatchFinder::MatchResult &Result) { if (ArrayT->getElementType()->isPointerType()) VC = VariableCategory::Pointer; - // Each variable can only be in one category: Value, Pointer, Reference. - // Analysi

[clang-tools-extra] [clang-tidy] support pointee mutation check in misc-const-correctness (PR #130494)

2025-03-11 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,50 @@ +// RUN: %check_clang_tidy %s misc-const-correctness %t \ vbvictor wrote: I tried running test on small code with both of the options enabled. ```cpp int a[] = {1, 2}; int *p_local0 = &a[0]; ``` transformed to ```cpp int a[] = {1, 2}; int

[clang-tools-extra] [clang-tidy] Fix invalid fixit from modernize-use-ranges for nullptr used with std::unique_ptr (PR #127162)

2025-02-28 Thread Baranov Victor via cfe-commits
vbvictor wrote: > I‘m sorry for requesting approval again. But I'm really confused that should > I make sure my branch is alwasy up-to-date? Rebase from `main` periodically, at least before merge. It's just to make sure that there are no merge conflicts. https://github.com/llvm/llvm-project/pu

[clang-tools-extra] [clang-tidy] detect arithmetic operations within member list initialization in modernize-use-default-member-init check (PR #129370)

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

[clang-tools-extra] [clang-tidy] detect arithmetic operations within member list initialization in modernize-use-default-member-init check (PR #129370)

2025-03-01 Thread Baranov Victor via cfe-commits
@@ -202,7 +208,13 @@ void UseDefaultMemberInitCheck::registerMatchers(MatchFinder *Finder) { unaryOperator(hasAnyOperatorName("+", "-"), hasUnaryOperand(floatLiteral())), cxxBoolLiteral(), cxxNullPtrLiteralExpr(), implicitValue

[clang-tools-extra] [clang-tidy]: `misc-unused-using-decls`: add correct handling of `operator""` with template parametes (PR #129392)

2025-03-01 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/129392 Fixes false-positives when operator"" has template paremetes, e.g. ```cpp template int operator""_r() { return {}; } ``` >From eac5105574e6144eb702e75b21d00203706c6ada Mon Sep 17 00:00:00 2001 From:

[clang-tools-extra] [clang-tidy] `misc-unused-using-decls`: add correct handling of `operator""` with template parametes (PR #129392)

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

[clang-tools-extra] [clang-tidy]: `misc-unused-using-decls`: add correct handling of `operator""` with template parametes (PR #129392)

2025-03-01 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/129392 ___ 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 performance-unnecessary-value-param performance (PR #128383)

2025-03-01 Thread Baranov Victor via cfe-commits
@@ -110,6 +110,11 @@ Changes in existing checks ` check by providing additional examples and fixing some macro related false positives. +- Improved :doc:`performance/unnecessary-value-param vbvictor wrote: nit: `performance/unnecessary-value-param` should

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

2025-03-01 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/126434 >From 2c2738704e5fd2e402b75021341a47413e6bfe39 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sat, 1 Mar 2025 18:11:30 +0300 Subject: [PATCH] add scoped-lock-check --- .../clang-tidy/modernize/CMakeLists

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

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

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

2025-03-13 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,326 @@ +//===--- 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] 'modernize-use-starts-ends-with': fixed false positives on `find` and `rfind` (PR #129564)

2025-03-05 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/129564 >From c3f21bb654d2980955f2c37a5dc7a02a1ced7891 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Mon, 3 Mar 2025 21:00:32 +0300 Subject: [PATCH 1/4] [clang-tidy] fixed false positives on find and rfind ---

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

2025-03-05 Thread Baranov Victor via cfe-commits
@@ -261,6 +273,9 @@ void test(std::string s, std::string_view sv, sub_string ss, sub_sub_string sss, #define STRING s if (0 == STRING.find("ala")) { /* do something */} + + s.find("aaa", 0, 3) == 0; + s.rfind("aaa", std::string::npos, 3) == 0; vbvictor

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-03-05 Thread Baranov Victor via cfe-commits
vbvictor wrote: Since all approved are made, can we land this PR? @HerrCai0907 https://github.com/llvm/llvm-project/pull/121291 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-03-05 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/129564 >From c3f21bb654d2980955f2c37a5dc7a02a1ced7891 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Mon, 3 Mar 2025 21:00:32 +0300 Subject: [PATCH 1/2] [clang-tidy] fixed false positives on find and rfind ---

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

2025-03-05 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/129564 >From c3f21bb654d2980955f2c37a5dc7a02a1ced7891 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Mon, 3 Mar 2025 21:00:32 +0300 Subject: [PATCH 1/3] [clang-tidy] fixed false positives on find and rfind ---

[clang-tools-extra] [clang-tidy] support pointee mutation check in misc-const-correctness (PR #130494)

2025-03-12 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor approved this pull request. LGTM, few nits Please remove limitation from `const-correctness.rst` that says check can not analyze pointers. It starts with "Pointees can not be analyzed for constness yet." https://github.com/llvm/llvm-project/pull/130494 _

[clang-tools-extra] [clang-tidy] support pointee mutation check in misc-const-correctness (PR #130494)

2025-03-12 Thread Baranov Victor via cfe-commits
@@ -125,6 +132,22 @@ Options // No warning const int *const pointer_variable = &value; +.. option:: WarnPointersAsPointers + + This option enables the suggestion for ``const`` of the value pointing. vbvictor wrote: ```suggestion This option enables

[clang-tools-extra] [clang-tidy] support pointee mutation check in misc-const-correctness (PR #130494)

2025-03-12 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/130494 ___ 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 invalid fixit from modernize-use-ranges for nullptr used with std::unique_ptr (PR #127162)

2025-02-14 Thread Baranov Victor via cfe-commits
@@ -109,6 +109,9 @@ Changes in existing checks - Improved :doc:`misc-redundant-expression ` check by providing additional examples and fixing some macro related false positives. + +- Fixed a false positive in :doc:`modernize-use-ranges vbvictor wrote: ``

[clang-tools-extra] [clang-tidy] Fix invalid fixit from modernize-use-ranges for nullptr used with std::unique_ptr (PR #127162)

2025-02-14 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/127162 ___ 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 invalid fixit from modernize-use-ranges for nullptr used with std::unique_ptr (PR #127162)

2025-02-14 Thread Baranov Victor via cfe-commits
@@ -109,6 +109,9 @@ Changes in existing checks - Improved :doc:`misc-redundant-expression ` check by providing additional examples and fixing some macro related false positives. + +- Fixed a false positive in :doc:`modernize-use-ranges + `update the logic to suppress wa

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

2025-02-12 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/122951 >From 899a4d3e79b0b9f2c8c156624ebbf94f50696b61 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Tue, 14 Jan 2025 22:05:43 +0300 Subject: [PATCH 1/9] [clang-tidy] add AllowedTypes to misc-const-correctness -

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-17 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/121291 >From 42e03bb9cc9bd815476b0a3f06ac5f58826e3708 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Fri, 31 Jan 2025 19:29:05 +0300 Subject: [PATCH 1/3] [clang-tidy] add new check bugprone-reset-ambiguous-call

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

2025-02-17 Thread Baranov Victor via cfe-commits
vbvictor wrote: If you squash commits solely for merging into main - there is no need for it since they will be squashed automatically. https://github.com/llvm/llvm-project/pull/126897 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://li

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-19 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/121291 ___ 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 bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-21 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,130 @@ +//===--- AmbiguousSmartptrResetCallCheck.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 bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-21 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,130 @@ +//===--- AmbiguousSmartptrResetCallCheck.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-02-21 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,164 @@ +//===--- 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: modernize-use-scoped-lock (PR #126434)

2025-02-21 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/126434 >From 92588a7eb3f87e74887e94f88d3402ec25c6ee53 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sun, 9 Feb 2025 22:34:26 +0300 Subject: [PATCH 1/8] [clang-tidy] add modernize-use-scoped-lock check --- .../

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

2025-02-21 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,39 @@ +//===--- 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-02-21 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,39 @@ +//===--- 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-02-21 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,39 @@ +//===--- 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: modernize-use-scoped-lock (PR #126434)

2025-02-21 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/126434 >From 92588a7eb3f87e74887e94f88d3402ec25c6ee53 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sun, 9 Feb 2025 22:34:26 +0300 Subject: [PATCH 1/9] [clang-tidy] add modernize-use-scoped-lock check --- .../

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

2025-02-21 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,84 @@ +// RUN: %check_clang_tidy %s readability-use-numeric-limits %t +#include + +void constants() { + // CHECK-MESSAGES: :[[@LINE+2]]:14: warning: The constant -128 is being utilized. Consider using std::numeric_limits::min() instead [readability-use-numeric-limit

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-20 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/121291 >From 42e03bb9cc9bd815476b0a3f06ac5f58826e3708 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Fri, 31 Jan 2025 19:29:05 +0300 Subject: [PATCH 1/6] [clang-tidy] add new check bugprone-reset-ambiguous-call

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-20 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,49 @@ +.. title:: clang-tidy - readability-ambiguous-smartptr-reset-call + +readability-ambiguous-smartptr-reset-call += + +Finds potentially erroneous calls to ``reset`` method on smart pointers when +the pointee type also has a

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-21 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/121291 >From 42e03bb9cc9bd815476b0a3f06ac5f58826e3708 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Fri, 31 Jan 2025 19:29:05 +0300 Subject: [PATCH 1/7] [clang-tidy] add new check bugprone-reset-ambiguous-call

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

2025-02-21 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,84 @@ +// RUN: %check_clang_tidy %s readability-use-numeric-limits %t +#include + +void constants() { + // CHECK-MESSAGES: :[[@LINE+2]]:14: warning: The constant -128 is being utilized. Consider using std::numeric_limits::min() instead [readability-use-numeric-limit

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-22 Thread Baranov Victor via cfe-commits
vbvictor wrote: @PiotrZSL, @denzor200 I think we should provide 100% valid fix-its for default `SmartPointers`. That will be `std::shared_ptr`, `std::unique_ptr`, `boost::shared_ptr`. I created a note in docs that warns users about inconvenience that can happen when non-default smart pointers

[clang-tools-extra] [clang-tidy][NFC][docs] Use single tick for 'false' and 'true' values in options (PR #128362)

2025-02-22 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/128362 Unify doc style for options that use `true` or `false` as default values. >From 41807b8f379a19714fb89b2f13bc3af389c44ac0 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sat, 22 Feb 2025 17:26:52 +0300 Subj

[clang-tools-extra] [clang-tidy][NFC][docs] Use single tick for 'false' and 'true' values in options (PR #128362)

2025-02-22 Thread Baranov Victor via cfe-commits
vbvictor wrote: @EugeneZelenko @HerrCai0907, Small change to docs of some checks. https://github.com/llvm/llvm-project/pull/128362 ___ 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][docs] Use single tick for 'false' and 'true' values in options (PR #128362)

2025-02-22 Thread Baranov Victor via cfe-commits
vbvictor wrote: Thanks for fast approval! @HerrCai0907, Could you merge, please. https://github.com/llvm/llvm-project/pull/128362 ___ 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 bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-22 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/121291 >From 42e03bb9cc9bd815476b0a3f06ac5f58826e3708 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Fri, 31 Jan 2025 19:29:05 +0300 Subject: [PATCH 1/8] [clang-tidy] add new check bugprone-reset-ambiguous-call

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

2025-02-22 Thread Baranov Victor via cfe-commits
vbvictor wrote: I changed option name from `WarnOnlyOnMultipleLocks` to `WarnOnSingleLocks`. I think for users, it will be more clear what they turn on/off. When having `WarnOnlyOnMultipleLocks` together with `WarnOnUsingAndTypedef` option, it is confusing whether first option will disable war

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-23 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,57 @@ +.. title:: clang-tidy - readability-ambiguous-smartptr-reset-call + +readability-ambiguous-smartptr-reset-call += + +Finds potentially erroneous calls to ``reset`` method on smart pointers when +the pointee type also has a

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-23 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,57 @@ +.. title:: clang-tidy - readability-ambiguous-smartptr-reset-call + +readability-ambiguous-smartptr-reset-call += + +Finds potentially erroneous calls to ``reset`` method on smart pointers when +the pointee type also has a

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-23 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/121291 ___ 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 bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-26 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,68 @@ +// RUN: %check_clang_tidy %s readability-ambiguous-smartptr-reset-call %t \ vbvictor wrote: I'd prefer to leave two separate files, they are easier to read and maintain imho. https://github.com/llvm/llvm-project/pull/121291 ___

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-26 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,129 @@ +//===--- AmbiguousSmartptrResetCallCheck.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 bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-26 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/121291 ___ 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-02-26 Thread Baranov Victor via cfe-commits
vbvictor wrote: Ping https://github.com/llvm/llvm-project/pull/126434 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

2025-03-22 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,342 @@ +//===--- UseScopedLockCheck.cpp - clang-tidy --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang-tools-extra] [clang-tidy] Fixed bugprone-non-zero-enum-to-bool-conversion (PR #131407)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[clang-tools-extra] [clang-tidy] Add check bugprone-misleading-setter-of-reference (PR #132242)

2025-05-07 Thread Baranov Victor via cfe-commits
=?utf-8?q?Balázs_Kéri?= , =?utf-8?q?Balázs_Kéri?= , =?utf-8?q?Balázs_Kéri?= , =?utf-8?q?Balázs_Kéri?= , =?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: @@ -0,0 +1,58 @@ +//===--- MisleadingSetterOfReferenceCheck.cpp - clang-tidy-===// +// +// Part of the LLVM

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

2025-05-09 Thread Baranov Victor via cfe-commits
@@ -198,7 +203,7 @@ Changes in existing checks diagnosing designated initializers for ``std::array`` initializations. - Improved :doc:`modernize-use-ranges - ` check by updating suppress + ` check by updating suppress vbvictor wrote: Unrelated change? I'

[clang-tools-extra] Fix the issue #139467 ([clang-tidy] false positive narrowing conversion) (PR #139474)

2025-05-12 Thread Baranov Victor via cfe-commits
@@ -554,15 +554,23 @@ bool NarrowingConversionsCheck::handleConditionalOperator( // We have an expression like so: `output = cond ? lhs : rhs` // From the point of view of narrowing conversion we treat it as two // expressions `output = lhs` and `output = rhs`. -

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

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

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

2025-05-09 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,13 @@ +// RUN: %check_clang_tidy -std=c++11-or-later %s cppcoreguidelines-use-enum-class %t -- -config="{CheckOptions: {cppcoreguidelines-use-enum-class.IgnoreUnscopedEnumsInClasses: true}}" -- + +enum E {}; +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: enum 'E' is uns

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

2025-05-09 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 'modernize-use-enum-class' (PR #138282)

2025-05-09 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor commented: Mostly nits and documentation suggestions/improvements. 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-

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

2025-05-09 Thread Baranov Victor via cfe-commits
@@ -211,6 +211,7 @@ Clang-Tidy Checks :doc:`cppcoreguidelines-rvalue-reference-param-not-moved `, :doc:`cppcoreguidelines-slicing `, :doc:`cppcoreguidelines-special-member-functions `, + :doc:`cppcoreguidelines-use-enum-class `, "Yes" vbvictor wro

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

2025-05-09 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,13 @@ +// RUN: %check_clang_tidy -std=c++11-or-later %s cppcoreguidelines-use-enum-class %t -- -config="{CheckOptions: {cppcoreguidelines-use-enum-class.IgnoreUnscopedEnumsInClasses: true}}" -- + +enum E {}; +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: enum 'E' is uns

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

2025-05-09 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,31 @@ +.. title:: clang-tidy - cppcoreguidelines-use-enum-class + +cppcoreguidelines-use-enum-class += + +Finds plain non-class ``enum`` definitions that could use ``enum class``. + +This check implements `Enum.3 +

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

2025-05-09 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,31 @@ +.. title:: clang-tidy - cppcoreguidelines-use-enum-class + +cppcoreguidelines-use-enum-class += + +Finds plain non-class ``enum`` definitions that could use ``enum class``. + +This check implements `Enum.3 +

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

2025-05-09 Thread Baranov Victor via cfe-commits
@@ -136,6 +136,11 @@ New checks Finds potentially erroneous calls to ``reset`` method on smart pointers when the pointee type also has a ``reset`` method. +- New :doc:`cppcoreguidelines-use-enum-class vbvictor wrote: Please make in alphabetical order htt

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

2025-05-09 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,13 @@ +// RUN: %check_clang_tidy -std=c++11-or-later %s cppcoreguidelines-use-enum-class %t -- -config="{CheckOptions: {cppcoreguidelines-use-enum-class.IgnoreUnscopedEnumsInClasses: true}}" -- vbvictor wrote: nit: for readability, please break this

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

2025-05-09 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,31 @@ +.. title:: clang-tidy - cppcoreguidelines-use-enum-class + +cppcoreguidelines-use-enum-class += + +Finds plain non-class ``enum`` definitions that could use ``enum class``. vbvictor wrote: ```suggestion Finds unscoped

<    1   2   3   4   5   6   7   8   9   10   >