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

2025-07-08 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,197 @@ +//===--- 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-07-08 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,59 @@ +// RUN: %check_clang_tidy %s misc-bool-bitwise-operation %t \ +// RUN: -config="{CheckOptions: { \ +// RUN: misc-bool-bitwise-operation.IgnoreMacros: true }}" + +#define MY_OR | +#define MY_AND & +#define MY_OR_ASSIGN |= +#define MY_AND_ASSIGN &= +#define M

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

2025-07-06 Thread Denis Mikhailov via cfe-commits
denzor200 wrote: > we could add Limitations section in check docs to avoid potential confusion > and false-negative reports in the future. Done https://github.com/llvm/llvm-project/pull/142324 ___ cfe-commits mailing list cfe-commits@lists.llvm.org h

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

2025-07-05 Thread Denis Mikhailov via cfe-commits
denzor200 wrote: > I believe all PiotrZSL's comments are correctly resolved, and we could merge > it next week if there would be no more reviews. One nit from me: since we > don't match template functions, we could add `Limitations` section in check > docs to avoid potential confusion and fals

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

2025-07-05 Thread Denis Mikhailov via cfe-commits
denzor200 wrote: ping 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 modernize-make-direct check (PR #118120)

2025-07-01 Thread Denis Mikhailov via cfe-commits
https://github.com/denzor200 requested changes to this pull request. https://github.com/llvm/llvm-project/pull/118120 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-07-01 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,76 @@ +// RUN: %check_clang_tidy -std=c++17 %s modernize-make-direct %t + +namespace std { +template +struct optional { + optional(const T&) {} +}; + +template +optional make_optional(const T& t) { return optional(t); } + +template +struct unique_ptr { + explicit uni

[clang-tools-extra] [clang-tidy] add misc-constexpr check (PR #146553)

2025-07-01 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,562 @@ +// RUN: %check_clang_tidy -std=c++11 -check-suffix=11 %s misc-use-constexpr %t -- -- -fno-delayed-template-parsing +// RUN: %check_clang_tidy -std=c++14 -check-suffix=11,14 %s misc-use-constexpr %t -- -- -fno-delayed-template-parsing +// RUN: %check_clang_tidy

[clang-tools-extra] [clang-tidy] add misc-constexpr check (PR #146553)

2025-07-01 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,562 @@ +// RUN: %check_clang_tidy -std=c++11 -check-suffix=11 %s misc-use-constexpr %t -- -- -fno-delayed-template-parsing +// RUN: %check_clang_tidy -std=c++14 -check-suffix=11,14 %s misc-use-constexpr %t -- -- -fno-delayed-template-parsing +// RUN: %check_clang_tidy

[clang-tools-extra] [clang-tidy] add misc-constexpr check (PR #146553)

2025-07-01 Thread Denis Mikhailov via cfe-commits
denzor200 wrote: `constexpr` is one of the important additions of C++11. Most of the users will search this check in "modernize" section and will be misled by not finding it there. "misc-const-correctness" - not a modernize check at all, it even relevant for C++98, so it exists in "misc" htt

[clang-tools-extra] [clang-tidy] add misc-constexpr check (PR #146553)

2025-07-01 Thread Denis Mikhailov via cfe-commits
denzor200 wrote: > misc-use-constexpr? :) modernize-use-constexpr? https://github.com/llvm/llvm-project/pull/146553 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Create a new check to look for mis-use in calls that take iterators (PR #99917)

2025-06-23 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,437 @@ +// RUN: %check_clang_tidy -std=c++14 %s bugprone-incorrect-iterators %t + +namespace std { + +template struct pair {}; + +namespace execution { + +class parallel_policy {}; + +constexpr parallel_policy par; + +} // namespace execution + +template class reverse

[clang-tools-extra] Create a new check to look for mis-use in calls that take iterators (PR #99917)

2025-06-23 Thread Denis Mikhailov via cfe-commits
https://github.com/denzor200 requested changes to this pull request. https://github.com/llvm/llvm-project/pull/99917 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang-tidy][dataflow] Add `bugprone-null-check-after-dereference` check (PR #84166)

2025-06-23 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,163 @@ +.. title:: clang-tidy - bugprone-null-check-after-dereference + +bugprone-null-check-after-dereference += + +.. note:: + + This check uses a flow-sensitive static analysis to produce its + results. Therefore, it may be mor

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

2025-06-23 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,219 @@ +//===--- 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-22 Thread Denis Mikhailov via cfe-commits
denzor200 wrote: @HerrCai0907 @PiotrZSL could you please approve again? 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-21 Thread Denis Mikhailov 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 misc-bool-bitwise-operation check (PR #142324)

2025-06-21 Thread Denis Mikhailov via cfe-commits
https://github.com/denzor200 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 Denis Mikhailov via cfe-commits
https://github.com/denzor200 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-15 Thread Denis Mikhailov 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-15 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,403 @@ +// RUN: %check_clang_tidy %s performance-bool-bitwise-operation %t + +bool& normal() { +int a = 100, b = 200; + +a | b; +a & b; +a |= b; +a &= b; + +static bool st = false; +return st; +} + +bool bad() noexcept __attribute__((pure)) {

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

2025-06-15 Thread Denis Mikhailov 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-15 Thread Denis Mikhailov 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-15 Thread Denis Mikhailov 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-15 Thread Denis Mikhailov 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-15 Thread Denis Mikhailov 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-15 Thread Denis Mikhailov 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-13 Thread Denis Mikhailov via cfe-commits
denzor200 wrote: ping 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-08 Thread Denis Mikhailov via cfe-commits
denzor200 wrote: > Did you have a chance to run the test on a large codebase (e.g. the > llvm-project) and see if we get any FPs in this regard? Here is the full result: [1.log](https://github.com/user-attachments/files/20644432/1.log) At the first sight no FP at all https://github.com/llvm/l

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

2025-06-06 Thread Denis Mikhailov via cfe-commits
denzor200 wrote: > Ok, that's great! Did you have a chance to run the test on a large codebase > (e.g. the llvm-project) and see if we get any FPs in this regard? Going to do it https://github.com/llvm/llvm-project/pull/142324 ___ cfe-commits mailing

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

2025-06-06 Thread Denis Mikhailov via cfe-commits
denzor200 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. If > the RHS operand is a function that has side effects, this check will change > the logic of the code, since the RHS may n

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

2025-06-06 Thread Denis Mikhailov via cfe-commits
denzor200 wrote: > Personally I don't think this is a `performance` check. Boolean operators are > for bools; bitwise operators are for ints. I would put this in `readability` > or `misc` instead. I've put this in the performance section because evaluating only one operand(which will be in mo

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

2025-05-18 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,108 @@ +#include "MakeFunctionToDirectCheck.h" +#include "clang/AST/ASTContext.h" +#include "clang/AST/Type.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" +#include "clang/ASTMatchers/ASTMatchers.h" +#include "clang/Lex/Lexer.h" + +using namespace clang::ast_matchers

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

2025-05-18 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,20 @@ +#include "../ClangTidyCheck.h" + +namespace clang::tidy::modernize { + +class MakeFunctionToDirectCheck : public ClangTidyCheck { denzor200 wrote: It can be refactored with `TransformerClangTidyCheck` usage. Sample for only `std::make_pair` fun

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

2025-05-18 Thread Denis Mikhailov via cfe-commits
https://github.com/denzor200 requested changes to this pull request. https://github.com/llvm/llvm-project/pull/118120 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-05-18 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,17 @@ +.. title:: clang-tidy - modernize-make-direct + +modernize-make-direct + + +Replaces ``std::make_*`` function calls with direct constructor calls using class template +argument deduction (CTAD). + +== =

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

2025-03-24 Thread Denis Mikhailov via cfe-commits
@@ -64,16 +64,21 @@ AST_MATCHER(CXXRecordDecl, correctHandleCaptureThisLambda) { constexpr const char *DefaultFunctionWrapperTypes = "::std::function;::std::move_only_function;::boost::function"; +constexpr const char *DefaultBindFunctions = "::std::bind;::boost::bind"; --

[clang-tools-extra] [clang-tidy] Add new check bugprone-capture-this-by-field (PR #130297)

2025-03-15 Thread Denis Mikhailov via cfe-commits
denzor200 wrote: LGTM, please provide the change for one comment I left https://github.com/llvm/llvm-project/pull/130297 ___ 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 bugprone-capture-this-by-field (PR #130297)

2025-03-15 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,36 @@ +.. title:: clang-tidy - bugprone-capturing-this-in-member-variable + +bugprone-capturing-this-in-member-variable +== + +Finds lambda captures that capture the ``this`` pointer and store it as class +members without handle t

[clang-tools-extra] [clang-tidy] Add new check bugprone-capture-this-by-field (PR #130297)

2025-03-15 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,36 @@ +.. title:: clang-tidy - bugprone-capturing-this-in-member-variable + +bugprone-capturing-this-in-member-variable +== + +Finds lambda captures that capture the ``this`` pointer and store it as class +members without handle t

[clang-tools-extra] [clang-tidy] Add new check bugprone-capture-this-by-field (PR #130297)

2025-03-15 Thread Denis Mikhailov via cfe-commits
https://github.com/denzor200 approved this pull request. https://github.com/llvm/llvm-project/pull/130297 ___ 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 bugprone-capture-this-by-field (PR #130297)

2025-03-13 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,144 @@ +// RUN: %check_clang_tidy -std=c++11-or-later %s bugprone-capturing-this-by-field %t -- -config="{CheckOptions: {bugprone-capturing-this-by-field.FunctionWrapperTypes: '::std::function;::Fn'}}" -- denzor200 wrote: Created issues about bind a

[clang-tools-extra] [clang-tidy] Add new check bugprone-capture-this-by-field (PR #130297)

2025-03-12 Thread Denis Mikhailov via cfe-commits
https://github.com/denzor200 edited https://github.com/llvm/llvm-project/pull/130297 ___ 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 bugprone-capture-this-by-field (PR #130297)

2025-03-12 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,44 @@ +//===--- CapturingThisByFieldCheck.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 bugprone-capture-this-by-field (PR #130297)

2025-03-12 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,144 @@ +// RUN: %check_clang_tidy -std=c++11-or-later %s bugprone-capturing-this-by-field %t -- -config="{CheckOptions: {bugprone-capturing-this-by-field.FunctionWrapperTypes: '::std::function;::Fn'}}" -- denzor200 wrote: Oke, don't worry about bind

[clang-tools-extra] [clang-tidy] Add new check bugprone-capture-this-by-field (PR #130297)

2025-03-12 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,44 @@ +//===--- CapturingThisByFieldCheck.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 bugprone-capture-this-by-field (PR #130297)

2025-03-12 Thread Denis Mikhailov via cfe-commits
https://github.com/denzor200 edited https://github.com/llvm/llvm-project/pull/130297 ___ 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 bugprone-capture-this-by-field (PR #130297)

2025-03-12 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,144 @@ +// RUN: %check_clang_tidy -std=c++11-or-later %s bugprone-capturing-this-by-field %t -- -config="{CheckOptions: {bugprone-capturing-this-by-field.FunctionWrapperTypes: '::std::function;::Fn'}}" -- + +namespace std { + +template +class function; + +template +c

[clang-tools-extra] [clang-tidy] Add new check bugprone-capture-this-by-field (PR #130297)

2025-03-12 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,144 @@ +// RUN: %check_clang_tidy -std=c++11-or-later %s bugprone-capturing-this-by-field %t -- -config="{CheckOptions: {bugprone-capturing-this-by-field.FunctionWrapperTypes: '::std::function;::Fn'}}" -- + +namespace std { + +template +class function; + +template +c

[clang-tools-extra] [clang-tidy] Add new check bugprone-capture-this-by-field (PR #130297)

2025-03-07 Thread Denis Mikhailov via cfe-commits
https://github.com/denzor200 requested changes to this pull request. https://github.com/llvm/llvm-project/pull/130297 ___ 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 bugprone-capture-this-by-field (PR #130297)

2025-03-07 Thread Denis Mikhailov via cfe-commits
@@ -118,6 +119,8 @@ class BugproneModule : public ClangTidyModule { CheckFactories.registerCheck( "bugprone-bool-pointer-implicit-conversion"); CheckFactories.registerCheck("bugprone-branch-clone"); +CheckFactories.registerCheck( +"bugprone-capture-t

[clang-tools-extra] [clang-tidy] Add new check bugprone-capture-this-by-field (PR #130297)

2025-03-07 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,99 @@ +//===--- CaptureThisByFieldCheck.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: Apa

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

2025-02-23 Thread Denis Mikhailov via cfe-commits
https://github.com/denzor200 approved this pull request. 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 Denis Mikhailov 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 Denis Mikhailov via cfe-commits
https://github.com/denzor200 requested changes to this pull request. 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 Denis Mikhailov 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-20 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,131 @@ +//===--- 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-20 Thread Denis Mikhailov via cfe-commits
https://github.com/denzor200 requested changes to this pull request. 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-20 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,48 @@ +.. 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-move-shared-pointer-contents check. (PR #67467)

2025-01-03 Thread Denis Mikhailov via cfe-commits
denzor200 wrote: > Wouldn't that be a runtime check, and thus not something clang-tidy can do > without significant data flow analysis effort? I'm not experienced enough in clang-tidy internals, but I believe it will not be a serious challenge to check for having `assert(sp.use_count() == 1)`

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

2024-12-30 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,34 @@ +//===--- SmartptrResetAmbiguousCallCheck.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 bugprone-move-shared-pointer-contents check. (PR #67467)

2024-12-29 Thread Denis Mikhailov via cfe-commits
denzor200 wrote: Suppose this check should be silent for a shared_ptr with `use_count() == 1`. Is it possible to change implementation in order to following this way? https://github.com/llvm/llvm-project/pull/67467 ___ cfe-commits mailing list cfe-com

[clang-tools-extra] [clang-tidy] Add readability-use-span-first-last check (PR #118074)

2024-12-21 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,149 @@ +// RUN: %check_clang_tidy -std=c++20 %s readability-use-span-first-last %t + +namespace std { +template +class span { + T* ptr; + __SIZE_TYPE__ len; + +public: + span(T* p, __SIZE_TYPE__ l) : ptr(p), len(l) {} + + span subspan(__SIZE_TYPE__ offset) const

[clang-tools-extra] [clang-tidy] Add readability-string-view-substr check (PR #120055)

2024-12-21 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,108 @@ +// RUN: %check_clang_tidy %s readability-stringview-substr %t + +namespace std { +template +class basic_string_view { +public: + using size_type = unsigned long; + static constexpr size_type npos = -1; + + basic_string_view(const char*) {} + basic_string_vi

[clang-tools-extra] [clang-tidy] Add readability-string-view-substr check (PR #120055)

2024-12-21 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,108 @@ +// RUN: %check_clang_tidy %s readability-stringview-substr %t + +namespace std { +template +class basic_string_view { +public: + using size_type = unsigned long; + static constexpr size_type npos = -1; + + basic_string_view(const char*) {} + basic_string_vi

[clang-tools-extra] [clang-tidy] Added bugprone-exception-rethrow check (PR #86448)

2024-12-21 Thread Denis Mikhailov via cfe-commits
@@ -0,0 +1,103 @@ +// RUN: %check_clang_tidy %s bugprone-exception-rethrow %t -- -- -fexceptions + +struct exception {}; + +namespace std { + template + T&& move(T &&x) { +return static_cast(x); + } +} + +void correct() { + try { + throw exception(); + } catch(const