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

2025-05-09 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,31 @@ +.. title:: clang-tidy - cppcoreguidelines-use-enum-class + +cppcoreguidelines-use-enum-class += vbvictor wrote: ```suggestion cppcoreguidelines-use-enum-class ``` https://github.com/l

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

2025-05-09 Thread Baranov Victor via cfe-commits
@@ -59,6 +60,8 @@ class CppCoreGuidelinesModule : public ClangTidyModule { void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { CheckFactories.registerCheck( "cppcoreguidelines-avoid-capturing-lambda-coroutines"); +CheckFactories.register

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() [Cont.] (PR #95220)

2025-05-10 Thread Baranov Victor via cfe-commits
Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heide

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

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

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() [Cont.] (PR #95220)

2025-05-10 Thread Baranov Victor via cfe-commits
Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heide

[clang-tools-extra] [clang-tidy] fix false negatives with type aliases in `cppcoreguidlines-pro-bounds-pointer-arithmetic` check (PR #139430)

2025-05-10 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/139430 Fixed false negatives with type aliases in `cppcoreguidlines-pro-bounds-pointer-arithmetic` check. Added tests with pointer arithmetic in template functions to make test cases more robust. Closes https://gith

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() [Cont.] (PR #95220)

2025-05-10 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,227 @@ +// RUN: %check_clang_tidy -std=c++2b -check-suffix=DEFAULT %s \ vbvictor wrote: You can have one test file with multiple RUN-commands with different c++ standarts using defines. Look at `clang-tools-extra/test/clang-tidy/checkers/modernize/ma

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() [Cont.] (PR #95220)

2025-05-10 Thread Baranov Victor via cfe-commits
Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heide

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() [Cont.] (PR #95220)

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

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() [Cont.] (PR #95220)

2025-05-12 Thread Baranov Victor via cfe-commits
=��___ 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-05-12 Thread Baranov Victor via cfe-commits
vbvictor wrote: Ping 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] Improve `bugprone-exception-escape`: add stacktrace of escaped exception (PR #134375)

2025-05-12 Thread Baranov Victor via cfe-commits
vbvictor wrote: Ping https://github.com/llvm/llvm-project/pull/134375 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() [Cont.] (PR #95220)

2025-05-17 Thread Baranov Victor via cfe-commits
Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heide

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() [Cont.] (PR #95220)

2025-05-17 Thread Baranov Victor via cfe-commits
Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heide

[clang-tools-extra] [clang-tidy] Added check 'bugprone-function-visibility-change' (PR #140086)

2025-05-17 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor commented: I think we should make change the name of the check to include "method" or "member-function" words in it. It will make clear that we check for methods visibility and not some visibility attributes on functions. Possible names: bugprone-member-function-visi

[clang-tools-extra] [clang-tidy] Added check 'bugprone-function-visibility-change' (PR #140086)

2025-05-17 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,74 @@ +//===--- FunctionVisibilityChangeCheck.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] Added check 'bugprone-function-visibility-change' (PR #140086)

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

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

2025-05-17 Thread Baranov Victor via cfe-commits
@@ -130,6 +130,11 @@ New checks Finds unintended character output from ``unsigned char`` and ``signed char`` to an ``ostream``. +- New :doc:`cppcoreguidelines-use-enum-class + ` check. + + Finds plain non-class ``enum`` definitions that could use ``enum class``.

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

2025-05-17 Thread Baranov Victor via cfe-commits
vbvictor wrote: You should wait for an approval from one of the clang-tidy maintainers (PiotrZSL, carlosgalvezp, HerrCai0907) that will also help merge this PR. It can take some time, but the new release will only be in July, so don't need to worry about it for now. You can "Ping" reviewers wi

[clang-tools-extra] [clang-tidy] Added check 'bugprone-function-visibility-change' (PR #140086)

2025-05-17 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,74 @@ +//===--- FunctionVisibilityChangeCheck.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] do not diagnose array types within implicit instantiations of a template (PR #132924)

2025-05-17 Thread Baranov Victor via cfe-commits
vbvictor wrote: For now, I think you should wait for an approval/review from one of the clang-tidy maintainers (PiotrZSL, HerrCai0907) that will also help merge this PR. It can take some time, but the new release will only be in July, so don't need to worry about missing your changes for now.

[clang-tools-extra] [clang-tidy] Add UnusedIncludes/MissingIncludes options to misc-include-cleaner (PR #140600)

2025-05-20 Thread Baranov Victor via cfe-commits
@@ -68,12 +70,19 @@ IncludeCleanerCheck::IncludeCleanerCheck(StringRef Name, HeaderSuffix += "$"; IgnoreHeadersRegex.emplace_back(HeaderSuffix); } + + if (UnusedIncludes == false && MissingIncludes == false) +this->configurationDiag("The check 'misc-include-cle

[clang-tools-extra] [clang-tidy] Add UnusedIncludes/MissingIncludes options to misc-include-cleaner (PR #140600)

2025-05-20 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,13 @@ +// RUN: %check_clang_tidy %s misc-include-cleaner %t \ +// RUN: -config='{CheckOptions: \ +// RUN: {"misc-include-cleaner.UnusedIncludes": false,\ +// RUN: "misc-include-cleaner.MissingIncludes": false,\ +// RUN: }}' -- -fno-delayed-template-parsing + +// CHE

[clang-tools-extra] [clang-tidy] Add UnusedIncludes/MissingIncludes options to misc-include-cleaner (PR #140600)

2025-05-20 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,13 @@ +// RUN: %check_clang_tidy %s misc-include-cleaner %t \ +// RUN: -config='{CheckOptions: \ +// RUN: {"misc-include-cleaner.UnusedIncludes": false,\ +// RUN: "misc-include-cleaner.MissingIncludes": false,\ +// RUN: }}' -- -fno-delayed-template-parsing + +// CHE

[clang-tools-extra] [clang-tidy] Add UnusedIncludes/MissingIncludes options to misc-include-cleaner (PR #140600)

2025-05-20 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/140600 ___ 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 UnusedIncludes/MissingIncludes options to misc-include-cleaner (PR #140600)

2025-05-20 Thread Baranov Victor via cfe-commits
@@ -225,6 +225,11 @@ Changes in existing checks tolerating fix-it breaking compilation when functions is used as pointers to avoid matching usage of functions within the current compilation unit. +- Improved :doc:`misc-include-cleaner vbvictor wrote: Plea

[clang-tools-extra] [clang-tidy][NFC] Refactor `modernize-pass-by-value` check code and tests (PR #140753)

2025-05-20 Thread Baranov Victor via cfe-commits
vbvictor wrote: > Also, CHECK-MESSAGES-NOT is discouraged, since the testing framework already > checks that no other output is produced by default. So if CHECK-FIXES are the same as previous code, we can remove them completely (I changed them to CHECK-MESSAGES-NOT) https://github.com/llvm/

[clang-tools-extra] [clang-tidy][NFC] Refactor `modernize-use-trailing-return-type-check` check code and tests (PR #140759)

2025-05-20 Thread Baranov Victor via cfe-commits
@@ -383,6 +382,10 @@ void UseTrailingReturnTypeCheck::keepSpecifiers( } } +UseTrailingReturnTypeCheck::UseTrailingReturnTypeCheck( vbvictor wrote: Initially, I did this change in preparation for PR https://github.com/llvm/llvm-project/pull/135383, where I

[clang-tools-extra] [clang-tidy][NFC] Refactor `modernize-use-trailing-return-type-check` check code and tests (PR #140759)

2025-05-20 Thread Baranov Victor via cfe-commits
@@ -113,7 +113,7 @@ struct UnqualNameVisitor : public RecursiveASTVisitor { }; } // namespace -constexpr llvm::StringLiteral Message = +constexpr llvm::StringLiteral MessageFunction = vbvictor wrote: This came from https://github.com/llvm/llvm-project/pull/1

[clang-tools-extra] [clang-tidy][NFC] Refactor `modernize-use-trailing-return-type-check` check code and tests (PR #140759)

2025-05-20 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/140759 >From fbae463925738d8628593d5daaabe2a299aecbbf Mon Sep 17 00:00:00 2001 From: Baranov Victor Date: Tue, 20 May 2025 19:23:35 +0300 Subject: [PATCH 1/2] [clang-tidy][nfc] refactor use-trailing-return-type-check

[clang-tools-extra] [clang-tidy][NFC] Refactor `modernize-use-trailing-return-type-check` check code and tests (PR #140759)

2025-05-20 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/140759 >From fbae463925738d8628593d5daaabe2a299aecbbf Mon Sep 17 00:00:00 2001 From: Baranov Victor Date: Tue, 20 May 2025 19:23:35 +0300 Subject: [PATCH 1/3] [clang-tidy][nfc] refactor use-trailing-return-type-check

[clang-tools-extra] [clang-tidy][NFC] Refactor `modernize-use-trailing-return-type-check` check code and tests (PR #140759)

2025-05-20 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/140759 >From fbae463925738d8628593d5daaabe2a299aecbbf Mon Sep 17 00:00:00 2001 From: Baranov Victor Date: Tue, 20 May 2025 19:23:35 +0300 Subject: [PATCH 1/4] [clang-tidy][nfc] refactor use-trailing-return-type-check

[clang-tools-extra] [clang-tidy][NFC] Refactor `modernize-use-trailing-return-type-check` check code and tests (PR #140759)

2025-05-20 Thread Baranov Victor via cfe-commits
@@ -28,7 +27,7 @@ struct ClassifiedToken { class UseTrailingReturnTypeCheck : public ClangTidyCheck { public: UseTrailingReturnTypeCheck(StringRef Name, ClangTidyContext *Context) - : ClangTidyCheck(Name, Context) {} + : ClangTidyCheck(Name, Context) {}; ---

[clang-tools-extra] [clang-tidy][NFC] Refactor `modernize-use-trailing-return-type-check` check code and tests (PR #140759)

2025-05-20 Thread Baranov Victor via cfe-commits
@@ -28,7 +27,7 @@ struct ClassifiedToken { class UseTrailingReturnTypeCheck : public ClangTidyCheck { public: UseTrailingReturnTypeCheck(StringRef Name, ClangTidyContext *Context) - : ClangTidyCheck(Name, Context) {} + : ClangTidyCheck(Name, Context) {}; ---

[clang-tools-extra] [clang-tidy][NFC] Refactor `modernize-use-trailing-return-type-check` check code and tests (PR #140759)

2025-05-20 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/140759 - Deleted unused includes - Deleted useless braces - Converted private methods to static function to improve compilations speed and readability - Modernized tests to use `cxx-or-later` >From fbae463925738d862

[clang-tools-extra] [clang-tidy][NFC] Refactor `modernize-pass-by-value` check code and tests (PR #140753)

2025-05-20 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/140753 - Deleted unused includes - Deleted useless braces - Modernized tests to use `CHECK-MESSAGES-NOT` and `CHECK-FIXES-NOT` for better readability and maintainability >From 60c4c0432a47637bedd20a88c60b5a715473c78a

[clang-tools-extra] [clang-tidy] Add UnusedIncludes/MissingIncludes options to misc-include-cleaner (PR #140600)

2025-05-20 Thread Baranov Victor via cfe-commits
vbvictor wrote: Apart from failing tests, LGTM https://github.com/llvm/llvm-project/pull/140600 ___ 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-05-20 Thread Baranov Victor via cfe-commits
@@ -494,4 +554,75 @@ void UseTrailingReturnTypeCheck::check(const MatchFinder::MatchResult &Result) { << FixItHint::CreateInsertion(InsertionLoc, " -> " + ReturnType); } +void UseTrailingReturnTypeCheck::diagOnLambda( +const LambdaExpr *Lambda, +const ast_matche

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

2025-05-20 Thread Baranov Victor via cfe-commits
@@ -56,6 +60,13 @@ class UseTrailingReturnTypeCheck : public ClangTidyCheck { SourceRange ReturnTypeCVRange, const FunctionDecl &F, const FriendDecl *Fr, const ASTContext &Ctx, const SourceManager &SM, const Lang

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

2025-05-20 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor deleted 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 avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,12 @@ +.. title:: clang-tidy - portability-avoid-pragma-once + +portability-avoid-pragma-once += + +This check catches pragma once usage. vbvictor wrote: Avoid "This check", "The check" in this context. Look at descriptions

[clang-tools-extra] [clang-tidy] Add avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
@@ -142,6 +142,11 @@ New checks Finds potentially erroneous calls to ``reset`` method on smart pointers when the pointee type also has a ``reset`` method. +- New :doc:`portability-avoid-pragma-once + ` check. + + A check that catches pragma once. vbvicto

[clang-tools-extra] [clang-tidy] Add avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,12 @@ +.. title:: clang-tidy - portability-avoid-pragma-once + +portability-avoid-pragma-once += + +This check catches pragma once usage. + vbvictor wrote: It will be very helpful for users to if you write a small descriptio

[clang-tools-extra] [clang-tidy] Add avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor commented: Good check! Mostly docs/phrasing comments from me. https://github.com/llvm/llvm-project/pull/140388 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi

[clang-tools-extra] [clang-tidy] Add avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/140388 ___ 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 avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,34 @@ +//===--- AvoidPragmaOnceCheck.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 avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,49 @@ +//===--- AvoidPragmaOnceCheck.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 avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1 @@ +#pragma once vbvictor wrote: Missing tests where there are spaces between `#` and `pragma` and multiple spaces between `pragma` and `once`. https://github.com/llvm/llvm-project/pull/140388 ___ cfe-commi

[clang-tools-extra] [clang-tidy] Add avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,49 @@ +//===--- AvoidPragmaOnceCheck.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 avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,12 @@ +.. title:: clang-tidy - portability-avoid-pragma-once + +portability-avoid-pragma-once += + +This check catches pragma once usage. vbvictor wrote: ```suggestion This check catches ``#pragma once`` usage. ``` Language

[clang-tools-extra] [clang-tidy] Add avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
@@ -351,6 +351,7 @@ Clang-Tidy Checks :doc:`performance-type-promotion-in-math-fn `, "Yes" :doc:`performance-unnecessary-copy-initialization `, "Yes" :doc:`performance-unnecessary-value-param `, "Yes" + :doc:`portability-avoid-pragma-once `, "Yes"

[clang-tools-extra] [clang-tidy] Add avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,5 @@ +// RUN: %check_clang_tidy %s portability-avoid-pragma-once %t \ +// RUN: -- --header-filter='.*' -- -I%S/Inputs/avoid-pragma-once + +#include "lib.h" +// CHECK-MESSAGES: lib.h:1:1: warning: Avoid pragma once. vbvictor wrote: Please add a newli

[clang-tools-extra] [clang-tidy] Add avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,12 @@ +.. title:: clang-tidy - portability-avoid-pragma-once + +portability-avoid-pragma-once += + +This check catches pragma once usage. + +For example: + +``` vbvictor wrote: use `.. code-block:: c++` for code, see other .

[clang-tools-extra] [clang-tidy] Add avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,50 @@ +//===--- AvoidPragmaOnceCheck.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 avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,50 @@ +//===--- AvoidPragmaOnceCheck.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 avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,24 @@ +.. title:: clang-tidy - portability-avoid-pragma-once + +portability-avoid-pragma-once += + +Finds uses of ``#pragma once`` and suggests replacing them with standard +include guards (``#ifndef``/``#define``/``#endif``) for improved por

[clang-tools-extra] [clang-tidy] Add avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,50 @@ +//===--- AvoidPragmaOnceCheck.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 avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,24 @@ +.. title:: clang-tidy - portability-avoid-pragma-once + +portability-avoid-pragma-once += + +Finds uses of ``#pragma once`` and suggests replacing them with standard +include guards (``#ifndef``/``#define``/``#endif``) for improved por

[clang-tools-extra] [clang-tidy] Add avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,24 @@ +.. title:: clang-tidy - portability-avoid-pragma-once + +portability-avoid-pragma-once += + +Finds uses of ``#pragma once`` and suggests replacing them with standard +include guards (``#ifndef``/``#define``/``#endif``) for improved por

[clang-tools-extra] [clang-tidy] Add avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor commented: Some more nit changes. If you will to contribute further, reading https://clang.llvm.org/extra/clang-tidy/Contributing.html may help you. Particularly "Making your check robust" and "Documenting your check". Although, most of it already covered in comments

[clang-tools-extra] [clang-tidy] Add avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,50 @@ +//===--- AvoidPragmaOnceCheck.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 avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/140388 ___ 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 avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/140388 ___ 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-05-19 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/135383 >From 4a7cdb4a9f4de5503eba1488306e238b7334912a Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Fri, 11 Apr 2025 20:26:49 +0300 Subject: [PATCH 1/3] [clang-tidy] add support for lambdas in use-trailing-retu

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

2025-05-19 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/135383 >From 4a7cdb4a9f4de5503eba1488306e238b7334912a Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Fri, 11 Apr 2025 20:26:49 +0300 Subject: [PATCH 1/4] [clang-tidy] add support for lambdas in use-trailing-retu

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

2025-05-19 Thread Baranov Victor via cfe-commits
@@ -56,6 +60,13 @@ class UseTrailingReturnTypeCheck : public ClangTidyCheck { SourceRange ReturnTypeCVRange, const FunctionDecl &F, const FriendDecl *Fr, const ASTContext &Ctx, const SourceManager &SM, const Lang

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

2025-05-19 Thread Baranov Victor via cfe-commits
@@ -56,6 +60,13 @@ class UseTrailingReturnTypeCheck : public ClangTidyCheck { SourceRange ReturnTypeCVRange, const FunctionDecl &F, const FriendDecl *Fr, const ASTContext &Ctx, const SourceManager &SM, const Lang

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

2025-05-19 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 avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/140388 ___ 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 avoid-pragma-once. (PR #140388)

2025-05-18 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/140388 ___ 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 positives in `bugprone-crtp-constructor-accessibility` check (PR #132543)

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

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

2025-05-25 Thread Baranov Victor via cfe-commits
@@ -80,13 +78,47 @@ void ExceptionEscapeCheck::check(const MatchFinder::MatchResult &Result) { if (!MatchedDecl) return; - if (Tracer.analyze(MatchedDecl).getBehaviour() == - utils::ExceptionAnalyzer::State::Throwing) -// FIXME: We should provide more informat

[clang-tools-extra] [clang-tidy] readability-redundant-smartptr-get: disable for smart pointers to arrays (PR #141092)

2025-05-27 Thread Baranov Victor via cfe-commits
vbvictor wrote: @kadircet, I think we generally shouldn't merge code that doesn't pass `clang-format` build (if non-compliant changes are so small). In the future I plan to make whole _clang-tidy_ directory `clang-format`-complaint so that people can have "format on save: file" in their editor

[clang-tools-extra] [clang-tidy] Fix formatting and add release notes entry (PR #141584)

2025-05-27 Thread Baranov Victor via cfe-commits
@@ -114,6 +114,9 @@ Improvements to clang-tidy - Fixed bug in :program:`run_clang_tidy.py` where the program would not correctly display the checks enabled by the top-level `.clang-tidy` file. +- Fixed some false positives in the ``readability-redundant-smartptr-get`` --

[clang-tools-extra] [clang-tidy] Fix formatting and add release notes entry (PR #141584)

2025-05-27 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor requested changes to this pull request. https://github.com/llvm/llvm-project/pull/141584 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] readability-redundant-smartptr-get: disable for smart pointers to arrays (PR #141092)

2025-05-24 Thread Baranov Victor via cfe-commits
@@ -44,7 +44,10 @@ internal::Matcher callToGet(const internal::Matcher &OnClass) { } internal::Matcher knownSmartptr() { - return recordDecl(hasAnyName("::std::unique_ptr", "::std::shared_ptr")); + return recordDecl( + hasAnyName("::std::unique_ptr", "::std::shared_ptr

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

2025-05-25 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,14 @@ +// RUN: %check_clang_tidy -std=c++23 %s readability-convert-member-functions-to-static %t + +namespace std{ + class string {}; + void println(const char *format, const std::string &str) {} +} + +namespace PR141381 { vbvictor wrote: Nit: don't

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

2025-05-25 Thread Baranov Victor via cfe-commits
@@ -62,6 +62,16 @@ AST_MATCHER(CXXMethodDecl, usesThis) { return false; // Stop traversal. } +bool VisitDeclRefExpr(const DeclRefExpr *E) { + if (const auto *PVD = dyn_cast_if_present(E->getDecl()); + PVD && PVD->isExplicitObjectParameter()) { +

[clang-tools-extra] [clang-tidy][clangd] Fixed removeFunctionArgs don't remove comma for use-ranges check (PR #118568)

2025-05-25 Thread Baranov Victor via cfe-commits
@@ -164,6 +165,24 @@ void UseRangesCheck::registerMatchers(MatchFinder *Finder) { static void removeFunctionArgs(DiagnosticBuilder &Diag, const CallExpr &Call, ArrayRef Indexes, const ASTContext &Ctx) { + const aut

[clang-tools-extra] [clang-tidy] added `AllowedTypes` option to `readability-qualified-auto` check (PR #136571)

2025-05-26 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor closed https://github.com/llvm/llvm-project/pull/136571 ___ 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 `AllowedTypes` option to `readability-qualified-auto` check (PR #136571)

2025-05-25 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/136571 >From ac83f555e2667c516bdd194d9006a2a7bc4d9af7 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Mon, 21 Apr 2025 18:29:28 +0300 Subject: [PATCH 1/2] added Allowed types to qualified-auto --- .../readabilit

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

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

[clang-tools-extra] [clang-tidy] Add check for assignment or comparision operators' operand in `readability-math-missing-parentheses` (PR #141345)

2025-05-26 Thread Baranov Victor via cfe-commits
vbvictor wrote: Please write "Closes https://github.com/llvm/llvm-project/issues/141249 (issue no)" at the end of PR description. It will automatically link the issue, which will be closed on merge. For now, I added it manually. https://github.com/llvm/llvm-project/pull/141345 ___

[clang-tools-extra] [clang-tidy] Add new `construct-reusable-objects-once` check (PR #131455)

2025-05-26 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/131455 >From 877c3a8c2a6e03d04d0a6b921a01a6f93aa43771 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sat, 15 Mar 2025 17:36:23 +0300 Subject: [PATCH 1/3] add new construct-reusable-objects-once check --- .../cl

[clang] [ASTMatchers][NFC] fix typos in AST-matchers docs. (PR #141307)

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

[clang] [ASTMatchers][NFC] fix typos in AST-matchers docs. (PR #141307)

2025-05-24 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/141307 >From 4ee68d62a21f75110b9406c86c9c059b1c2a840d Mon Sep 17 00:00:00 2001 From: Baranov Victor Date: Sat, 24 May 2025 03:17:57 +0300 Subject: [PATCH 1/2] [ASTMatchers][NFC] fix typos in AST-matchers docs. --- c

[clang] [clang][AST][NFC] fix spelling typos in clang AST files (PR #141346)

2025-05-24 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/141346 None >From d10598db7d58f0c06673c81b675924bb497792be Mon Sep 17 00:00:00 2001 From: Baranov Victor Date: Sat, 24 May 2025 17:12:21 +0300 Subject: [PATCH] [clang][AST][NFC] fix spelling typos in clang AST files

[clang-tools-extra] [clang-tidy] Added check 'bugprone-function-visibility-change' (PR #140086)

2025-05-24 Thread Baranov Victor via cfe-commits
=?utf-8?q?Balázs_Kéri?= , =?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/140086 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mail

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

2025-05-25 Thread Baranov Victor via cfe-commits
@@ -79,10 +79,10 @@ void ConvertMemberFunctionsToStatic::registerMatchers(MatchFinder *Finder) { cxxMethodDecl( isDefinition(), isUserProvided(), unless(anyOf( - isExpansionInSystemHeader(), isVirtual(), isStatic(), - hasTriv

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

2025-05-25 Thread Baranov Victor via cfe-commits
@@ -225,8 +257,9 @@ void PassByValueCheck::registerMatchers(MatchFinder *Finder) { .bind("Param"), hasDeclaration(cxxConstructorDecl( isCopyConstructor(), unless(isDeleted()), -

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

2025-05-25 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor approved this pull request. LGTM 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] Fix false positives with deducing this in `readability-convert-member-functions-to-static` check (PR #141391)

2025-05-25 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited 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] Fix false positives with deducing this in `readability-convert-member-functions-to-static` check (PR #141391)

2025-05-25 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,22 @@ +// RUN: %check_clang_tidy -std=c++23 %s readability-convert-member-functions-to-static %t vbvictor wrote: ```suggestion // RUN: %check_clang_tidy -std=c++23-or-later %s readability-convert-member-functions-to-static %t ``` https://github.com/

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

2025-05-25 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited 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] properly handle private move constructors in `modernize-pass-by-value` check (PR #141304)

2025-05-25 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited 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] properly handle private move constructors in `modernize-pass-by-value` check (PR #141304)

2025-05-25 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited 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] [ASTMatchers][NFC] fix typos in AST-matchers docs. (PR #141307)

2025-05-24 Thread Baranov Victor via cfe-commits
vbvictor wrote: P.S. Found these typos using [CSpell](https://cspell.org/) utility. https://github.com/llvm/llvm-project/pull/141307 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ASTMatchers][NFC] fix typos in AST-matchers docs. (PR #141307)

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

[clang-tools-extra] [clang-tidy][clangd] Fixed removeFunctionArgs don't remove comma for use-ranges check (PR #118568)

2025-05-24 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor requested changes to this pull request. https://github.com/llvm/llvm-project/pull/118568 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][clangd] Fixed removeFunctionArgs don't remove comma for use-ranges check (PR #118568)

2025-05-24 Thread Baranov Victor via cfe-commits
@@ -164,6 +165,24 @@ void UseRangesCheck::registerMatchers(MatchFinder *Finder) { static void removeFunctionArgs(DiagnosticBuilder &Diag, const CallExpr &Call, ArrayRef Indexes, const ASTContext &Ctx) { + const aut

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