[clang-tools-extra] Allow specifying pipe syntax for use-ranges checks (PR #98696)

2024-07-15 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL closed https://github.com/llvm/llvm-project/pull/98696 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Allow unnecessary-value-param to match templated functions including lambdas with auto. (PR #97767)

2024-07-15 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL closed https://github.com/llvm/llvm-project/pull/97767 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [libc] clang-tidy: readability-redundant-smartptr-get does not remove -> (#97964) (PR #98757)

2024-07-15 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL requested changes to this pull request. Fix release notes, and remove not related changed to errno (i assume due to merge). fell free to rebase branch if needed https://github.com/llvm/llvm-project/pull/98757 ___ cfe-commit

[clang-tools-extra] [libc] clang-tidy: readability-redundant-smartptr-get does not remove -> (#97964) (PR #98757)

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

[clang-tools-extra] [libc] clang-tidy: readability-redundant-smartptr-get does not remove -> (#97964) (PR #98757)

2024-07-15 Thread Piotr Zegar via cfe-commits
@@ -502,6 +502,12 @@ Changes in existing checks usages of ``std::string_view::compare``. Added a `StringLikeClasses` option to detect usages of ``compare`` method in custom string-like classes. +- Improved :doc:`readability-redundant-smartptr-get + ` identify

[clang-tools-extra] [libc] clang-tidy: readability-redundant-smartptr-get does not remove -> (#97964) (PR #98757)

2024-07-15 Thread Piotr Zegar via cfe-commits
@@ -18,7 +18,6 @@ add_entrypoint_object( SRCS libc_errno.cpp HDRS -errno.h PiotrZSL wrote: not related change, revert https://github.com/llvm/llvm-project/pull/98757 ___ cfe-commits mailing list cfe-comm

[clang-tools-extra] [clang-tidy] bugprone-implicit-widening ignores const exprs that fit (PR #98352)

2024-07-15 Thread Piotr Zegar via cfe-commits
@@ -50,7 +50,7 @@ Options If the multiplication operands are compile-time constants (like literals or are ``constexpr``) and fit within the source expression type, do not emit a diagnostic or suggested fix. Only considers expressions where the source - expression is

[clang-tools-extra] [clang-tidy] bugprone-implicit-widening ignores const exprs that fit (PR #98352)

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

[clang-tools-extra] [clang-tidy] bugprone-implicit-widening ignores const exprs that fit (PR #98352)

2024-07-15 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. I will merge this, as change looks fine at first glance. Any new fixes/changes please push in separate review. https://github.com/llvm/llvm-project/pull/98352 ___ cfe-commits mailing list cfe-com

[clang-tools-extra] [clang-tidy] bugprone-implicit-widening ignores const exprs that fit (PR #98352)

2024-07-15 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,56 @@ +// RUN: %check_clang_tidy %s bugprone-implicit-widening-of-multiplication-result %t -- \ +// RUN: -config='{CheckOptions: { \ +// RUN: bugprone-implicit-widening-of-multiplication-result.IgnoreConstantIntExpr: true \ +// RUN: }}' -- -target x86

[clang-tools-extra] [clang-tidy] bugprone-implicit-widening ignores const exprs that fit (PR #98352)

2024-07-15 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL closed https://github.com/llvm/llvm-project/pull/98352 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Handle expr with side-effects in readability-static-accessed-through-instance (PR #90736)

2024-05-01 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL created https://github.com/llvm/llvm-project/pull/90736 Improved readability-static-accessed-through-instance check to support expressions with side-effects. Originally calls to overloaded operator were ignored by check, in fear of possible side-effects. This chang

[clang-tools-extra] [clang-tidy] Handle expr with side-effects in readability-static-accessed-through-instance (PR #90736)

2024-05-01 Thread Piotr Zegar via cfe-commits
@@ -380,3 +387,20 @@ namespace PR51861 { // CHECK-FIXES: {{^}}PR51861::Foo::getBar();{{$}} } } + +namespace PR75163 { PiotrZSL wrote: PR = Problem Report (in this context) https://github.com/llvm/llvm-project/pull/90736 _

[clang-tools-extra] [clang-tidy] Ignore casts from void to void in bugprone-casting-through-void (PR #90566)

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

[clang-tools-extra] [clang-tidy] Relax readability-const-return-type (PR #90560)

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

[clang-tools-extra] [clang-tidy] new check readability-mark-static (PR #90830)

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

[clang-tools-extra] [clang-tidy] new check readability-mark-static (PR #90830)

2024-05-02 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,65 @@ +//===--- MarkStaticCheck.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] new check readability-mark-static (PR #90830)

2024-05-02 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,26 @@ +.. title:: clang-tidy - readability-mark-static + +readability-mark-static +=== + +Detects variable and function can be marked as static. + +Static functions and variables are scoped to a single file. Marking functions +and variables as static

[clang-tools-extra] [clang-tidy] new check readability-mark-static (PR #90830)

2024-05-02 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL requested changes to this pull request. 1. Wrong check name, maybe readability-unessesary-external-linkage or something, maybe it should even be an performance check [as there it will bring more benefits] (current check suggest more an "static methods"). 2. Add suppo

[clang-tools-extra] [clang-tidy] new check readability-mark-static (PR #90830)

2024-05-02 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: > Isn't this already covered by `-Wmissing-prototypes`? No, because -Wmissing-prototypes will not provide warning, when both declaration and definition is in .cpp https://github.com/llvm/llvm-project/pull/90830 ___ cfe-commits mailing

[clang-tools-extra] [clang-tidy] new check readability-mark-static (PR #90830)

2024-05-02 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: > Maybe I can provide an option to treat some extension as main file also. Clang-tidy already got those options, check just need to utilize them. https://github.com/llvm/llvm-project/pull/90830 ___ cfe-commits mailing list cfe-commits

[clang-tools-extra] [clang-tidy] new check readability-mark-static (PR #90830)

2024-05-02 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,26 @@ +.. title:: clang-tidy - readability-mark-static + +readability-mark-static +=== + +Detects variable and function can be marked as static. + +Static functions and variables are scoped to a single file. Marking functions +and variables as static

[clang-tools-extra] [clang-tidy] new check readability-mark-static (PR #90830)

2024-05-02 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,26 @@ +.. title:: clang-tidy - readability-mark-static + +readability-mark-static +=== + +Detects variable and function can be marked as static. + +Static functions and variables are scoped to a single file. Marking functions +and variables as static

[clang-tools-extra] [clang-tidy] Add modernize-use-std-format check (PR #90397)

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

[clang-tools-extra] [clang-tidy] Add modernize-use-std-format check (PR #90397)

2024-05-02 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,97 @@ +// RUN: %check_clang_tidy \ +// RUN: -std=c++20 %s modernize-use-std-format %t -- \ +// RUN: -config="{CheckOptions: [{key: StrictMode, value: true}]}" \ +// RUN: -- -isystem %clang_tidy_headers +// RUN: %check_clang_tidy \ +// RUN: -std=c++20 %s moderniz

[clang-tools-extra] [clang-tidy] Add modernize-use-std-format check (PR #90397)

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

[clang-tools-extra] [clang-tidy] Add modernize-use-std-format check (PR #90397)

2024-05-02 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,120 @@ +// RUN: %check_clang_tidy \ +// RUN: -std=c++20 %s modernize-use-std-format %t -- \ +// RUN: -config="{CheckOptions: [{key: StrictMode, value: true}]}" \ +// RUN: -- -isystem %clang_tidy_headers +// RUN: %check_clang_tidy \ +// RUN: -std=c++20 %s moderni

[clang-tools-extra] [clang-tidy] Add modernize-use-std-format check (PR #90397)

2024-05-02 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,120 @@ +// RUN: %check_clang_tidy \ +// RUN: -std=c++20 %s modernize-use-std-format %t -- \ +// RUN: -config="{CheckOptions: [{key: StrictMode, value: true}]}" \ +// RUN: -- -isystem %clang_tidy_headers +// RUN: %check_clang_tidy \ +// RUN: -std=c++20 %s moderni

[clang-tools-extra] [clang-tidy] Add 'cert-int09-c' alias for 'readability-enum-initial-value' (PR #90868)

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

[clang-tools-extra] [clang-tidy] Add modernize-use-std-format check (PR #90397)

2024-05-02 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,120 @@ +// RUN: %check_clang_tidy \ +// RUN: -std=c++20 %s modernize-use-std-format %t -- \ +// RUN: -config="{CheckOptions: [{key: StrictMode, value: true}]}" \ +// RUN: -- -isystem %clang_tidy_headers +// RUN: %check_clang_tidy \ +// RUN: -std=c++20 %s moderni

[clang-tools-extra] [clang-tidy][NFC] Document CERT rule coverage and aliases for some primary checks (PR #90965)

2024-05-03 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/90965 ___ 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 modernize-use-std-print diagnostic (PR #91071)

2024-05-05 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. https://github.com/llvm/llvm-project/pull/91071 ___ 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 modernize-use-std-print diagnostic (PR #91071)

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

[clang-tools-extra] [clang-tidy] Add `modernize-use-uniform-initializer` check (PR #91124)

2024-05-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,320 @@ +//===--- UseUniformInitializerCheck.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 `modernize-use-uniform-initializer` check (PR #91124)

2024-05-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,320 @@ +//===--- UseUniformInitializerCheck.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 `modernize-use-uniform-initializer` check (PR #91124)

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

[clang-tools-extra] [clang-tidy] Add `modernize-use-uniform-initializer` check (PR #91124)

2024-05-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,320 @@ +//===--- UseUniformInitializerCheck.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 `modernize-use-uniform-initializer` check (PR #91124)

2024-05-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,174 @@ +// RUN: %check_clang_tidy -std=c++11 %s modernize-use-uniform-initializer %t + +int cinit_0 = 0; +// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: Use uniform initializer instead of C-style initializer [modernize-use-uniform-initializer] +// CHECK-FIXES: int cinit_

[clang-tools-extra] [clang-tidy] Add `modernize-use-uniform-initializer` check (PR #91124)

2024-05-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,320 @@ +//===--- UseUniformInitializerCheck.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 `modernize-use-uniform-initializer` check (PR #91124)

2024-05-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,320 @@ +//===--- UseUniformInitializerCheck.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 `modernize-use-uniform-initializer` check (PR #91124)

2024-05-05 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL commented: Overall, i would see this as readability check. And I would see this as configurable check, so I could select one of: ` = 10;`, or `(10);` or `{10};` and stick to that convention. Other thing, in project not so long ago we had issues with {} initialization.

[clang-tools-extra] [clang-tidy] Add `modernize-use-uniform-initializer` check (PR #91124)

2024-05-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,320 @@ +//===--- UseUniformInitializerCheck.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 `modernize-use-uniform-initializer` check (PR #91124)

2024-05-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,174 @@ +// RUN: %check_clang_tidy -std=c++11 %s modernize-use-uniform-initializer %t + +int cinit_0 = 0; +// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: Use uniform initializer instead of C-style initializer [modernize-use-uniform-initializer] +// CHECK-FIXES: int cinit_

[clang-tools-extra] [clang-tidy] Add `modernize-use-uniform-initializer` check (PR #91124)

2024-05-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,320 @@ +//===--- UseUniformInitializerCheck.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 `modernize-use-uniform-initializer` check (PR #91124)

2024-05-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,320 @@ +//===--- UseUniformInitializerCheck.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 `modernize-use-uniform-initializer` check (PR #91124)

2024-05-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,320 @@ +//===--- UseUniformInitializerCheck.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 `modernize-use-uniform-initializer` check (PR #91124)

2024-05-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,320 @@ +//===--- UseUniformInitializerCheck.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 `modernize-use-uniform-initializer` check (PR #91124)

2024-05-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,320 @@ +//===--- UseUniformInitializerCheck.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 `modernize-use-uniform-initializer` check (PR #91124)

2024-05-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,34 @@ +.. title:: clang-tidy - modernize-use-uniform-initializer + +modernize-use-uniform-initializer += + +Finds usage of C-Style initialization that can be rewritten with +C++-11 uniform initializers. + +Example +--- + +.. code-bloc

[clang-tools-extra] [clang-tidy] Add `modernize-use-uniform-initializer` check (PR #91124)

2024-05-05 Thread Piotr Zegar via cfe-commits
@@ -84,6 +84,29 @@ SourceLocation findNextTerminator(SourceLocation Start, const SourceManager &SM, return findNextAnyTokenKind(Start, SM, LangOpts, tok::comma, tok::semi); } +SourceLocation findNextTokenKind(SourceLocation Start, const SourceManager &SM, +

[clang-tools-extra] [clang-tidy] Add `modernize-use-uniform-initializer` check (PR #91124)

2024-05-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,174 @@ +// RUN: %check_clang_tidy -std=c++11 %s modernize-use-uniform-initializer %t + +int cinit_0 = 0; +// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: Use uniform initializer instead of C-style initializer [modernize-use-uniform-initializer] +// CHECK-FIXES: int cinit_

[clang-tools-extra] [clang-tidy] Add `modernize-use-uniform-initializer` check (PR #91124)

2024-05-05 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL requested changes to this pull request. Fix pointed out nits https://github.com/llvm/llvm-project/pull/91124 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Refactor how NamedDecl are renamed (PR #88735)

2024-05-07 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL closed https://github.com/llvm/llvm-project/pull/88735 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Add option to exclude headers from clang-tidy analysis (PR #91400)

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

[clang-tools-extra] Add option to exclude headers from clang-tidy analysis (PR #91400)

2024-05-08 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL requested changes to this pull request. Release notes & clang-tidy documentation need to be updated. https://github.com/llvm/llvm-project/pull/91400 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.

[clang-tools-extra] Add option to exclude headers from clang-tidy analysis (PR #91400)

2024-05-08 Thread Piotr Zegar via cfe-commits
@@ -578,6 +579,13 @@ llvm::Regex *ClangTidyDiagnosticConsumer::getHeaderFilter() { return HeaderFilter.get(); } +llvm::Regex *ClangTidyDiagnosticConsumer::getExcludeHeaderFilter() { + if (!ExcludeHeaderFilter) +ExcludeHeaderFilter = std::make_unique( +*Context.

[clang-tools-extra] Add option to exclude headers from clang-tidy analysis (PR #91400)

2024-05-08 Thread Piotr Zegar via cfe-commits
@@ -564,7 +564,8 @@ void ClangTidyDiagnosticConsumer::checkFilters(SourceLocation Location, StringRef FileName(File->getName()); LastErrorRelatesToUserCode = LastErrorRelatesToUserCode || Sources.isInMainFile(Location) || -

[clang-tools-extra] Add option to exclude headers from clang-tidy analysis (PR #91400)

2024-05-08 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: Also python wrappers may require updating to pass those settings to clang-tidy https://github.com/llvm/llvm-project/pull/91400 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c

[clang-tools-extra] Add option to exclude headers from clang-tidy analysis (PR #91400)

2024-05-08 Thread Piotr Zegar via cfe-commits
@@ -578,6 +579,13 @@ llvm::Regex *ClangTidyDiagnosticConsumer::getHeaderFilter() { return HeaderFilter.get(); } +llvm::Regex *ClangTidyDiagnosticConsumer::getExcludeHeaderFilter() { + if (!ExcludeHeaderFilter) +ExcludeHeaderFilter = std::make_unique( +*Context.

[clang-tools-extra] [clang-tidy] Handle implicit casts in hicpp-signed-bitwise for IgnorePositiveIntegerLiterals (PR #90621)

2024-05-08 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL closed https://github.com/llvm/llvm-project/pull/90621 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Handle expr with side-effects in readability-static-accessed-through-instance (PR #90736)

2024-05-08 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL closed https://github.com/llvm/llvm-project/pull/90736 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Ignore unevaluated context in bugprone-optional-value-conversion (PR #90410)

2024-05-08 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: @5chmidti I did some testing with this. And in example that you provided there is no issue. This is because if optional will be uninitialized, then this code won't compile regardless if .value() or operator * is used. Compiler will simply complain that expression is not constex

[clang-tools-extra] [clang-tidy] check `std::string_view` and custom string-like classes in `readability-string-compare` (PR #88636)

2024-05-09 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL closed https://github.com/llvm/llvm-project/pull/88636 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [NFC][clang-tidy] remove magic-numbers-todo.cpp (PR #91577)

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

[clang-tools-extra] Add option to exclude headers from clang-tidy analysis (PR #91400)

2024-05-09 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL commented: Missing test for ExcludeHeaderFilterRegex in .clang-tidy config file. Would be nice to check if --dump-config work correctly with empty/not empty ExcludeHeaderFilterRegex Except those 2 looks fine. https://github.com/llvm/llvm-project/pull/91400 _

[clang-tools-extra] Add option to exclude headers from clang-tidy analysis (PR #91400)

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

[clang-tools-extra] Add option to exclude headers from clang-tidy analysis (PR #91400)

2024-05-09 Thread Piotr Zegar via cfe-commits
@@ -562,9 +567,10 @@ void ClangTidyDiagnosticConsumer::checkFilters(SourceLocation Location, } StringRef FileName(File->getName()); - LastErrorRelatesToUserCode = LastErrorRelatesToUserCode || - Sources.isInMainFile(Location) || -

[clang-tools-extra] Add option to exclude headers from clang-tidy analysis (PR #91400)

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

[clang-tools-extra] Add option to exclude headers from clang-tidy analysis (PR #91400)

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

[clang-tools-extra] Add option to exclude headers from clang-tidy analysis (PR #91400)

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

[clang-tools-extra] Add option to exclude headers from clang-tidy analysis (PR #91400)

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

[clang-tools-extra] Add option to exclude headers from clang-tidy analysis (PR #91400)

2024-05-09 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. Overall from functional point of view looks fine. https://github.com/llvm/llvm-project/pull/91400 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/lis

[clang-tools-extra] Add option to exclude headers from clang-tidy analysis (PR #91400)

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

[clang-tools-extra] Add option to exclude headers from clang-tidy analysis (PR #91400)

2024-05-09 Thread Piotr Zegar via cfe-commits
@@ -311,7 +311,12 @@ ClangTidyDiagnosticConsumer::ClangTidyDiagnosticConsumer( : Context(Ctx), ExternalDiagEngine(ExternalDiagEngine), RemoveIncompatibleErrors(RemoveIncompatibleErrors), GetFixesFromNotes(GetFixesFromNotes), - EnableNolintBlocks(EnableNolin

[clang-tools-extra] [clang-tidy] `readability-simplify-boolean-expr` avoid to warn expression expand from macro when ``IgnoreMacro`` option is enabled. (PR #91757)

2024-05-10 Thread Piotr Zegar via cfe-commits
@@ -357,6 +357,9 @@ Changes in existing checks support calls to overloaded operators as base expression and provide fixes to expressions with side-effects. +- Improved :doc:`readability-simplify-boolean-expr` PiotrZSL wrote: split into 2 lines https://g

[clang-tools-extra] [clang-tidy] `readability-simplify-boolean-expr` avoid to warn expression expand from macro when ``IgnoreMacro`` option is enabled. (PR #91757)

2024-05-10 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/91757 ___ 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-simplify-boolean-expr` avoid to warn expression expand from macro when ``IgnoreMacro`` option is enabled. (PR #91757)

2024-05-10 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. Just nits. https://github.com/llvm/llvm-project/pull/91757 ___ 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-simplify-boolean-expr` avoid to warn expression expand from macro when ``IgnoreMacro`` option is enabled. (PR #91757)

2024-05-10 Thread Piotr Zegar via cfe-commits
@@ -513,17 +513,25 @@ class SimplifyBooleanExprCheck::Visitor : public RecursiveASTVisitor { return true; } - static bool isUnaryLNot(const Expr *E) { -return isa(E) && + static bool isExpectedUnaryLNot(SimplifyBooleanExprCheck *Check, +

[clang-tools-extra] [clang-tidy] Add `bugprone-virtual-arithmetic` check (PR #91951)

2024-05-13 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL commented: Few nits. My main concern is an check name, had to open PR to find out what it does. maybe should be more a "bugprone-arithmetic-on-polymorphic-pointer" or something like that. https://github.com/llvm/llvm-project/pull/91951 ___

[clang-tools-extra] [clang-tidy] Add `bugprone-virtual-arithmetic` check (PR #91951)

2024-05-13 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/91951 ___ 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-virtual-arithmetic` check (PR #91951)

2024-05-13 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,59 @@ +// RUN: %check_clang_tidy %s bugprone-virtual-arithmetic %t + +class Base { +public: + virtual ~Base() {} +}; + +class Derived : public Base {}; + +void operators() { + Base *b = new Derived[10]; + + b += 1; + // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: poi

[clang-tools-extra] [clang-tidy] Add `bugprone-virtual-arithmetic` check (PR #91951)

2024-05-13 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,50 @@ +.. title:: clang-tidy - bugprone-virtual-arithmetic + +bugprone-virtual-arithmetic +=== + +Warn if pointer arithmetic is performed on a class that declares a +virtual function. + +Pointer arithmetic on polymorphic objects where the pointer

[clang-tools-extra] [clang-tidy] Add `bugprone-virtual-arithmetic` check (PR #91951)

2024-05-13 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,49 @@ +//===--- VirtualArithmeticCheck.cpp - clang-tidy---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang-tools-extra] [clang-tidy] Add `bugprone-virtual-arithmetic` check (PR #91951)

2024-05-13 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,59 @@ +// RUN: %check_clang_tidy %s bugprone-virtual-arithmetic %t + +class Base { +public: + virtual ~Base() {} +}; + +class Derived : public Base {}; + +void operators() { + Base *b = new Derived[10]; + + b += 1; + // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: poi

[clang-tools-extra] [clang-tidy] Add `bugprone-virtual-arithmetic` check (PR #91951)

2024-05-13 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,49 @@ +//===--- VirtualArithmeticCheck.cpp - clang-tidy---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang-tools-extra] [clang-tidy] Add `bugprone-virtual-arithmetic` check (PR #91951)

2024-05-13 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: bugprone-pointer-arithmetic-polymorphic-object or bugprone-pointer-arithmetic-on-polymorphic-object could be fine. limiting check to polymorphic objects it's fine, someone can always enable an cppguidelines check to cover all cases. Also check-alias should be added to cert. ht

[clang-tools-extra] [clang-tidy][NFC] replace comparison of begin and end iterators with range empty (PR #91994)

2024-05-13 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/91994 ___ 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 crash due to assumed callee in min-max-use-initializer-list (PR #91992)

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

[clang-tools-extra] [clang-tidy] Rename out-of-line function definitions (PR #91954)

2024-05-13 Thread Piotr Zegar via cfe-commits
@@ -123,6 +123,9 @@ static const NamedDecl *getFailureForNamedDecl(const NamedDecl *ND) { if (const auto *Method = dyn_cast(ND)) { if (const CXXMethodDecl *Overridden = getOverrideMethod(Method)) Canonical = cast(Overridden->getCanonicalDecl()); +else if (const

[clang-tools-extra] [clang-tidy] Rename out-of-line function definitions (PR #91954)

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

[clang-tools-extra] [clang-tidy] Rename out-of-line function definitions (PR #91954)

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

[clang-tools-extra] Add option to exclude headers from clang-tidy analysis (PR #91400)

2024-05-13 Thread Piotr Zegar via cfe-commits
@@ -292,6 +296,14 @@ def main(): "-config option after reading specified config file. " "Use either -config-file or -config, not both.", ) +parser.add_argument( +"-exclude-header-filter", +default=None, +help="regular expression m

[clang-tools-extra] Add option to exclude headers from clang-tidy analysis (PR #91400)

2024-05-13 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. LGTM, just 2 nits. https://github.com/llvm/llvm-project/pull/91400 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Add option to exclude headers from clang-tidy analysis (PR #91400)

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

[clang-tools-extra] Add option to exclude headers from clang-tidy analysis (PR #91400)

2024-05-13 Thread Piotr Zegar via cfe-commits
@@ -115,6 +115,8 @@ Improvements to clang-tidy - Fixed `--verify-config` option not properly parsing checks when using the literal operator in the `.clang-tidy` config. +- Added argument `--exclude-header-filter` to exclude headers from analysis via a RegEx. ---

[clang-tools-extra] [clang-tidy] support expect no diagnosis test (PR #91293)

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

[clang-tools-extra] [clang-tidy] new check misc-use-internal-linkage (PR #90830)

2024-05-13 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: > > * The auto-fix should be configurable to choose `static` or anonymous > > namespace. > > Should I implement auto-fix for this check? Maybe some functions / variables > will be marked incorrectly and cause link error because the coder just forget > to include the header fil

[clang-tools-extra] [clang-tidy] new check misc-use-internal-linkage (PR #90830)

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

[clang-tools-extra] [clang-tidy] new check misc-use-internal-linkage (PR #90830)

2024-05-13 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL commented: Few nits. Missing: - more proper handling for unity files (.cpp included from .cpp) - nits - auto-fixes (any) - in worst case you can provide just fixes with static, but attaching them to notes. https://github.com/llvm/llvm-project/pull/90830

[clang-tools-extra] [clang-tidy] new check misc-use-internal-linkage (PR #90830)

2024-05-13 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,78 @@ +//===--- UseInternalLinkageCheck.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

<    16   17   18   19   20   21   22   23   24   25   >