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

2025-01-13 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL requested changes to this pull request. Should be readability-stringview-substr There are already 2 other checks that use "stringview" instead of "string-view". https://github.com/llvm/llvm-project/pull/120055 ___ cfe-commit

[clang-tools-extra] Add bugprone-sprintf-argument-overlap (PR #114244)

2025-01-13 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,106 @@ +//===--- SprintfArgumentOverlapCheck.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: Apac

[clang-tools-extra] Add bugprone-sprintf-argument-overlap (PR #114244)

2025-01-13 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,40 @@ +//===--- SprintfArgumentOverlapCheck.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] Add bugprone-sprintf-argument-overlap (PR #114244)

2025-01-13 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/114244 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Add bugprone-sprintf-argument-overlap (PR #114244)

2025-01-13 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/114244 ___ 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-01-13 Thread Piotr Zegar via cfe-commits
@@ -164,6 +164,33 @@ void UseRangesCheck::registerMatchers(MatchFinder *Finder) { static void removeFunctionArgs(DiagnosticBuilder &Diag, const CallExpr &Call, ArrayRef Indexes, const ASTContext &Ctx) { + auto GetC

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

2025-01-13 Thread Piotr Zegar via cfe-commits
@@ -173,22 +200,27 @@ static void removeFunctionArgs(DiagnosticBuilder &Diag, const CallExpr &Call, for (unsigned Index : Sorted) { const Expr *Arg = Call.getArg(Index); if (Commas[Index]) { - if (Index >= Commas.size()) { -Diag << FixItHint::CreateRemov

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

2025-01-13 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved 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-01-13 Thread Piotr Zegar via cfe-commits
@@ -164,6 +164,33 @@ void UseRangesCheck::registerMatchers(MatchFinder *Finder) { static void removeFunctionArgs(DiagnosticBuilder &Diag, const CallExpr &Call, ArrayRef Indexes, const ASTContext &Ctx) { + auto GetC

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

2025-01-13 Thread Piotr Zegar via cfe-commits
@@ -164,6 +164,33 @@ void UseRangesCheck::registerMatchers(MatchFinder *Finder) { static void removeFunctionArgs(DiagnosticBuilder &Diag, const CallExpr &Call, ArrayRef Indexes, const ASTContext &Ctx) { + auto GetC

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

2025-01-13 Thread Piotr Zegar via cfe-commits
@@ -164,6 +164,33 @@ void UseRangesCheck::registerMatchers(MatchFinder *Finder) { static void removeFunctionArgs(DiagnosticBuilder &Diag, const CallExpr &Call, ArrayRef Indexes, const ASTContext &Ctx) { + auto GetC

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

2025-01-13 Thread Piotr Zegar via cfe-commits
@@ -356,6 +356,11 @@ Changes in existing checks ` check to validate ``namespace`` aliases. +- Improved :doc:`modernize-use-ranges PiotrZSL wrote: move to line 307, and best would be to split it into 2 entry, one for boost, and other for modernize https:

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

2025-01-13 Thread Piotr Zegar via cfe-commits
@@ -164,6 +164,33 @@ void UseRangesCheck::registerMatchers(MatchFinder *Finder) { static void removeFunctionArgs(DiagnosticBuilder &Diag, const CallExpr &Call, ArrayRef Indexes, const ASTContext &Ctx) { + auto GetC

[clang-tools-extra] [clang-tidy] Add `performance-explicit-move-constructor` check (PR #122599)

2025-01-13 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/122599 ___ 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-explicit-move-constructor` check (PR #122599)

2025-01-13 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,73 @@ +//===--- ExplicitMoveConstructorCheck.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 `performance-explicit-move-constructor` check (PR #122599)

2025-01-12 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL commented: To be honest, best would be flag calls to copy constructors that take rvalue where move constructor exists. In such case it would found actual performance issues. But still this kind of check is fine. https://github.com/llvm/llvm-project/pull/122599

[clang-tools-extra] [clang-tidy] Add `performance-explicit-move-constructor` check (PR #122599)

2025-01-12 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/122599 ___ 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-explicit-move-constructor` check (PR #122599)

2025-01-12 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,73 @@ +//===--- ExplicitMoveConstructorCheck.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 `performance-explicit-move-constructor` check (PR #122599)

2025-01-12 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,34 @@ +// RUN: %check_clang_tidy %s performance-explicit-move-constructor %t + +class NotReported1 {}; + +class NotReported2 { +public: + NotReported2(NotReported2&&) = default; + NotReported2(const NotReported2&) = default; +}; + +class NotReported3 { +public: + exp

[clang-tools-extra] [clang-tidy] Create bugprone-incorrect-enable-shared-from-this check (PR #102299)

2025-01-12 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL closed https://github.com/llvm/llvm-project/pull/102299 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] performance-unnecessary-copy-initialization: Consider static functions (PR #119974)

2025-01-12 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL closed https://github.com/llvm/llvm-project/pull/119974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] performance-unnecessary-copy-initialization: Consider static functions (PR #119974)

2025-01-12 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. https://github.com/llvm/llvm-project/pull/119974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][doc] combine the clang-tidy itself's change together in release note (PR #122594)

2025-01-11 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. https://github.com/llvm/llvm-project/pull/122594 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] exclude CXXParenListInitExpr from RedundantCastingCheck (PR #109741)

2025-01-11 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL closed https://github.com/llvm/llvm-project/pull/109741 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] exclude CXXParenListInitExpr from RedundantCastingCheck (PR #109741)

2025-01-11 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/109741 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] exclude CXXParenListInitExpr from RedundantCastingCheck (PR #109741)

2025-01-11 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: > Actually, shouldn't this check instead change an explicit cast for a > `CXXParenListExpr` from `static_cast(42)` to `C(42)` Yes, but that's secondary. As in such case this could be seen as an FunctionalCast. https://github.com/llvm/llvm-project/pull/109741

[clang-tools-extra] [clang-tidy] exclude CXXParenListInitExpr from RedundantCastingCheck (PR #109741)

2025-01-11 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. https://github.com/llvm/llvm-project/pull/109741 ___ 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 incorrect configuration file path resolving when file paths contain `..` (PR #121323)

2025-01-11 Thread Piotr Zegar via cfe-commits
@@ -117,6 +117,9 @@ Improvements to clang-tidy - Improved :program:`clang-tidy` by accepting parameters file in command line. +- Improved :program:`clang-tidy` by fixing incorrect configuration file path PiotrZSL wrote: Note: to be honest all those 'Improved

[clang-tools-extra] [clang-tidy] Fix modernize-use-integer-sign-comparison comparison (PR #121506)

2025-01-11 Thread Piotr Zegar via cfe-commits
@@ -80,16 +80,19 @@ UseIntegerSignComparisonCheck::UseIntegerSignComparisonCheck( : ClangTidyCheck(Name, Context), IncludeInserter(Options.getLocalOrGlobal("IncludeStyle", utils::IncludeSorter::IS_LLVM), -

[clang-tools-extra] [clang-tidy] Mention std::forward_list in container-size-empty doc (PR #120701)

2025-01-11 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL closed https://github.com/llvm/llvm-project/pull/120701 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Mention std::forward_list in container-size-empty doc (PR #120701)

2025-01-11 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/120701 ___ 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 incorrect configuration file path resolving when file paths contain `..` (PR #121323)

2025-01-11 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. Functionally ok. https://github.com/llvm/llvm-project/pull/121323 ___ 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 incorrect configuration file path resolving when file paths contain `..` (PR #121323)

2025-01-11 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/121323 ___ 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 modernize-use-integer-sign-comparison comparison (PR #121506)

2025-01-11 Thread Piotr Zegar via cfe-commits
@@ -34,3 +34,7 @@ Options A string specifying which include-style is used, `llvm` or `google`. Default is `llvm`. + +.. option:: ConsideringIntegerSize + Ignores a comparison between a signed wide and an unsigned narrow PiotrZSL wrote: i think there shou

[clang-tools-extra] [clang-tidy] Fix modernize-use-integer-sign-comparison comparison (PR #121506)

2025-01-11 Thread Piotr Zegar via cfe-commits
@@ -126,6 +126,14 @@ class ModernizeModule : public ClangTidyModule { "modernize-use-uncaught-exceptions"); CheckFactories.registerCheck("modernize-use-using"); } + + ClangTidyOptions getModuleOptions() override { +ClangTidyOptions Options; +Options.Check

[clang-tools-extra] [clang-tidy] Fix modernize-use-integer-sign-comparison comparison (PR #121506)

2025-01-11 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL requested changes to this pull request. Few small nits, but functionally ok. https://github.com/llvm/llvm-project/pull/121506 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/lis

[clang-tools-extra] [clang-tidy] Fix modernize-use-integer-sign-comparison comparison (PR #121506)

2025-01-11 Thread Piotr Zegar via cfe-commits
@@ -301,6 +301,11 @@ Changes in existing checks ` check to fix a crash when a class is declared but not defined. +- Improved :doc:`modernize-use-integer-sign-comparison + ` check to + add an option ``ConsideringIntegerSize``, that ignores a comparison between ---

[clang-tools-extra] [clang-tidy] Fix modernize-use-integer-sign-comparison comparison (PR #121506)

2025-01-11 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/121506 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Address false positives in misc-redundant-expression checker (PR #121960)

2025-01-11 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/121960 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Address false positives in misc-redundant-expression checker (PR #121960)

2025-01-11 Thread Piotr Zegar via cfe-commits
@@ -747,6 +747,31 @@ static bool areSidesBinaryConstExpressions(const BinaryOperator *&BinOp, const A return false; } +static bool +areSidesBinaryConstExpressionsOrDefines(const BinaryOperator *&BinOp, +const ASTContext *AstCtx) { +

[clang-tools-extra] [clang-tidy] Address false positives in misc-redundant-expression checker (PR #121960)

2025-01-11 Thread Piotr Zegar via cfe-commits
@@ -852,6 +877,58 @@ static bool areExprsMacroAndNonMacro(const Expr *&LhsExpr, return LhsLoc.isMacroID() != RhsLoc.isMacroID(); } + +static bool areExprsSameMacroOrLiteral(const BinaryOperator *BinOp, + const ASTContext *Context) { + +

[clang-tools-extra] [clang-tidy] Address false positives in misc-redundant-expression checker (PR #121960)

2025-01-11 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL requested changes to this pull request. Overall, may require some small work to make sure that code is straightforward and simple. As for functionality part, still has some gaps or redundant parts, but that is not a blocker. Please try to refactor your changes to be

[clang-tools-extra] [clang-tidy] Address false positives in misc-redundant-expression checker (PR #121960)

2025-01-11 Thread Piotr Zegar via cfe-commits
@@ -747,6 +747,31 @@ static bool areSidesBinaryConstExpressions(const BinaryOperator *&BinOp, const A return false; } +static bool +areSidesBinaryConstExpressionsOrDefines(const BinaryOperator *&BinOp, +const ASTContext *AstCtx) { +

[clang-tools-extra] [clang-tidy] Add QtEnabled option to modernize-use-integer-sign-comprison (PR #122127)

2025-01-11 Thread Piotr Zegar via cfe-commits
@@ -80,11 +80,13 @@ UseIntegerSignComparisonCheck::UseIntegerSignComparisonCheck( : ClangTidyCheck(Name, Context), IncludeInserter(Options.getLocalOrGlobal("IncludeStyle", utils::IncludeSorter::IS_LLVM), -

[clang-tools-extra] [clang-tidy] Add QtEnabled option to modernize-use-integer-sign-comprison (PR #122127)

2025-01-11 Thread Piotr Zegar via cfe-commits
@@ -30,11 +30,12 @@ class UseIntegerSignComparisonCheck : public ClangTidyCheck { void registerMatchers(ast_matchers::MatchFinder *Finder) override; void check(const ast_matchers::MatchFinder::MatchResult &Result) override; bool isLanguageVersionSupported(const LangOptio

[clang-tools-extra] [clang-tidy] Add QtEnabled option to modernize-use-integer-sign-comprison (PR #122127)

2025-01-11 Thread Piotr Zegar via cfe-commits
@@ -154,8 +156,16 @@ void UseIntegerSignComparisonCheck::check( DiagnosticBuilder Diag = diag(BinaryOp->getBeginLoc(), "comparison between 'signed' and 'unsigned' integers"); - const std::string CmpNamespace = ("std::" + parseOpCode(OpCode)).str(); - const

[clang-tools-extra] [clang-tidy] Add QtEnabled option to modernize-use-integer-sign-comprison (PR #122127)

2025-01-11 Thread Piotr Zegar via cfe-commits
@@ -154,8 +156,16 @@ void UseIntegerSignComparisonCheck::check( DiagnosticBuilder Diag = diag(BinaryOp->getBeginLoc(), "comparison between 'signed' and 'unsigned' integers"); - const std::string CmpNamespace = ("std::" + parseOpCode(OpCode)).str(); - const

[clang-tools-extra] [clang-tidy] Add QtEnabled option to modernize-use-integer-sign-comprison (PR #122127)

2025-01-11 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. Except pointed out nits, looks fine. https://github.com/llvm/llvm-project/pull/122127 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-co

[clang-tools-extra] [clang-tidy] Add QtEnabled option to modernize-use-integer-sign-comprison (PR #122127)

2025-01-11 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/122127 ___ 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 a release note about unchecked-optional-access smart pointer caching (PR #122290)

2025-01-11 Thread Piotr Zegar via cfe-commits
@@ -81,10 +81,12 @@ Exception: accessor methods The check assumes *accessor* methods of a class are stable, with a heuristic to determine which methods are accessors. Specifically, parameter-free ``const`` -methods are treated as accessors. Note that this is not guaranteed to

[clang-tools-extra] [clang-tidy] Add a release note about unchecked-optional-access smart pointer caching (PR #122290)

2025-01-11 Thread Piotr Zegar via cfe-commits
@@ -232,6 +232,10 @@ Changes in existing checks ` to support `bsl::optional` and `bdlb::NullableValue` from _. + Fixed false positives from smart pointer accessors repeated in checking + ``has_value`` and accessing ``value``, by caching

[clang-tools-extra] [clang-tidy] use correct template type in ``std::min`` and ``std::max`` when operand is integer literal for readability-use-std-min-max (PR #122296)

2025-01-11 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. LGTM. https://github.com/llvm/llvm-project/pull/122296 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] remove never used IgnoreCase in option (PR #122573)

2025-01-11 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/122573 ___ 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 when using name-independent variables after C++26 for bugprone-unused-local-non-trivial-variable (PR #121783)

2025-01-08 Thread Piotr Zegar via cfe-commits
@@ -29,6 +29,12 @@ static constexpr StringRef DefaultIncludeTypeRegex = AST_MATCHER(VarDecl, isLocalVarDecl) { return Node.isLocalVarDecl(); } AST_MATCHER(VarDecl, isReferenced) { return Node.isReferenced(); } +AST_MATCHER_P(VarDecl, explicitMarkUnused, LangOptions, LangOpts)

[clang-tools-extra] [clang-tidy] Fix modernize-use-integer-sign-comparison comparison (PR #121506)

2025-01-03 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/121506 ___ 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 modernize-use-integer-sign-comparison comparison (PR #121506)

2025-01-03 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL commented: Missing: - Documentation entry to tell user about this behavior To be considered: - Configuration option to enable/disable this behavior https://github.com/llvm/llvm-project/pull/121506 ___ cfe-commits mailing li

[clang-tools-extra] [clang-tidy] Create bugprone-incorrect-enable-shared-from-this check (PR #102299)

2025-01-01 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,34 @@ +.. title:: clang-tidy - bugprone-incorrect-enable-shared-from-this + +bugprone-incorrect-enable-shared-from-this +== + +Detect classes or structs that do not publicly inherit from +``std::enable_shared_from_this``, because

[clang-tools-extra] [clang-tidy] Create bugprone-incorrect-enable-shared-from-this check (PR #102299)

2025-01-01 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,64 @@ +//===--- IncorrectEnableSharedFromThisCheck.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] Create bugprone-incorrect-enable-shared-from-this check (PR #102299)

2025-01-01 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/102299 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Create bugprone-incorrect-enable-shared-from-this check (PR #102299)

2025-01-01 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,180 @@ +// RUN: %check_clang_tidy -std=c++11 %s bugprone-incorrect-enable-shared-from-this %t PiotrZSL wrote: Note: you could use -std=c+=11-or-later to fix problems with check in more modern C++ https://github.com/llvm/llvm-project/pull/102299

[clang-tools-extra] [clang-tidy] Create bugprone-incorrect-enable-shared-from-this check (PR #102299)

2025-01-01 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/102299 ___ 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-reset-call check (PR #121291)

2024-12-29 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL requested changes to this pull request. 1. Consider TK_IgnoreUnlessSpelledInSource, may simplify matchers 2. Name is too generic, consider: - bugprone-smartptr-reset-pointee-reset - bugprone-smartptr-reset-call - bugprone-smartptr-pointee-reset - bugprone-smartptr-

[clang-tools-extra] [clang-tidy] support parameters file in command line (PR #120547)

2024-12-19 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. https://github.com/llvm/llvm-project/pull/120547 ___ 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 parameters file in command line (PR #120547)

2024-12-19 Thread Piotr Zegar via cfe-commits
@@ -553,6 +555,20 @@ static llvm::IntrusiveRefCntPtr createBaseFS() { int clangTidyMain(int argc, const char **argv) { llvm::InitLLVM X(argc, argv); + SmallVector Args{argv, argv + argc}; + + llvm::BumpPtrAllocator Alloc; + llvm::cl::TokenizerCallback Tokenizer = +

[clang-tools-extra] Added options to readability-implicit-bool-conversion (PR #120087)

2024-12-19 Thread Piotr Zegar via cfe-commits
@@ -319,10 +319,16 @@ Changes in existing checks diagnostic. - Improved :doc:`readability-implicit-bool-conversion - ` check - by adding the option `UseUpperCaseLiteralSuffix` to select the - case of the literal suffix in fixes and fixing false positive for implicit - co

[clang-tools-extra] Added options to readability-implicit-bool-conversion (PR #120087)

2024-12-19 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/120087 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Added options to readability-implicit-bool-conversion (PR #120087)

2024-12-19 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. Except pointed out findings, looks ok. https://github.com/llvm/llvm-project/pull/120087 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-

[clang-tools-extra] Added options to readability-implicit-bool-conversion (PR #120087)

2024-12-19 Thread Piotr Zegar via cfe-commits
@@ -259,100 +259,118 @@ ImplicitBoolConversionCheck::ImplicitBoolConversionCheck( AllowIntegerConditions(Options.get("AllowIntegerConditions", false)), AllowPointerConditions(Options.get("AllowPointerConditions", false)), UseUpperCaseLiteralSuffix( -

[clang-tools-extra] Added options to readability-implicit-bool-conversion (PR #120087)

2024-12-17 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,86 @@ +// RUN: %check_clang_tidy %s readability-implicit-bool-conversion %t + +// RUN: %check_clang_tidy %s readability-implicit-bool-conversion %t \ +// RUN: -- -config='{CheckOptions: [{key: readability-implicit-bool-conversion.CheckConversionsToBool, value: false},

[clang-tools-extra] Added options to readability-implicit-bool-conversion (PR #120087)

2024-12-17 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/120087 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Added options to readability-implicit-bool-conversion (PR #120087)

2024-12-17 Thread Piotr Zegar via cfe-commits
@@ -357,20 +360,22 @@ void ImplicitBoolConversionCheck::registerMatchers(MatchFinder *Finder) { void ImplicitBoolConversionCheck::check( const MatchFinder::MatchResult &Result) { - + if(CheckConversionsToBool){ PiotrZSL wrote: Wrong, place these things

[clang-tools-extra] Added options to readability-implicit-bool-conversion (PR #120087)

2024-12-17 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL requested changes to this pull request. - reformat code - missing release notes entry about new options added - missing documentation for newly added options - change should be in registerMatchers method https://github.com/llvm/llvm-project/pull/120087 ___

[clang-tools-extra] [clang-tidy]detecting conversion directly by `make_unique` and `make_shared` in bugprone-optional-value-conversion (PR #119371)

2024-12-10 Thread Piotr Zegar via cfe-commits
@@ -12,20 +12,44 @@ #include "../utils/OptionsUtils.h" #include "clang/AST/ASTContext.h" #include "clang/ASTMatchers/ASTMatchFinder.h" +#include using namespace clang::ast_matchers; +using clang::ast_matchers::internal::Matcher; namespace clang::tidy::bugprone { names

[clang-tools-extra] [clang-tidy]detecting conversion directly by `make_unique` and `make_shared` in bugprone-optional-value-conversion (PR #119371)

2024-12-10 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL commented: Note: Probably also std::make_optional could be supported. Please improve performance - avoid creating temporary matchers on every match. Except above, looks fine. https://github.com/llvm/llvm-project/pull/119371 ___

[clang-tools-extra] [clang-tidy]detecting conversion directly by `make_unique` and `make_shared` in bugprone-optional-value-conversion (PR #119371)

2024-12-10 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/119371 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy]detecting conversion directly by `make_unique` and `make_shared` in bugprone-optional-value-conversion (PR #119371)

2024-12-10 Thread Piotr Zegar via cfe-commits
@@ -12,20 +12,44 @@ #include "../utils/OptionsUtils.h" #include "clang/AST/ASTContext.h" #include "clang/ASTMatchers/ASTMatchFinder.h" +#include using namespace clang::ast_matchers; +using clang::ast_matchers::internal::Matcher; namespace clang::tidy::bugprone { names

[clang-tools-extra] [clang-tidy][NFC] simplify matchers in bugprone-optional-value-conversion (PR #119346)

2024-12-10 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/119346 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fix a bug with the hasAncestor AST matcher when a node has several parents without pointer identity (PR #118511)

2024-12-03 Thread Piotr Zegar via cfe-commits
@@ -1237,7 +1237,8 @@ class MatchASTVisitor : public RecursiveASTVisitor, // Make sure we do not visit the same node twice. // Otherwise, we'll visit the common ancestors as often as there // are splits on the way down. - if (Visited.inse

[clang] Fix a bug with the hasAncestor AST matcher when a node has several parents without pointer identity (PR #118511)

2024-12-03 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. In general change looks reasonable. https://github.com/llvm/llvm-project/pull/118511 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-co

[clang] Fix a bug with the hasAncestor AST matcher when a node has several parents without pointer identity (PR #118511)

2024-12-03 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/118511 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][docs] improve documentation on cppcoreguidelines-narrowing-conversions (#111510) (PR #118209)

2024-12-01 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/118209 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][docs] improve documentation on cppcoreguidelines-narrowing-conversions (#111510) (PR #118209)

2024-12-01 Thread Piotr Zegar via cfe-commits
@@ -27,6 +27,29 @@ This check will flag: - All applications of binary operators with a narrowing conversions. For example: ``int i; i+= 0.1;``. +Note that arithmetic with integer types may perform implicit conversions if the used integer types are smaller than ``int``. +T

[clang-tools-extra] [clang-tidy][docs] improve documentation on cppcoreguidelines-narrowing-conversions (#111510) (PR #118209)

2024-12-01 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL requested changes to this pull request. - Formatting - Please think about simplifying this. https://github.com/llvm/llvm-project/pull/118209 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-

[clang-tools-extra] [clang-tidy][docs] improve documentation on cppcoreguidelines-narrowing-conversions (#111510) (PR #118209)

2024-12-01 Thread Piotr Zegar via cfe-commits
@@ -27,6 +27,29 @@ This check will flag: - All applications of binary operators with a narrowing conversions. For example: ``int i; i+= 0.1;``. +Note that arithmetic with integer types may perform implicit conversions if the used integer types are smaller than ``int``. +T

[clang-tools-extra] [clang-tidy][docs] improve documentation on cppcoreguidelines-narrowing-conversions (#111510) (PR #118209)

2024-12-01 Thread Piotr Zegar via cfe-commits
@@ -27,6 +27,29 @@ This check will flag: - All applications of binary operators with a narrowing conversions. For example: ``int i; i+= 0.1;``. +Note that arithmetic with integer types may perform implicit conversions if the used integer types are smaller than ``int``. --

[clang-tools-extra] [clang-tidy][docs] improve documentation on cppcoreguidelines-narrowing-conversions (#111510) (PR #118209)

2024-12-01 Thread Piotr Zegar via cfe-commits
@@ -27,6 +27,29 @@ This check will flag: - All applications of binary operators with a narrowing conversions. For example: ``int i; i+= 0.1;``. +Note that arithmetic with integer types may perform implicit conversions if the used integer types are smaller than ``int``. --

[clang] [clang-tools-extra] [clang-tidy][use-internal-linkage]fix false positives for ExportDecl (PR #117901)

2024-11-30 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. https://github.com/llvm/llvm-project/pull/117901 ___ 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][use-internal-linkage]fix false positives for ExportDecl (PR #117901)

2024-11-27 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/117901 ___ 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][use-internal-linkage]fix false positives for ExportDecl (PR #117901)

2024-11-27 Thread Piotr Zegar via cfe-commits
@@ -1236,6 +1236,17 @@ AST_MATCHER_P(TemplateArgument, equalsIntegralValue, extern const internal::VariadicDynCastAllOfMatcher autoreleasePoolStmt; +/// Matches any export declaration. +/// +/// Example matches following declarations. +/// \code +/// export void foo(); +///

[clang] [clang-tools-extra] [clang-tidy][use-internal-linkage]fix false positives for ExportDecl (PR #117901)

2024-11-27 Thread Piotr Zegar via cfe-commits
@@ -1236,6 +1236,17 @@ AST_MATCHER_P(TemplateArgument, equalsIntegralValue, extern const internal::VariadicDynCastAllOfMatcher autoreleasePoolStmt; +/// Matches any export declaration. +/// +/// Example matches following declarations. +/// \code +/// export void foo(); +///

[clang] [clang-tools-extra] [clang-tidy][use-internal-linkage]fix false positives for ExportDecl (PR #117901)

2024-11-27 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL requested changes to this pull request. Documentation & Test for matcher is missing. Except that everything looks ok. https://github.com/llvm/llvm-project/pull/117901 ___ cfe-commits mailing list cfe-commits@lists.llvm.org h

[clang-tools-extra] [clang-tidy] fix false positive in bugprone-return-const-ref-from-parameter (PR #117734)

2024-11-26 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL requested changes to this pull request. Please add positive test for lambdas. https://github.com/llvm/llvm-project/pull/117734 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/li

[clang-tools-extra] [clang-tidy] fix false positive in bugprone-return-const-ref-from-parameter (PR #117734)

2024-11-26 Thread Piotr Zegar via cfe-commits
@@ -18,14 +18,17 @@ namespace clang::tidy::bugprone { void ReturnConstRefFromParameterCheck::registerMatchers(MatchFinder *Finder) { const auto DRef = ignoringParens( declRefExpr( - to(parmVarDecl(hasType(hasCanonicalType( - qualType

[clang-tools-extra] [clang-tidy] fix false positive in bugprone-return-const-ref-from-parameter (PR #117734)

2024-11-26 Thread Piotr Zegar via cfe-commits
@@ -151,6 +151,12 @@ void instantiate(const int ¶m, const float ¶mf, int &mut_param, float &m itf6(mut_paramf); } +template +void f(const T& t) { +const auto get = [&t] -> const T& { return t; }; +return T{}; +} PiotrZSL wrote: Please add tes

[clang-tools-extra] [clang-tidy] Adjust size-empty doc because C++11 size() is constant-time (PR #117629)

2024-11-26 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/117629 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Adjust size-empty doc because C++11 size() is constant-time (PR #117629)

2024-11-25 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: You understand that this check does not apply only to std:: containers but also to boost and other custom one that have size and empty methods. In such case claim is still valid. If you change check description, then check documentation also should be updated to be in sync. ht

[clang-tools-extra] Rename CODE_OWNERS -> Maintainers (PR #114544)

2024-11-25 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/114544 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Rename CODE_OWNERS -> Maintainers (PR #114544)

2024-11-25 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,72 @@ += +Clang Tools Extra Maintainers += + +This file is a list of the maintainers +(https://llvm.org/docs/DeveloperPolicy.html#maintainers) for clang-tools-extra. + + +Active Maintainers +== +The

[clang-tools-extra] Rename CODE_OWNERS -> Maintainers (PR #114544)

2024-11-25 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL commented: Hmm, Then you may consider adding me. https://github.com/llvm/llvm-project/pull/114544 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] WIP: [clang-tidy] Add SmartPtrName to MakeSmartPtrCheck for flexible … (PR #117529)

2024-11-25 Thread Piotr Zegar via cfe-commits
@@ -26,6 +26,9 @@ namespace clang::tidy::modernize { /// For the user-facing documentation see: /// http://clang.llvm.org/extra/clang-tidy/checks/modernize/make-shared.html class MakeSharedCheck : public MakeSmartPtrCheck { +private: + const StringRef MakeSmartPtrType; ---

  1   2   3   4   5   6   7   8   9   10   >