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

2025-06-20 Thread Baranov Victor via cfe-commits
vbvictor wrote: > Generalizing this check to enforce either static or anonymous namespaces > would be great There is a check [misc-use-anonymous-namespace](https://clang.llvm.org/extra/clang-tidy/checks/misc/use-anonymous-namespace.html) that suggests converting `static` to anon namespace, so

[clang-tools-extra] [clang-tidy] Add option to keep virtual in 'modernize-use-override' (PR #144916)

2025-06-19 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,25 @@ +// RUN: %check_clang_tidy %s modernize-use-override %t -- \ +// RUN: -config="{CheckOptions: {modernize-use-override.AllowVirtual: true}}" + +struct Base { + virtual ~Base(); + virtual void a(); + virtual void b(); + virtual void c(); +}; + +struct Derived

[clang-tools-extra] [clang-tidy] Add option to keep virtual in 'modernize-use-override' (PR #144916)

2025-06-19 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,25 @@ +// RUN: %check_clang_tidy %s modernize-use-override %t -- \ +// RUN: -config="{CheckOptions: {modernize-use-override.AllowVirtual: true}}" + +struct Base { + virtual ~Base(); + virtual void a(); + virtual void b(); + virtual void c(); +}; + +struct Derived

[clang-tools-extra] [clang-tidy] Add option to keep virtual in 'modernize-use-override' (PR #144916)

2025-06-19 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,25 @@ +// RUN: %check_clang_tidy %s modernize-use-override %t -- \ +// RUN: -config="{CheckOptions: {modernize-use-override.AllowVirtual: true}}" + +struct Base { + virtual ~Base(); + virtual void a(); + virtual void b(); + virtual void c(); +}; + +struct Derived

[clang-tools-extra] [clang-tidy] Add option to keep virtual in 'modernize-use-override' (PR #144916)

2025-06-19 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor requested changes to this pull request. Please add your change to ReleaseNotes.rst https://github.com/llvm/llvm-project/pull/144916 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mail

[clang-tools-extra] [clang-tidy] Add option to keep virtual in 'modernize-use-override' (PR #144916)

2025-06-19 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/144916 ___ 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-06-19 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/126434 >From 81a21a90e03e4b9cea58d6bcffddf3bde0f82710 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Mon, 3 Mar 2025 09:25:03 +0300 Subject: [PATCH 01/13] [clang-tidy] add scoped-lock-check --- .../clang-tidy/m

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

2025-06-18 Thread Baranov Victor via cfe-commits
vbvictor wrote: > Could you add some separate tests for this diagnostic? I've added tests with: - with template functions - deeper nesting - multiple exceptions throw (as for now, it reports for only one, and I'd like to leave it for first iteration) If there are any more tests that I should,

[clang-tools-extra] [clang-tidy] support query based custom check (PR #131804)

2025-06-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,63 @@ + +Query Based Custom Clang-Tidy Checks + + +Introduction + + +This page provides examples of how to add query based custom checks for +:program:`clang-tidy`. + +Custom checks are

[clang-tools-extra] [clang-tidy] support query based custom check (PR #131804)

2025-06-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,146 @@ +//===--- QueryCheck.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] support query based custom check (PR #131804)

2025-06-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,63 @@ + +Query Based Custom Clang-Tidy Checks + + +Introduction + + +This page provides examples of how to add query based custom checks for +:program:`clang-tidy`. + +Custom checks are

[clang-tools-extra] [clang-tidy] support query based custom check (PR #131804)

2025-06-18 Thread Baranov Victor via cfe-commits
@@ -292,6 +293,8 @@ An overview of all the command-line options: Checks - Same as '--checks'. Additionally, the list of globs can be specified as a list instead of a string. +C

[clang-tools-extra] [clang-tidy] support query based custom check (PR #131804)

2025-06-18 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/131804 ___ 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 query based custom check (PR #131804)

2025-06-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,63 @@ + +Query Based Custom Clang-Tidy Checks + + +Introduction + + +This page provides examples of how to add query based custom checks for +:program:`clang-tidy`. + +Custom checks are

[clang-tools-extra] [clang-tidy] support query based custom check (PR #131804)

2025-06-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,63 @@ + +Query Based Custom Clang-Tidy Checks + + +Introduction + + +This page provides examples of how to add query based custom checks for +:program:`clang-tidy`. + +Custom checks are

[clang-tools-extra] [clang-tidy] support query based custom check (PR #131804)

2025-06-18 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor commented: Mostly docs suggestions. I like this approach with config file, but don't have a strong opinion for now, so LGTM without explicit approval. https://github.com/llvm/llvm-project/pull/131804 ___ cfe-commits mailing

[clang-tools-extra] [clang-tidy] support query based custom check (PR #131804)

2025-06-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,63 @@ + +Query Based Custom Clang-Tidy Checks + + +Introduction + + +This page provides examples of how to add query based custom checks for +:program:`clang-tidy`. + +Custom checks are

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

2025-06-18 Thread Baranov Victor via cfe-commits
vbvictor wrote: Ping @HerrCai0907 @PiotrZSL @carlosgalvezp 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] fix false negatives with type aliases in `cppcoreguidlines-pro-bounds-pointer-arithmetic` check (PR #139430)

2025-06-18 Thread Baranov Victor via cfe-commits
vbvictor wrote: rebased + ping 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-tools-extra] [clang-tidy] fix false negatives with type aliases in `cppcoreguidlines-pro-bounds-pointer-arithmetic` check (PR #139430)

2025-06-18 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/139430 >From a5e4fbcf644279ad002f55f9f6ed506d7ab764a4 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-tools-extra] [clang-tidy] add new check: modernize-use-scoped-lock (PR #126434)

2025-06-17 Thread Baranov Victor via cfe-commits
vbvictor wrote: Rebased + ping @PiotrZSL. I'd merge it at the end of the month if there would be no more reviews. https://github.com/llvm/llvm-project/pull/126434 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/ma

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

2025-06-17 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/126434 >From 81a21a90e03e4b9cea58d6bcffddf3bde0f82710 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] [Clang] Fix '-Wformat-overflow' FP when floats had field-width and plus prefix (PR #144274)

2025-06-17 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-17 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/144274 >From 98fc81696400be2ea990d867375530ef3f544b82 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sun, 15 Jun 2025 22:20:54 +0300 Subject: [PATCH 1/3] [Clang] Fix '-Wformat-overflow' FP when floats had field-

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

2025-06-17 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-17 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] Added bugprone-unsequenced-global-accesses check (PR #130421)

2025-06-17 Thread Baranov Victor via cfe-commits
vbvictor wrote: > Should I close this PR, and open a new one when I'm ready with the CSA > checker? To keep everything organized, I'd suggest creating a new branch for CSA checker and close this PR (you can always reopen it later). For the CSA part, you can start by reading [this developer g

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

2025-06-16 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/144274 >From 98fc81696400be2ea990d867375530ef3f544b82 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sun, 15 Jun 2025 22:20:54 +0300 Subject: [PATCH 1/2] [Clang] Fix '-Wformat-overflow' FP when floats had field-

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

2025-06-16 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-16 Thread Baranov Victor via cfe-commits
@@ -36,6 +37,8 @@ class PerformanceModule : public ClangTidyModule { public: void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { CheckFactories.registerCheck("performance-avoid-endl"); +CheckFactories.registerCheck( +"performance-bool-bi

[clang-tools-extra] [clang-tidy] support query based custom check (PR #131804)

2025-06-16 Thread Baranov Victor via cfe-commits
@@ -104,7 +104,14 @@ Improvements to clang-tidy clauses. Added a ``--match-partial-fixes`` option to keep previous behavior on specific tests. This may break tests for users with custom out-of-tree checks who use :program:`check_clang_tidy.py` as-is. - +- :program:`clang

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

2025-06-16 Thread Baranov Victor via cfe-commits
vbvictor wrote: > At the moment of the previous PR, there was a concern about configurability > of check I think I was about adding an option to configure list of optional classes. Probably `OptionalClasses` or similar. I haven't seen issues about it, so it may not be a high priority. https:/

[clang-tools-extra] [clang-tidy] support query based custom check (PR #131804)

2025-06-16 Thread Baranov Victor via cfe-commits
@@ -104,7 +104,14 @@ Improvements to clang-tidy clauses. Added a ``--match-partial-fixes`` option to keep previous behavior on specific tests. This may break tests for users with custom out-of-tree checks who use :program:`check_clang_tidy.py` as-is. - +- :program:`clang

[clang-tools-extra] [clang-tidy] support query based custom check (PR #131804)

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,111 @@ +//===--- QueryCheck.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] support query based custom check (PR #131804)

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -53,6 +53,11 @@ LLVM_INSTANTIATE_REGISTRY(clang::tidy::ClangTidyModuleRegistry) namespace clang::tidy { +namespace custom { +extern void registerCustomChecks(ClangTidyOptions const &O, vbvictor wrote: ```suggestion extern void registerCustomChecks(const

[clang-tools-extra] [clang-tidy] support query based custom check (PR #131804)

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,111 @@ +//===--- QueryCheck.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] support query based custom check (PR #131804)

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,111 @@ +//===--- QueryCheck.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] support query based custom check (PR #131804)

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,50 @@ +#include "../ClangTidy.h" +#include "../ClangTidyModule.h" +#include "../ClangTidyModuleRegistry.h" +#include "../ClangTidyOptions.h" +#include "QueryCheck.h" +#include "llvm/ADT/SmallSet.h" +#include "llvm/ADT/SmallString.h" +#include "llvm/ADT/StringRef.h" +#in

[clang-tools-extra] [clang-tidy] support query based custom check (PR #131804)

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,111 @@ +//===--- QueryCheck.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] support query based custom check (PR #131804)

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -62,6 +62,8 @@ class ClangTidyCheckFactories { }); } + void erase(llvm::StringRef CheckName) { Factories.erase(CheckName); } vbvictor wrote: ```suggestion void eraseCheck(llvm::StringRef CheckName) { Factories.erase(CheckName)

[clang-tools-extra] [clang-tidy] support query based custom check (PR #131804)

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -104,7 +104,14 @@ Improvements to clang-tidy clauses. Added a ``--match-partial-fixes`` option to keep previous behavior on specific tests. This may break tests for users with custom out-of-tree checks who use :program:`check_clang_tidy.py` as-is. - +- :program:`clang

[clang-tools-extra] [clang-tidy] support query based custom check (PR #131804)

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,111 @@ +//===--- QueryCheck.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] support query based custom check (PR #131804)

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -17,6 +18,7 @@ #include "llvm/Support/MemoryBufferRef.h" #include "llvm/Support/VirtualFileSystem.h" #include +#include vbvictor wrote: Is this include needed? https://github.com/llvm/llvm-project/pull/131804 _

[clang-tools-extra] [clang-tidy] support query based custom check (PR #131804)

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,111 @@ +//===--- QueryCheck.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] support query based custom check (PR #131804)

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,50 @@ +#include "../ClangTidy.h" +#include "../ClangTidyModule.h" +#include "../ClangTidyModuleRegistry.h" +#include "../ClangTidyOptions.h" +#include "QueryCheck.h" +#include "llvm/ADT/SmallSet.h" +#include "llvm/ADT/SmallString.h" +#include "llvm/ADT/StringRef.h" +#in

[clang-tools-extra] [clang-tidy] support query based custom check (PR #131804)

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,50 @@ +#include "../ClangTidy.h" +#include "../ClangTidyModule.h" +#include "../ClangTidyModuleRegistry.h" +#include "../ClangTidyOptions.h" +#include "QueryCheck.h" +#include "llvm/ADT/SmallSet.h" +#include "llvm/ADT/SmallString.h" +#include "llvm/ADT/StringRef.h" +#in

[clang-tools-extra] [clang-tidy] support query based custom check (PR #131804)

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,63 @@ + +Query Based Custom Clang-Tidy Checks + + +Introduction + + +This page provides examples of how to add query based custom checks for +:program:`clang-tidy`. + +Custom checks are

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

2025-06-15 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/3] [clang-tidy] add 'IgnoreMarcos' option to 'avoid-goto' ch

[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 updated https://github.com/llvm/llvm-project/pull/144270 >From 07392e16740d3d89700da43e22b4d90197bb4d4a Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sun, 15 Jun 2025 19:56:05 +0300 Subject: [PATCH 1/2] [Clang] Improve diagnostics when 'placement new' was call

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

2025-06-15 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-tools-extra] [clang-tidy] add 'IgnoreMarcos' option to 'avoid-goto' check (PR #143554)

2025-06-15 Thread Baranov Victor via cfe-commits
@@ -50,3 +50,12 @@ Modern C++ needs ``goto`` only to jump out of nested loops. some_operation(); All other uses of ``goto`` are diagnosed in `C++`. + + +Options +--- + +.. option:: IgnoreMacros + + If set to `true`, the check will not warn if both label and ``goto`` +

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

2025-06-15 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/144274 If field width is specified, the sign/space is already accounted for within the field width, so no additional size is needed. Fixes https://github.com/llvm/llvm-project/issues/143951. >From 98fc81696400be2ea9

[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-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-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,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
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,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
@@ -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,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] [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] [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-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 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,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
@@ -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 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 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] Fix false positives with template in `misc-unconventional-assign-operator` check (PR #143292)

2025-06-14 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/143292 ___ 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-infinite-loop` check by adding handing for structured bindings (PR #144213)

2025-06-14 Thread Baranov Victor via cfe-commits
@@ -215,10 +236,18 @@ static bool overlap(ArrayRef SCC, /// returns true iff `Cond` involves at least one static local variable. static bool hasStaticLocalVariable(const Stmt *Cond) { - if (const auto *DRE = dyn_cast(Cond)) + if (const auto *DRE = dyn_cast(Cond)) { if (

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

2025-06-14 Thread Baranov Victor via cfe-commits
@@ -83,6 +83,23 @@ static bool isVarThatIsPossiblyChanged(const Decl *Func, const Stmt *LoopStmt, isChanged(LoopStmt, Var, Context); // FIXME: Track references. } + +if (const auto *BD = dyn_cast(DRE->getDecl())) { + if (const auto *DD = +

[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-tools-extra] [clang-tidy] Add bugprone-move-shared-pointer-contents check. (PR #67467)

2025-06-14 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/67467 ___ 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-move-shared-pointer-contents check. (PR #67467)

2025-06-14 Thread Baranov Victor via cfe-commits
@@ -148,6 +148,12 @@ New checks Finds potentially erroneous calls to ``reset`` method on smart pointers when the pointee type also has a ``reset`` method. +- New :doc:`bugprone-move-shared-pointer-contents vbvictor wrote: Please place in alphabetical orde

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

2025-06-14 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,137 @@ +//===--- MoveSharedPointerContentsCheck.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-move-shared-pointer-contents check. (PR #67467)

2025-06-14 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,137 @@ +//===--- MoveSharedPointerContentsCheck.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 '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-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 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] properly handle private move constructors in `modernize-pass-by-value` check (PR #141304)

2025-06-13 Thread Baranov Victor via cfe-commits
vbvictor wrote: Ping https://github.com/llvm/llvm-project/pull/141304 ___ 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-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][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

  1   2   3   4   5   6   7   8   9   >