[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] 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 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] 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 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
@@ -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
@@ -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
@@ -80,16 +80,19 @@ UseIntegerSignComparisonCheck::UseIntegerSignComparisonCheck( : ClangTidyCheck(Name, Context), IncludeInserter(Options.getLocalOrGlobal("IncludeStyle", utils::IncludeSorter::IS_LLVM), -

[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 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] 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] 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
@@ -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
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
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] 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] 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 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] 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] 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] 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] 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] 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] 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] 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
@@ -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
@@ -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
@@ -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
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
@@ -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 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] 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] 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][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] Add ClangQueryChecks config option (PR #123734)

2025-01-21 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL requested changes to this pull request. Additionally: - more detailed documentation needed (entire section in documentation) - i would name it CustomChecks instead - need protection against check name conflicts, and maybe some protection for adding checks for current

[clang-tools-extra] [clang-tidy] Add ClangQueryChecks config option (PR #123734)

2025-01-21 Thread Piotr Zegar via cfe-commits
@@ -292,6 +292,18 @@ An overview of all the command-line options: Checks - Same as '--checks'. Additionally, the list of globs can be specified as a list instead of a string. +

[clang-tools-extra] [clang-tidy] Add ClangQueryChecks config option (PR #123734)

2025-01-21 Thread Piotr Zegar via cfe-commits
@@ -140,6 +140,9 @@ Improvements to clang-tidy :doc:`readability-redundant-access-specifiers `, CheckFirstDeclaration :doc:`readability-redundant-casting `, IgnoreTypeAliases +- New :program:`clang-tidy` config property `ClangQueryChecks` that allows adding ---

[clang-tools-extra] [clang-tidy] Add ClangQueryChecks config option (PR #123734)

2025-01-21 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,43 @@ +//===--- ClangQueryCheck.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: Apache-2.

[clang-tools-extra] [clang-tidy] Add ClangQueryChecks config option (PR #123734)

2025-01-21 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,53 @@ +// DEFINE: %{custom-call-yaml} = custom-call: 'm callExpr().bind(\"Custom message\")' +// +// DEFINE: %{custom-let-call-yaml} = custom-let-call: \" \ +// DEFINE: let expr varDecl( \ +// DEFINE: hasType(asString(\

[clang-tools-extra] [clang-tidy] Add ClangQueryChecks config option (PR #123734)

2025-01-21 Thread Piotr Zegar via cfe-commits
@@ -292,6 +292,18 @@ An overview of all the command-line options: Checks - Same as '--checks'. Additionally, the list of globs can be specified as a list instead of a string. +

[clang-tools-extra] [clang-tidy] Add ClangQueryChecks config option (PR #123734)

2025-01-21 Thread Piotr Zegar via cfe-commits
@@ -38,6 +39,7 @@ clang_target_link_libraries(clangTidy clangSerialization clangTooling clangToolingCore + clangQuery PiotrZSL wrote: this introduces new dependency, how it will impact for example clangd ? will those checks work there ? https://github.

[clang-tools-extra] [clang-tidy] Add ClangQueryChecks config option (PR #123734)

2025-01-21 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/123734 ___ 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 ClangQueryChecks config option (PR #123734)

2025-01-21 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: Additionally, consider implementing this as an "module" (like bugprone), simply implement factory that would look into config options that start with "custom-" and then parse options like: Source, Message, Language, and based on that construct checks, gain is that dependency on

[clang] [clang-tools-extra] [ASTMatchers][NFC] use `Matcher` instead of `DynTypedMatcher` in `TypeLocTypeMatcher` (PR #123450)

2025-01-22 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. https://github.com/llvm/llvm-project/pull/123450 ___ 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] Address false positives in misc-redundant-expression checker (PR #122841)

2025-01-20 Thread Piotr Zegar via cfe-commits
@@ -847,11 +869,104 @@ static bool areExprsMacroAndNonMacro(const Expr *&LhsExpr, if (!LhsExpr || !RhsExpr) return false; - SourceLocation LhsLoc = LhsExpr->getExprLoc(); - SourceLocation RhsLoc = RhsExpr->getExprLoc(); + const SourceLocation LhsLoc = LhsExpr->getExp

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

2025-01-20 Thread Piotr Zegar via cfe-commits
@@ -847,11 +869,104 @@ static bool areExprsMacroAndNonMacro(const Expr *&LhsExpr, if (!LhsExpr || !RhsExpr) return false; - SourceLocation LhsLoc = LhsExpr->getExprLoc(); - SourceLocation RhsLoc = RhsExpr->getExprLoc(); + const SourceLocation LhsLoc = LhsExpr->getExp

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

2025-01-20 Thread Piotr Zegar via cfe-commits
@@ -847,11 +869,104 @@ static bool areExprsMacroAndNonMacro(const Expr *&LhsExpr, if (!LhsExpr || !RhsExpr) return false; - SourceLocation LhsLoc = LhsExpr->getExprLoc(); - SourceLocation RhsLoc = RhsExpr->getExprLoc(); + const SourceLocation LhsLoc = LhsExpr->getExp

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

2025-01-20 Thread Piotr Zegar via cfe-commits
@@ -847,11 +869,104 @@ static bool areExprsMacroAndNonMacro(const Expr *&LhsExpr, if (!LhsExpr || !RhsExpr) return false; - SourceLocation LhsLoc = LhsExpr->getExprLoc(); - SourceLocation RhsLoc = RhsExpr->getExprLoc(); + const SourceLocation LhsLoc = LhsExpr->getExp

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

2025-01-20 Thread Piotr Zegar via cfe-commits
@@ -847,11 +869,104 @@ static bool areExprsMacroAndNonMacro(const Expr *&LhsExpr, if (!LhsExpr || !RhsExpr) return false; - SourceLocation LhsLoc = LhsExpr->getExprLoc(); - SourceLocation RhsLoc = RhsExpr->getExprLoc(); + const SourceLocation LhsLoc = LhsExpr->getExp

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

2025-01-20 Thread Piotr Zegar via cfe-commits
@@ -847,11 +869,104 @@ static bool areExprsMacroAndNonMacro(const Expr *&LhsExpr, if (!LhsExpr || !RhsExpr) return false; - SourceLocation LhsLoc = LhsExpr->getExprLoc(); - SourceLocation RhsLoc = RhsExpr->getExprLoc(); + const SourceLocation LhsLoc = LhsExpr->getExp

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

2025-01-20 Thread Piotr Zegar via cfe-commits
@@ -847,11 +869,104 @@ static bool areExprsMacroAndNonMacro(const Expr *&LhsExpr, if (!LhsExpr || !RhsExpr) return false; - SourceLocation LhsLoc = LhsExpr->getExprLoc(); - SourceLocation RhsLoc = RhsExpr->getExprLoc(); + const SourceLocation LhsLoc = LhsExpr->getExp

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

2025-01-20 Thread Piotr Zegar via cfe-commits
@@ -1250,6 +1250,9 @@ Improvements - Improved the handling of the ``ownership_returns`` attribute. Now, Clang reports an error if the attribute is attached to a function that returns a non-pointer value. Fixes (#GH99501) +- Improved ``misc-redundant-expression`` checker p

[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] 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
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
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] 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
@@ -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 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
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
@@ -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
@@ -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][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] 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] [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-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] 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] 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] 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] 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
@@ -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 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] 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] Add recursion protection in ExceptionSpecAnalyzer (PR #66810)

2025-02-12 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL updated https://github.com/llvm/llvm-project/pull/66810 >From 4c4234a2c4c3e7a164befe5c89361f89ebd9728d Mon Sep 17 00:00:00 2001 From: Piotr Zegar Date: Tue, 19 Sep 2023 19:05:00 + Subject: [PATCH] [clang-tidy] Add recursion protection in ExceptionSpecAnalyzer N

[clang-tools-extra] [clang-tidy] Avoid repeated map lookups (NFC) (PR #127167)

2025-02-14 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. https://github.com/llvm/llvm-project/pull/127167 ___ 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 recursion protection in ExceptionSpecAnalyzer (PR #66810)

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

[clang-tools-extra] [tool] Remove legacy argument `-ignore-insert-conflict` from `run-clang-tidy.py` (PR #127066)

2025-02-13 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL commented: Best would be to add that option to script and let user decide whatever use it or not. https://github.com/llvm/llvm-project/pull/127066 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.o

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

2025-02-15 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,146 @@ +//===--- SmartptrResetAmbiguousCallCheck.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-15 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,146 @@ +//===--- SmartptrResetAmbiguousCallCheck.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-15 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,47 @@ +.. title:: clang-tidy - bugprone-smartptr-reset-ambiguous-call + +bugprone-smartptr-reset-ambiguous-call +== + +Finds potentially erroneous calls to ``reset`` method on smart pointers when +the pointee type also has a ``reset``

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

2025-02-15 Thread Piotr Zegar 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-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-15 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,146 @@ +//===--- SmartptrResetAmbiguousCallCheck.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-15 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited 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-15 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL commented: 1. Overall ok, please work a little bit on an warning message. 2. Probably better name would be: readability-ambiguous-smartptr-reset-call 3. Same issue exist on other objects like std::optional, and other methods like std::optional and call to `emplace`. M

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

2025-02-15 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,146 @@ +//===--- SmartptrResetAmbiguousCallCheck.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][NFC]clean ConstCorrectnessCheck (PR #130493)

2025-03-15 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. https://github.com/llvm/llvm-project/pull/130493 ___ 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 `construct-reusable-objects-once` check (PR #131455)

2025-03-15 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: "What about separating this check in two: construct-reusable-objects-once and initialize-big-containers-once?" No point, try making generic check without a code specific for selected objects like std::regexp or containers. Add ExcludeRegexp, to be able to make it work for all ob

[clang-tools-extra] [clang-tidy] offer option to check sugared types in avoid-c-arrays check (PR #131468)

2025-03-15 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL commented: Release notes entry missing. Now, to be honest I do not like idea behind those changes. Simply because if diagnostic is raised for example for an surrogate type, there is no way to apply fixes, and as this check is "modernize", main purpose of it is to ap

[clang-tools-extra] [clang-tidy] offer option to check sugared types in avoid-c-arrays check (PR #131468)

2025-03-15 Thread Piotr Zegar via cfe-commits
@@ -96,6 +97,26 @@ void AvoidCArraysCheck::check(const MatchFinder::MatchResult &Result) { diag(ArrayType->getBeginLoc(), "do not declare %select{C-style|C VLA}0 arrays, use %1 instead") << IsVLA << llvm::join(RecommendTypes, " or "); + + if (CheckSugaredTypes)

[clang-tools-extra] [clang-tidy] offer option to check sugared types in avoid-c-arrays check (PR #131468)

2025-03-15 Thread Piotr Zegar via cfe-commits
@@ -96,6 +97,26 @@ void AvoidCArraysCheck::check(const MatchFinder::MatchResult &Result) { diag(ArrayType->getBeginLoc(), "do not declare %select{C-style|C VLA}0 arrays, use %1 instead") << IsVLA << llvm::join(RecommendTypes, " or "); + + if (CheckSugaredTypes)

[clang-tools-extra] [clang-tidy] offer option to check sugared types in avoid-c-arrays check (PR #131468)

2025-03-15 Thread Piotr Zegar via cfe-commits
@@ -43,7 +43,8 @@ AST_MATCHER(clang::ParmVarDecl, isArgvOfMain) { AvoidCArraysCheck::AvoidCArraysCheck(StringRef Name, ClangTidyContext *Context) : ClangTidyCheck(Name, Context), - AllowStringArrays(Options.get("AllowStringArrays", false)) {} + AllowStringArrays(

<    19   20   21   22   23   24   25   26   >