[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
@@ -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,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-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-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] 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-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-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] [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
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-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,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 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
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
@@ -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
@@ -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] 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] 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] [Clang] Improve diagnostics for 'placement new' with const storage argument (PR #144270)

2025-06-22 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/3] [Clang] Improve diagnostics when 'placement new' was call

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

2025-06-22 Thread Baranov Victor via cfe-commits
@@ -2753,10 +2753,18 @@ static bool resolveAllocationOverloadInterior( if (Diagnose) { // If this is an allocation of the form 'new (p) X' for some object // pointer p (or an expression that will decay to such a pointer), - // diagnose the missing inclusion

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

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

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

2025-06-24 Thread Baranov Victor via cfe-commits
@@ -1518,14 +1518,19 @@ void MallocChecker::checkGetdelim(ProgramStateRef State, const CallEvent &Call, if (!CE) return; - const auto LinePtr = - getPointeeVal(Call.getArgSVal(0), State)->getAs(); - const auto Size = - getPointeeVal(Call.getArgSVal(1), State

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

2025-06-24 Thread Baranov Victor via cfe-commits
@@ -1518,14 +1518,19 @@ void MallocChecker::checkGetdelim(ProgramStateRef State, const CallEvent &Call, if (!CE) return; - const auto LinePtr = - getPointeeVal(Call.getArgSVal(0), State)->getAs(); - const auto Size = - getPointeeVal(Call.getArgSVal(1), State

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

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

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

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

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

2025-06-24 Thread Baranov Victor via cfe-commits
vbvictor wrote: Also updated names of function in `MallocChecker` to match corresponding functions names in `UnixApiChecker` https://github.com/llvm/llvm-project/pull/145229 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.or

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

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

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

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

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

2025-06-24 Thread Baranov Victor via cfe-commits
vbvictor wrote: > I would prefer keeping this bugfix and that internal architectural > improvement in two separate commits if that isn't too much trouble. Yes, making `Signature` class should be a separate refactor change. I think we should come to a consensus in which checks (or a subset of f

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

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

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

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

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

2025-06-24 Thread Baranov Victor via cfe-commits
@@ -369,6 +380,9 @@ ProgramStateRef UnixAPIMisuseChecker::EnsureGetdelimBufferAndSizeCorrect( void UnixAPIMisuseChecker::CheckGetDelim(CheckerContext &C, const CallEvent &Call) const { + if (Call.getNumArgs() < 2) +return; ---

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

2025-06-24 Thread Baranov Victor via cfe-commits
@@ -1518,14 +1518,19 @@ void MallocChecker::checkGetdelim(ProgramStateRef State, const CallEvent &Call, if (!CE) return; - const auto LinePtr = - getPointeeVal(Call.getArgSVal(0), State)->getAs(); - const auto Size = - getPointeeVal(Call.getArgSVal(1), State

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

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

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

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

2025-06-23 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor deleted 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 misc-bool-bitwise-operation check (PR #142324)

2025-06-23 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 misc-bool-bitwise-operation check (PR #142324)

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

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

2025-06-23 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor approved this pull request. LGTM 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] Feature/labmda uaf (PR #145307)

2025-06-23 Thread Baranov Victor via cfe-commits
vbvictor wrote: Is this unfinished work? I'd suggest to covert this to draft. https://github.com/llvm/llvm-project/pull/145307 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

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

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

2025-06-25 Thread Baranov Victor via cfe-commits
vbvictor wrote: If modules are considered as system headers in clang-tidy, there was work in https://github.com/llvm/llvm-project/pull/128150 to reduce scope of traversal to match only in user code (I suppose it would affect modules too). But that PR had to be reverted due to appeared issues w

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

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

2025-06-23 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 new check: modernize-use-scoped-lock (PR #126434)

2025-06-23 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/126434 >From 516a831127d98d4b1a38a09d7d13f4f04a3a80ae 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] [clang][analyzer] fix crash when modelling 'getline' function in checkers (PR #145229)

2025-06-23 Thread Baranov Victor via cfe-commits
vbvictor wrote: > Your concern that "However, we will still try to model "incorrect" getline > methods, wasting cpu." is very premature optimization, the runtime change > would be totally negligible Indeed, without measurements, this argument is not viable. I've investigated the code of `StdL

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

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

[clang-tools-extra] [clang-tidy] properly handle private move constructors in `modernize-pass-by-value` check (PR #141304)

2025-06-23 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] add 'IgnoreMarcos' option to 'special-member-functions' check (PR #143550)

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

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

2025-06-23 Thread Baranov Victor via cfe-commits
@@ -18,6 +18,12 @@ using namespace clang::ast_matchers; namespace clang::tidy::cppcoreguidelines { +namespace { +AST_MATCHER(CXXRecordDecl, isInMacro) { vbvictor wrote: Yes, I was thinking lately about it. I've seen some matchers use only `Node.getBeginLoc()

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

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

2025-06-23 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,198 @@ +//===--- 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-23 Thread Baranov Victor via cfe-commits
vbvictor wrote: One of the logs also suggests `UseNumericLimitsCheck.cpp:81:31`. As of LLVM policy, we need to revert it. @stellar-aria, I will create a revert patch in a couple of hours or accept yours if you do it first. https://github.com/llvm/llvm-project/pull/127430 ___

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

2025-06-24 Thread Baranov Victor via cfe-commits
@@ -1518,14 +1518,18 @@ void MallocChecker::checkGetdelim(ProgramStateRef State, const CallEvent &Call, if (!CE) return; - const auto LinePtr = - getPointeeVal(Call.getArgSVal(0), State)->getAs(); - const auto Size = - getPointeeVal(Call.getArgSVal(1), State

[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] 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] 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] 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] 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] 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] 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] 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-tools-extra] added option `google-readability-namespace-comments.AllowNoNamespaceComments` (PR #124265)

2025-06-08 Thread Baranov Victor via cfe-commits
vbvictor wrote: @thorsten-klein, by [LLVM Developer Policy](https://llvm.org/docs/DeveloperPolicy.html#email-addresses) you should have public email for making a contribution. Please turn off [Keep my email addresses private](https://github.com/settings/emails) setting in your account. https:

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

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

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

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

[clang-tools-extra] [clang-tidy][NFC] run clang-format over 'cert', 'cppcore', 'fuchsia',… (PR #143316)

2025-06-08 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/143316 … 'google' checks >From 50485a9c1c14325f7bf019827b461bcefe053d3c Mon Sep 17 00:00:00 2001 From: Baranov Victor Date: Sun, 8 Jun 2025 19:39:49 +0300 Subject: [PATCH] [clang-tidy][NFC] run clang-format over 'cer

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

2025-06-08 Thread Baranov Victor via cfe-commits
vbvictor wrote: I think I've waited for all checks to pass.. I think the main problem is that when this PR was first published, there wasn't a "clang-format job" so It didn't run on any commits before this got merged into main. https://github.com/llvm/llvm-project/pull/124265

[clang-tools-extra] [clang-tidy][NFC] fix formatting of `namespace-comment-check` (PR #143305)

2025-06-08 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/143305 Fixed formatting and codestyle issues in `namespace-comment-check` Follow up to https://github.com/llvm/llvm-project/pull/124265. >From 69518ec57cfae7840469fd05b97a413c10945cb2 Mon Sep 17 00:00:00 2001 From: V

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

2025-06-08 Thread Baranov Victor via cfe-commits
vbvictor wrote: > I think the main problem is that when this PR was first published, there > wasn't a "clang-format job" so It didn't run on any commits before this got > merged into main. Actually, there is a failed job if you hover over a red cross next to one of the commits, my bad. Follow

[clang-tools-extra] [clang-tidy] Fix false positives with deducing this in `readability-convert-member-functions-to-static` check (PR #141391)

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

[clang-tools-extra] [clang-tidy][NFC] run clang-format over 'cert', 'cppcore', 'fuchsia',… (PR #143316)

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

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

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

[clang-tools-extra] [clang-tidy][NFC] run clang-format over `abseil` and `altera` checks. (PR #143314)

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

[clang-tools-extra] [clang-tidy][NFC] run clang-format over `abseil` and `altera` checks. (PR #143314)

2025-06-08 Thread Baranov Victor via cfe-commits
vbvictor wrote: It appeared relatively easy to review, I'll make next slightly bigger https://github.com/llvm/llvm-project/pull/143314 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-06-08 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/143324 Last commit, with this merged `clang-tidy` should be 100% `clang-format` compliant. Time to check formatting in new PRs:) >From 287a34835e91240ddd786d62e70e9549ccb88d79 Mon Sep 17 00:00:00 2001 From: Victor Ba

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

2025-06-06 Thread Baranov Victor via cfe-commits
vbvictor wrote: > Actually, another reason for not putting this in performance is that the > changes made by this check may lead to non-functional changes in the code. Off-by-default option `StrictMode` may exclude fix-its that involve function with side-effects, etc.. AFAIK, if the check doe

[clang-tools-extra] [clang-tidy] Fix false positives with deducing this in `readability-convert-member-functions-to-static` check (PR #141391)

2025-06-07 Thread Baranov Victor via cfe-commits
vbvictor wrote: When merging, your new public email will be used, now it says "This commit will be authored by flb...@protonmail.com." https://github.com/llvm/llvm-project/pull/141391 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lis

[clang-tools-extra] [clang-tidy] Add support for lambda-expression in `use-trailing-return-type` check (PR #135383)

2025-06-05 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/135383 >From 29d9181db668ca200c04072821e7c6ce7e532f5c Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Thu, 5 Jun 2025 18:17:16 +0300 Subject: [PATCH] [clang-tidy] add support for lambdas in use-trailing-return-ty

[clang-tools-extra] [clang-tidy] Add support for lambda-expression in `use-trailing-return-type` check (PR #135383)

2025-06-05 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/135383 >From 9d10d78052c33f3ea69bb0453cf0a5754fcdbe4d Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Thu, 5 Jun 2025 18:33:15 +0300 Subject: [PATCH] [clang-tidy] add support for lambdas in use-trailing-return-ty

[clang-tools-extra] [clang-tidy] Add support for lambda-expression in `use-trailing-return-type` check (PR #135383)

2025-06-05 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/135383 >From cd0c0aba2d5da7c24fb64dd1a0ed25760ba57c4d Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Thu, 5 Jun 2025 21:51:41 +0300 Subject: [PATCH] [clang-tidy] add support for lambdas in use-trailing-return-ty

[clang-tools-extra] [clang-tidy] Add support for lambda-expression in `use-trailing-return-type` check (PR #135383)

2025-06-05 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/135383 >From 17013c38835d42a21b16d5e85c1268059555ea7f Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Thu, 5 Jun 2025 21:51:41 +0300 Subject: [PATCH] [clang-tidy] add support for lambdas in use-trailing-return-ty

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

2025-06-05 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/134188 ___ 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 support for lambda-expression in `use-trailing-return-type` check (PR #135383)

2025-06-06 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/135383 ___ 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 support for lambda-expression in `use-trailing-return-type` check (PR #135383)

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

2025-06-06 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/131669 >From a5e8c2f51b50a797fb9c64726e393186404582c9 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sat, 26 Apr 2025 13:22:55 +0300 Subject: [PATCH] [clang-tidy] count ctor-initializers as statements in check

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

2025-06-09 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor closed https://github.com/llvm/llvm-project/pull/143324 ___ 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] fix 'misc-use-internal-linkage' check warnings (PR #143482)

2025-06-10 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/143482 Run [misc-use-internal-linkage](https://clang.llvm.org/extra/clang-tidy/checks/misc/use-internal-linkage.html) check over clang-tidy code. In my previous clang-tidy runs, it wasn't included because I used an

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

2025-06-10 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor closed https://github.com/llvm/llvm-project/pull/134188 ___ 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-23 Thread Baranov Victor via cfe-commits
vbvictor wrote: Reverted, thank you [qinkunbao](https://github.com/qinkunbao) for the report! When making a new PR for this check, please make the title `Reland "[clang-tidy] Add ..."` provide a description of what broke and how it was fixed. https://github.com/llvm/llvm-project/pull/127430 __

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

2025-06-23 Thread Baranov Victor via cfe-commits
vbvictor wrote: No problem, take your time! Feel better soon. Regarding this comment: > should probably be earlier - this is inside an array of object My logic is still placed inside that `if (object || pointer)`, should I try to look for an earlier place in `resolveAllocationOverloadInterior`

[clang-tools-extra] Feature/labmda uaf (PR #145307)

2025-06-23 Thread Baranov Victor via cfe-commits
vbvictor wrote: I suppose this check is specific to this https://github.com/userver-framework/userver framework, so we can't accept it in clang-tidy in current format. https://github.com/llvm/llvm-project/pull/145307 ___ cfe-commits mailing list cfe-

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

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

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

2025-06-23 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor closed https://github.com/llvm/llvm-project/pull/145355 ___ 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 'IgnoreMarcos' option to 'special-member-functions' check (PR #143550)

2025-06-23 Thread Baranov Victor via cfe-commits
vbvictor wrote: > I meant macros defined in system headers, but with expansions in user code. Make sense, I suppose we should make for that and potentially implement such logic in more checks. I think we can land this as is for now https://github.com/llvm/llvm-project/pull/143550

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