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

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

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

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

[clang-tools-extra] [clang-tidy] Disable bugprone-multi-level-pointer-conversion in C code (PR #141209)

2025-05-24 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. I'm accepting change and leaving final decision to you. I can always change this later in internal fork or add option later. https://github.com/llvm/llvm-project/pull/141209 ___ cfe-commits mailin

[clang-tools-extra] [clang-tidy] Disable bugprone-multi-level-pointer-conversion in C code (PR #141209)

2025-05-24 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: Ok, but that is for "some projects". If you search internet you may find examples when people omit those casts and were people add those casts. For example: https://www.tutorialspoint.com/c_standard_library/c_function_malloc.htm And with multi level pointer conversion it's easy

[clang-tools-extra] [clang-tidy] Disable bugprone-multi-level-pointer-conversion in C code (PR #141209)

2025-05-23 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL commented: I'm not sure about this. This check is about IMPLICIT casts, you can always do explicit cast in C (via functional cast or c-style cast) or C++ (reinterpret_cast) to say that mutli-level pointer conversion is expected in that place. If some C project got

[clang-tools-extra] [clang-tidy] Do not flag strerror in concurrency-mt-unsafe (PR #140520)

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

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

2025-05-18 Thread Piotr Zegar via cfe-commits
@@ -3,10 +3,22 @@ portability-avoid-pragma-once = -This check catches pragma once usage. +Finds uses of ``#pragma once`` and suggests replacing them with standard +include guards (``#ifndef``/``#define``/``#endif``) for improved portability. -For

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

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

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

2025-05-18 Thread Piotr Zegar via cfe-commits
@@ -3,10 +3,22 @@ portability-avoid-pragma-once = -This check catches pragma once usage. +Finds uses of ``#pragma once`` and suggests replacing them with standard +include guards (``#ifndef``/``#define``/``#endif``) for improved portability. -For

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

2025-05-18 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. Documentation may require some improvements, but overall looks fine. https://github.com/llvm/llvm-project/pull/140388 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org

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

2025-05-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,36 @@ +//===--- AvoidPragmaOnceCheck.h - clang-tidy *- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

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

2025-05-17 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL requested changes to this pull request. Idea is ok. Missing some tests (scenarios not covered). Maybe some options to deal with big number of false-positives would be needed. Maybe some option to allow changing visibility to less visible would be needed. https://gith

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

2025-05-17 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,43 @@ +.. title:: clang-tidy - bugprone-function-visibility-change + +bugprone-function-visibility-change +=== + +Check changes in visibility of C++ member functions in subclasses. The check +detects if a virtual function is overridden wi

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

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

2025-05-17 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,43 @@ +.. title:: clang-tidy - bugprone-function-visibility-change + +bugprone-function-visibility-change +=== + +Check changes in visibility of C++ member functions in subclasses. The check +detects if a virtual function is overridden wi

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

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

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

2025-05-17 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,43 @@ +.. title:: clang-tidy - bugprone-function-visibility-change + +bugprone-function-visibility-change +=== + +Check changes in visibility of C++ member functions in subclasses. The check PiotrZSL wrote: And avoid "Th

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

2025-05-17 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,234 @@ +// RUN: %check_clang_tidy %s bugprone-function-visibility-change %t + +class A { +public: + virtual void pub_foo1() {} + virtual void pub_foo2() {} + virtual void pub_foo3() {} +protected: + virtual void prot_foo1(); + virtual void prot_foo2(); + virtual v

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

2025-05-17 Thread Piotr Zegar via cfe-commits
@@ -98,6 +98,7 @@ Clang-Tidy Checks :doc:`bugprone-fold-init-type `, :doc:`bugprone-forward-declaration-namespace `, :doc:`bugprone-forwarding-reference-overload `, + :doc:`bugprone-function-visibility-change `, "Yes" PiotrZSL wrote: check does n

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

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

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

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

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

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

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

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

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

2025-05-17 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,43 @@ +.. title:: clang-tidy - bugprone-function-visibility-change + +bugprone-function-visibility-change +=== + +Check changes in visibility of C++ member functions in subclasses. The check +detects if a virtual function is overridden wi

[clang-tools-extra] [clang-tidy] Add check 'bugprone-invalid-enum-default-initialization' (PR #136823)

2025-04-23 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,116 @@ +// RUN: %check_clang_tidy -std=c++17 %s bugprone-invalid-enum-default-initialization %t + PiotrZSL wrote: Add test with enum forward declaration only, and with enum without enumerators. For those there should be no requirement in initializatio

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

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

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

2025-04-13 Thread Piotr Zegar via cfe-commits
@@ -28,6 +29,12 @@ class ExceptionAnalyzer { ///< definition. }; + /// We use a SetVector to preserve the order of the functions in the call + /// stack as well as have fast lookup. + using CallStack = llvm::SetVector, +

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

2025-04-13 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL commented: What about unknown exceptions ? Take a look into https://reviews.llvm.org/D153298, mainly into comments and approach if everything is covered in your change. https://github.com/llvm/llvm-project/pull/134375 ___ c

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

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

[clang-tools-extra] [clang-tidy] Fix false positives in `readability-redundant-inline-specifier` (PR #135391)

2025-04-11 Thread Piotr Zegar via cfe-commits
=?utf-8?q?Björn?= Svensson Message-ID: In-Reply-To: @@ -72,11 +72,13 @@ static SourceLocation getInlineTokenLocation(SourceRange RangeLocation, } void RedundantInlineSpecifierCheck::registerMatchers(MatchFinder *Finder) { + const auto IsPartOfRecordDecl = hasAncestor(reco

[clang-tools-extra] [clang-tidy] Fix false positives in `readability-redundant-inline-specifier` (PR #135391)

2025-04-11 Thread Piotr Zegar via cfe-commits
=?utf-8?q?Bj=C3=B6rn?= Svensson Message-ID: In-Reply-To: https://github.com/PiotrZSL approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/135391 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi

[clang-tools-extra] [clang-tidy] Fix false positives in `readability-redundant-inline-specifier` (PR #135391)

2025-04-11 Thread Piotr Zegar via cfe-commits
=?utf-8?q?Björn?= Svensson Message-ID: In-Reply-To: https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/135391 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commit

[clang-tools-extra] [clang-tidy] support query based custom check (PR #131804)

2025-04-05 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: > I think flattening the configuration items will only reduce readability, > because we cannot define a YAML schema for it. If we put that entire YAML under "custom-call-main-function.Config", that would also be fine. Thing is that with this there could be a way to make all chan

[clang-tools-extra] [NFC] Fixes proposed by code sanitizer. (PR #134138)

2025-04-05 Thread Piotr Zegar via cfe-commits
@@ -305,7 +305,7 @@ IncludeInserter::calculateIncludePath(const HeaderFile &InsertedHeader, if (llvm::sys::path::is_absolute(Suggested)) return std::nullopt; bool IsAngled = false; - for (auto Filter : AngledHeaders) { + for (auto &Filter : AngledHeaders) { -

[clang-tools-extra] [clang-tidy] Added Conflicting Global Accesses checker (PR #130421)

2025-04-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,748 @@ +//===--===// +// +// 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] [NFC] Fixes proposed by code sanitizer. (PR #134138)

2025-04-05 Thread Piotr Zegar via cfe-commits
@@ -260,7 +260,7 @@ static IntegerRange createFromType(const ASTContext &Context, llvm::APSInt LowerValue(PrecisionBits + 2, /*isUnsigned*/ false); LowerValue.setBit(PrecisionBits); LowerValue.setSignBit(); -return {LowerValue, UpperValue}; +return {std::mo

[clang-tools-extra] [NFC] Fixes proposed by code sanitizer. (PR #134138)

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

[clang-tools-extra] [clang-tidy] Added Conflicting Global Accesses checker (PR #130421)

2025-04-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,77 @@ +//===--- ConflictingGlobalAccesses.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] Added Conflicting Global Accesses checker (PR #130421)

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

[clang-tools-extra] [clang-tidy] Added Conflicting Global Accesses checker (PR #130421)

2025-04-04 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,748 @@ +//===--===// +// +// 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] Fixed bugprone-non-zero-enum-to-bool-conversion (PR #131407)

2025-04-04 Thread Piotr Zegar via cfe-commits
@@ -126,4 +126,10 @@ void testCustomOperator(CustomOperatorEnum e) { if (!(e & E1)) {} } +enum EmptyEnum {}; + +bool testCustomOperator(EmptyEnum value) { PiotrZSL wrote: Because this is enum without enumerators = can hold any value = usually used to wor

[clang-tools-extra] [NFC] Fixes proposed by code sanitizer. (PR #134138)

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

[clang-tools-extra] [clang-tidy] Added Conflicting Global Accesses checker (PR #130421)

2025-03-31 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL commented: Not sure about name, some simpler name would be better. Missing documentation/release notes. Add check need to be simplified. https://github.com/llvm/llvm-project/pull/130421 ___ cfe-commits mailing list cfe-com

[clang-tools-extra] [clang-tidy] Added Conflicting Global Accesses checker (PR #130421)

2025-03-31 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,77 @@ +//===--- ConflictingGlobalAccesses.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][NFC][doc] improve "options" sections of `misc-`, `cppcore-` and other checks (PR #133694)

2025-03-31 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. https://github.com/llvm/llvm-project/pull/133694 ___ 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 query based custom check (PR #131804)

2025-03-28 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL requested changes to this pull request. I do not like this "CustomChecks" What I would like to have in config is: ``` custom-call-main-function.Engine: Query custom-call-main-function.Language: C custom-call-main-function.Traverse: AsIs custom-call-main-function.Code

[clang-tools-extra] [clang-tidy] Fix `thread_local` false positives in `misc-use-internal-linkage` check (PR #132573)

2025-03-24 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/132573 ___ 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 query based custom check (PR #131804)

2025-03-20 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: checkfactories could read name of checks from an options config. https://github.com/llvm/llvm-project/pull/131804 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] add new check: modernize-use-scoped-lock (PR #126434)

2025-03-20 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,342 @@ +//===--- UseScopedLockCheck.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 new check: modernize-use-scoped-lock (PR #126434)

2025-03-19 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,342 @@ +//===--- UseScopedLockCheck.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 new check: modernize-use-scoped-lock (PR #126434)

2025-03-19 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,342 @@ +//===--- UseScopedLockCheck.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 new check: modernize-use-scoped-lock (PR #126434)

2025-03-19 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,342 @@ +//===--- UseScopedLockCheck.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 new check: modernize-use-scoped-lock (PR #126434)

2025-03-19 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,342 @@ +//===--- UseScopedLockCheck.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 new check: modernize-use-scoped-lock (PR #126434)

2025-03-19 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,342 @@ +//===--- UseScopedLockCheck.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 new check: modernize-use-scoped-lock (PR #126434)

2025-03-19 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL commented: Few nits https://github.com/llvm/llvm-project/pull/126434 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] add new check: modernize-use-scoped-lock (PR #126434)

2025-03-19 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,100 @@ +.. title:: clang-tidy - modernize-use-scoped-lock + +modernize-use-scoped-lock += + +Finds uses of ``std::lock_guard`` and suggests replacing them with C++17's +alternative ``std::scoped_lock``. The check will automatically transform only

[clang-tools-extra] [clang-tidy] add new check: modernize-use-scoped-lock (PR #126434)

2025-03-19 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,342 @@ +//===--- UseScopedLockCheck.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 new check: modernize-use-scoped-lock (PR #126434)

2025-03-19 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,342 @@ +//===--- UseScopedLockCheck.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 new check: modernize-use-scoped-lock (PR #126434)

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

[clang-tools-extra] [clang-tidy] add new check: modernize-use-scoped-lock (PR #126434)

2025-03-19 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,342 @@ +//===--- UseScopedLockCheck.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] support query based custom check (PR #131804)

2025-03-19 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,20 @@ +set(LLVM_LINK_COMPONENTS + support + ) + +add_clang_library(clangTidyCustomModule STATIC + CustomTidyModule.cpp + QueryCheck.cpp + + LINK_LIBS + clangTidy + clangTidyUtils + + DEPENDS + ClangDriverOptions + ) + +clang_target_link_libraries(clangTidyCust

[clang-tools-extra] [clang-tidy] support query based custom check (PR #131804)

2025-03-19 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/131804 ___ 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 query based custom check (PR #131804)

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

[clang-tools-extra] [clang-tidy] Skip system macros in readability-identifier-naming check (PR #132016)

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

[clang-tools-extra] [clang-tidy] Skip system macros in readability-identifier-naming check (PR #132016)

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

[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 edited https://github.com/llvm/llvm-project/pull/131468 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] detect explicit casting within modernize-use-default-member-init (PR #129408)

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

[clang-tools-extra] [clang-tidy] detect explicit casting within modernize-use-default-member-init (PR #129408)

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

[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
@@ -0,0 +1,126 @@ +// RUN: %check_clang_tidy -std=c++17 %s modernize-avoid-c-arrays %t -- \ PiotrZSL wrote: try merge this file with exist one, you can set macro suffix, to distinguish diagnostic https://github.com/llvm/llvm-project/pull/131468

[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(

[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
@@ -21,12 +21,12 @@ AST_MATCHER(clang::TypeLoc, hasValidBeginLoc) { return Node.getBeginLoc().isValid(); } -AST_MATCHER_P(clang::TypeLoc, hasType, - clang::ast_matchers::internal::Matcher, - InnerMatcher) { +AST_MATCHER_P(clang::TypeLoc, hasArrayTyp

[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
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] 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][NFC] clean ReleaseNotes.rst (PR #130626)

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

[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
https://github.com/PiotrZSL commented: It's not so easy, as for example you not detecting if after construction such object is being modified or even moved. Basically you would need to ensure that only const methods are called on such object and it's never moved, or re-assign later. Additional

[clang-tools-extra] [clang-tidy] Fixed bugprone-non-zero-enum-to-bool-conversion (PR #131407)

2025-03-14 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL created https://github.com/llvm/llvm-project/pull/131407 Improved bugprone-non-zero-enum-to-bool-conversion check to ignore enums without enumerators and enums with bool as underlying type. Fixes #130762 >From f54b035af44fca80ac52e3661680d50fff5b64e5 Mon Sep 17 00:

[clang-tools-extra] [clang-tidy] Add IgnoreMacros to readability-function-size (PR #131406)

2025-03-14 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL created https://github.com/llvm/llvm-project/pull/131406 Extend readability-function-size check by adding IgnoreMacros option. Fixes #112835 >From 95b3e21c8712d9489cdff8bc2ce78b447d894837 Mon Sep 17 00:00:00 2001 From: Piotr Zegar Date: Tue, 7 Jan 2025 16:21:12 +00

[clang-tools-extra] [clang-tidy][NFC] clean ReleaseNotes.rst (PR #130626)

2025-03-14 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. https://github.com/llvm/llvm-project/pull/130626 ___ 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-03-11 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: @vbvictor If you don't want this to be merged as "70346889+vbvic...@users.noreply.github.com.", please change your email privacy settings. https://github.com/llvm/llvm-project/pull/121291 ___ cfe-commits mailing list cfe-commits@lists

[clang-tools-extra] [clang-tidy][NFC]refactor matcher for bugprone-optional-value-conversion (PR #130415)

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

[clang-tools-extra] [clang-tidy] detect explicit casting within modernize-use-default-member-init (PR #129408)

2025-03-11 Thread Piotr Zegar via cfe-commits
@@ -194,15 +199,21 @@ void UseDefaultMemberInitCheck::storeOptions( } void UseDefaultMemberInitCheck::registerMatchers(MatchFinder *Finder) { - auto InitBase = - anyOf(stringLiteral(), characterLiteral(), integerLiteral(), -unaryOperator(hasAnyOperatorName("+

[clang-tools-extra] [clang-tidy] detect explicit casting within modernize-use-default-member-init (PR #129408)

2025-03-11 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: @RiverDave If you rebase this change we can merge it, and then if you want you could work on next version in independent PR. https://github.com/llvm/llvm-project/pull/129408 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https

[clang-tools-extra] [clang-tidy] Add an option to treat warnings as errors (PR #128221)

2025-03-11 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL commented: Release notes entry is missing. Look into clang-tidy 20 release notes and just copy entry and adjust it. https://github.com/llvm/llvm-project/pull/128221 ___ cfe-commits mailing list cfe-commits@lists.llvm.org htt

[clang-tools-extra] [clang-tidy] Add an option to treat warnings as errors (PR #128221)

2025-03-11 Thread Piotr Zegar via cfe-commits
@@ -374,6 +379,8 @@ def main(): common_clang_tidy_args.append("-extra-arg-before=%s" % arg) for plugin in args.plugins: common_clang_tidy_args.append("-load=%s" % plugin) +if args.warnings_as_errors != "": PiotrZSL wrote: probably this

[clang-tools-extra] [clang-tidy] Add an option to treat warnings as errors (PR #128221)

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

[clang-tools-extra] [clang-tidy] detect explicit casting within modernize-use-default-member-init (PR #129408)

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

[clang-tools-extra] [clang-tidy] detect explicit casting within modernize-use-default-member-init (PR #129408)

2025-03-11 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. Change looks correct, but looks like this check got one more limitation in case of code like this: ``` class CastInit { CastInit() : m(static_cast(9)) {} int m = 9; }; ``` And this: ``` ``` class CastInit { CastInit() : m(static_ca

[clang-tools-extra] [clang-tidy] Add check on constexpr & static values in modernize-use-default-member-init (PR #129425)

2025-03-11 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: @RiverDave Unless you want this to be merged using github generated private email, change your email privacy settings. https://github.com/llvm/llvm-project/pull/129425 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lis

[clang-tools-extra] [clang-tidy] Fix false negative `modernize-use-ranges` when using getter function (PR #127377)

2025-03-11 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. LGTM. PS: won't same issue exist in free standing functions ? Personally for me all 3 cases should be convertible to ranges. And probably should be some check for last one to point out dangling iterator. But that could be in scope for other

[clang-tools-extra] [clang-tidy] support different precisions (PR #130540)

2025-03-11 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL closed https://github.com/llvm/llvm-project/pull/130540 ___ 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-03-11 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] support different precisions (PR #130540)

2025-03-11 Thread Piotr Zegar via cfe-commits
@@ -91,8 +91,12 @@ struct MatchBuilder { auto matchMathCall(const StringRef FunctionName, const Matcher ArgumentMatcher) const { +auto HasAnyPrecisionName = +anyOf(hasName(FunctionName), hasName((FunctionName + "l").str()), P

[clang-tools-extra] [clang-tidy] Add check on constexpr & static values in modernize-use-default-member-init (PR #129425)

2025-03-11 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL closed https://github.com/llvm/llvm-project/pull/129425 ___ 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] Avoid processing declarations in system headers (PR #128150)

2025-03-11 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. I like what I see. One thing that may be required later is manual review of implementation of every check to verify that they will work correctly, current tests may not be sufficient. https://github.com/llvm/llvm-project/pull/128150 _

[clang] [clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

2025-03-11 Thread Piotr Zegar via cfe-commits
@@ -91,6 +91,11 @@ Improvements to clang-query Improvements to clang-tidy -- +- It no longer processes declarations from system headers by default, greatly PiotrZSL wrote: Would be nice to start with ":program:clang-tidy" (or something

[clang] [clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

2025-03-11 Thread Piotr Zegar via cfe-commits
@@ -1573,19 +1574,41 @@ bool MatchASTVisitor::TraverseAttr(Attr *AttrNode) { class MatchASTConsumer : public ASTConsumer { public: MatchASTConsumer(MatchFinder *Finder, - MatchFinder::ParsingDoneTestCallback *ParsingDone) - : Finder(Finder), ParsingDone

[clang] [clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

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

  1   2   3   4   5   6   7   8   9   10   >