[clang-tools-extra] [clang-tidy] Add readability-use-builtin-literals check (PR #76065)

2024-01-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,161 @@ +//===--- UseBuiltinLiteralsCheck.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 readability-use-builtin-literals check (PR #76065)

2024-01-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,161 @@ +//===--- UseBuiltinLiteralsCheck.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 readability-use-builtin-literals check (PR #76065)

2024-01-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,161 @@ +//===--- UseBuiltinLiteralsCheck.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 readability-use-builtin-literals check (PR #76065)

2024-01-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,161 @@ +//===--- UseBuiltinLiteralsCheck.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 readability-use-builtin-literals check (PR #76065)

2024-01-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,161 @@ +//===--- UseBuiltinLiteralsCheck.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 readability-use-builtin-literals check (PR #76065)

2024-01-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,105 @@ +// RUN: %check_clang_tidy %s readability-use-builtin-literals %t + +void warn_and_fix() { + + (char16_t)U'a'; + // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use built-in literal instead of explicit cast [readability-use-builtin-literals] + // CHECK-FIXES: u'a

[clang-tools-extra] [clang-tidy] Add readability-use-builtin-literals check (PR #76065)

2024-01-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,161 @@ +//===--- UseBuiltinLiteralsCheck.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 readability-use-builtin-literals check (PR #76065)

2024-01-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,38 @@ +.. title:: clang-tidy - readability-use-builtin-literals + +readability-use-builtin-literals + + +Finds literals explicitly casted to a type that could be expressed using builtin prefixes or suffixes. + +In elementary cases, provi

[clang-tools-extra] [clang-tidy] Add readability-use-builtin-literals check (PR #76065)

2024-01-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,105 @@ +// RUN: %check_clang_tidy %s readability-use-builtin-literals %t + +void warn_and_fix() { + + (char16_t)U'a'; + // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use built-in literal instead of explicit cast [readability-use-builtin-literals] + // CHECK-FIXES: u'a

[clang-tools-extra] [clang-tidy] Add readability-use-builtin-literals check (PR #76065)

2024-01-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,161 @@ +//===--- UseBuiltinLiteralsCheck.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 readability-use-builtin-literals check (PR #76065)

2024-01-05 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,161 @@ +//===--- UseBuiltinLiteralsCheck.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] fix false positive in cppcoreguidelines-missing-std-forward (PR #77056)

2024-01-05 Thread Piotr Zegar via cfe-commits
@@ -53,18 +53,76 @@ AST_MATCHER(ParmVarDecl, isTemplateTypeParameter) { FuncTemplate->getTemplateParameters()->getDepth(); } +AST_MATCHER_P(NamedDecl, hasSameNameAsBoundNode, std::string, BindingID) { + const auto &Name = Node.getNameAsString(); Piot

[clang-tools-extra] [clang-tidy] fix false positive in cppcoreguidelines-missing-std-forward (PR #77056)

2024-01-05 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/77056 ___ 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 positive in cppcoreguidelines-missing-std-forward (PR #77056)

2024-01-05 Thread Piotr Zegar via cfe-commits
@@ -53,18 +53,76 @@ AST_MATCHER(ParmVarDecl, isTemplateTypeParameter) { FuncTemplate->getTemplateParameters()->getDepth(); } +AST_MATCHER_P(NamedDecl, hasSameNameAsBoundNode, std::string, BindingID) { + const auto &Name = Node.getNameAsString(); + + return Builder->

[clang-tools-extra] [clang-tidy] fix false positive in cppcoreguidelines-missing-std-forward (PR #77056)

2024-01-05 Thread Piotr Zegar via cfe-commits
@@ -147,4 +147,24 @@ class AClass { T data; }; +template +void lambda_value_reference(T&& t) { + [&]() { T other = std::forward(t); }; +} + +template +void lambda_value_reference_capture_list_ref_1(T&& t) { +[=, &t] { T other = std::forward(t); }; +} + +template +void

[clang-tools-extra] [clang-tidy] fix false positive in cppcoreguidelines-missing-std-forward (PR #77056)

2024-01-05 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL requested changes to this pull request. Missing release notes & some mention about this in documentation. https://github.com/llvm/llvm-project/pull/77056 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.

[clang] [clang-tools-extra] [clang-tidy] Added new check to detect redundant inline keyword (PR #73069)

2024-01-05 Thread Piotr Zegar via cfe-commits
=?utf-8?q?Félix-Antoine?= Constantin, =?utf-8?q?Félix-Antoine?= Constantin, =?utf-8?q?Félix-Antoine?= Constantin, =?utf-8?q?Félix-Antoine?= Constantin, =?utf-8?q?Félix-Antoine?= Constantin, =?utf-8?q?Félix-Antoine?= Constantin, =?utf-8?q?Félix-Antoine?= Constantin, =?utf-8?q?Félix-Antoine?= Constan

[clang] [clang-tools-extra] [clang-tidy] Improve performance of misc-const-correctness (PR #72705)

2024-01-05 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL updated https://github.com/llvm/llvm-project/pull/72705 >From 1f9b443a92446ae36825152535706037ef2e87b4 Mon Sep 17 00:00:00 2001 From: Piotr Zegar Date: Wed, 15 Nov 2023 16:52:00 + Subject: [PATCH 1/2] [clang-tidy] Improve performance of misc-const-correctness R

[clang-tools-extra] [clang-tidy] fix false positive in cppcoreguidelines-missing-std-forward (PR #77056)

2024-01-06 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/77056 ___ 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 positive in cppcoreguidelines-missing-std-forward (PR #77056)

2024-01-06 Thread Piotr Zegar via cfe-commits
@@ -295,6 +295,11 @@ Changes in existing checks coroutine functions and increase issue detection for cases involving type aliases with references. +- Improved :doc:`cppcoreguidelines-missing-std-forward + ` check to + provide fixes of false positive that forwarded in cap

[clang-tools-extra] [clang-tidy] Fix false-positives in misc-static-assert caused by non-constexpr variables (PR #77203)

2024-01-06 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL created https://github.com/llvm/llvm-project/pull/77203 Ignore false-positives when referring to non-constexpr variables in non-unevaluated context (like decltype, sizeof, ...). Moved from https://reviews.llvm.org/D158657 Fixes: #24066 >From 66900e4518b439cb9190e2

[clang-tools-extra] [clang-tidy] Add support for in-class initializers in readability-redundant-member-init (PR #77206)

2024-01-06 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL created https://github.com/llvm/llvm-project/pull/77206 Support detecting redundant in-class initializers. Moved from https://reviews.llvm.org/D157262 Fixes: #62525 >From 66e4026ff568fbd805ddd777596102381e4e0066 Mon Sep 17 00:00:00 2001 From: Piotr Zegar Date: Sat

[clang-tools-extra] [clang-tidy] Add support for in-class initializers in readability-redundant-member-init (PR #77206)

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

[clang-tools-extra] [clang-tidy] Add support for lambdas in cppcoreguidelines-owning-memory (PR #77246)

2024-01-07 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL created https://github.com/llvm/llvm-project/pull/77246 Implement proper support for lambdas and sub-functions/classes. Moved from https://reviews.llvm.org/D157285 Fixes: #59389 >From b2e230f90f97c0fb3385ab05d0217371b72b9a88 Mon Sep 17 00:00:00 2001 From: Piotr Zega

[clang-tools-extra] [clang-tidy]unused using decls only check cpp files (PR #77335)

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

[clang-tools-extra] [clang] [clang-tidy] Improve performance of misc-const-correctness (PR #72705)

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

[clang-tools-extra] Fix #75686: add iter_swap and iter_move to the matched name (PR #76117)

2024-01-09 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. https://github.com/llvm/llvm-project/pull/76117 ___ 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-move-shared-pointer-contents check. (PR #67467)

2024-01-09 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/67467 ___ 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-move-shared-pointer-contents check. (PR #67467)

2024-01-09 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL requested changes to this pull request. https://github.com/llvm/llvm-project/pull/67467 ___ 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-move-shared-pointer-contents check. (PR #67467)

2024-01-09 Thread Piotr Zegar via cfe-commits
@@ -118,6 +119,7 @@ Clang-Tidy Checks :doc:`bugprone-posix-return `, "Yes" :doc:`bugprone-redundant-branch-condition `, "Yes" :doc:`bugprone-reserved-identifier `, "Yes" + :doc:`bugprone-shared-pointer-contents-move `, "Yes" PiotrZSL wrote: This f

[clang-tools-extra] [clang-tidy] Add bugprone-move-shared-pointer-contents check. (PR #67467)

2024-01-09 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,20 @@ +.. title:: clang-tidy - bugprone-move-shared-pointer-contents + +bugprone-move-shared-pointer-contents += + PiotrZSL wrote: Remove one empty line. https://github.com/llvm/llvm-project/pull/67467 _

[clang-tools-extra] [clang-tidy] Add bugprone-move-shared-pointer-contents check. (PR #67467)

2024-01-09 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,157 @@ +//===--- MoveSharedPointerContentsCheck.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-move-shared-pointer-contents check. (PR #67467)

2024-01-09 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,157 @@ +//===--- MoveSharedPointerContentsCheck.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-move-shared-pointer-contents check. (PR #67467)

2024-01-09 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,157 @@ +//===--- MoveSharedPointerContentsCheck.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-move-shared-pointer-contents check. (PR #67467)

2024-01-09 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,157 @@ +//===--- MoveSharedPointerContentsCheck.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-move-shared-pointer-contents check. (PR #67467)

2024-01-09 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,157 @@ +//===--- MoveSharedPointerContentsCheck.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-move-shared-pointer-contents check. (PR #67467)

2024-01-09 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,45 @@ +//===--- MoveSharedPointerContentsCheck.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-move-shared-pointer-contents check. (PR #67467)

2024-01-09 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,157 @@ +//===--- MoveSharedPointerContentsCheck.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-move-shared-pointer-contents check. (PR #67467)

2024-01-09 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,20 @@ +.. title:: clang-tidy - bugprone-move-shared-pointer-contents + +bugprone-move-shared-pointer-contents += + + +Detects calls to move the contents out of a ``std::shared_ptr`` rather +than moving the pointer itself. In other wor

[clang-tools-extra] [clang-tidy] Add bugprone-move-shared-pointer-contents check. (PR #67467)

2024-01-09 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,157 @@ +//===--- MoveSharedPointerContentsCheck.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-move-shared-pointer-contents check. (PR #67467)

2024-01-09 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,157 @@ +//===--- MoveSharedPointerContentsCheck.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-move-shared-pointer-contents check. (PR #67467)

2024-01-09 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,157 @@ +//===--- MoveSharedPointerContentsCheck.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] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL requested changes to this pull request. I'm not fan about this check. For me there is no use case for it. For sure it's not readability, simply because explicit return is more readable, and people who do not know that main by default will return 0 may even consider t

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

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

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: I'm closing this pull request, as both Carlos and Aaron already commented, closed also issue. Please find some other issue to implement, if you got questions, you can always ask in issue, or on discord. This check won't be merged, simply it's as Carols described "nano-optimizat

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: There are ~600 other issues, not all were fully "reviewed", and there are many easy ones that aren't mark "good first issue". Once you pick something else, I will be happy to help with the review. https://github.com/llvm/llvm-project/pull/77586 _

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-11 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL commented: Some tweaks needed. Note that there is also issue for: ``` std::max(a, std::max(b, c)) -> std::max({a, b, c}) ``` and this check would be nice thing for that also, but not under this PR. Overall you got something that works, but is very strict, now I would

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-11 Thread Piotr Zegar via cfe-commits
@@ -62,6 +63,8 @@ namespace readability { class ReadabilityModule : public ClangTidyModule { public: void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { +CheckFactories.registerCheck( +"readability-ConditionalToStdMinMax");

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

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

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-11 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,27 @@ +// RUN: %check_clang_tidy %s readability-ConditionalToStdMinMax %t + +void foo() { + int value1,value2; + + // CHECK-MESSAGES: :[[@LINE+1]]:3: warning: use std::max instead of < [readability-ConditionalToStdMinMax] + if (value1 < value2) +value1 = value2;

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-11 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,32 @@ +//===--- ConditionaltostdminmaxCheck.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 clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-11 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,88 @@ +//===--- ConditionaltostdminmaxCheck.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] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-11 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,27 @@ +// RUN: %check_clang_tidy %s readability-ConditionalToStdMinMax %t + +void foo() { + int value1,value2; + + // CHECK-MESSAGES: :[[@LINE+1]]:3: warning: use std::max instead of < [readability-ConditionalToStdMinMax] + if (value1 < value2) +value1 = value2;

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-11 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,29 @@ +.. title:: clang-tidy - readability-ConditionalToStdMinMax + +readability-ConditionalToStdMinMax +== + +Replaces certain conditional statements with equivalent std::min or std::max expressions, +improving readability and promotin

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-11 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,88 @@ +//===--- ConditionaltostdminmaxCheck.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] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-11 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,29 @@ +.. title:: clang-tidy - readability-ConditionalToStdMinMax + +readability-ConditionalToStdMinMax +== + +Replaces certain conditional statements with equivalent std::min or std::max expressions, PiotrZSL wrote: \

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-11 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,27 @@ +// RUN: %check_clang_tidy %s readability-ConditionalToStdMinMax %t + +void foo() { + int value1,value2; + + // CHECK-MESSAGES: :[[@LINE+1]]:3: warning: use std::max instead of < [readability-ConditionalToStdMinMax] + if (value1 < value2) +value1 = value2;

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-11 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,27 @@ +// RUN: %check_clang_tidy %s readability-ConditionalToStdMinMax %t + +void foo() { + int value1,value2; + + // CHECK-MESSAGES: :[[@LINE+1]]:3: warning: use std::max instead of < [readability-ConditionalToStdMinMax] + if (value1 < value2) +value1 = value2;

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-11 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,32 @@ +//===--- ConditionaltostdminmaxCheck.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 clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-11 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,88 @@ +//===--- ConditionaltostdminmaxCheck.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] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-11 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,88 @@ +//===--- ConditionaltostdminmaxCheck.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] Avoid overflow when dumping unsigned integer values (PR #85060)

2024-03-13 Thread Piotr Zegar via cfe-commits
@@ -408,17 +408,26 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback { /// Stores an option with the check-local name \p LocalName with /// integer value \p Value to \p Options. template -std::enable_if_t> +std::enable_if_t && std::

[clang-tools-extra] [clang-tidy] Avoid overflow when dumping unsigned integer values (PR #85060)

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

[clang-tools-extra] [clang-tidy] Avoid overflow when dumping unsigned integer values (PR #85060)

2024-03-13 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL commented: Missing test (based on some check). https://github.com/llvm/llvm-project/pull/85060 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Avoid overflow when dumping unsigned integer values (PR #85060)

2024-03-13 Thread Piotr Zegar via cfe-commits
@@ -470,6 +491,8 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback { void storeInt(ClangTidyOptions::OptionMap &Options, StringRef LocalName, int64_t Value) const; +void storeUnsigned(ClangTidyOptions::OptionMap &Options, +

[clang-tools-extra] [clang-tidy] Avoid overflow when dumping unsigned integer values (PR #85060)

2024-03-13 Thread Piotr Zegar via cfe-commits
@@ -408,17 +408,26 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback { /// Stores an option with the check-local name \p LocalName with /// integer value \p Value to \p Options. template -std::enable_if_t> +std::enable_if_t && std::

[clang-tools-extra] [clang-tidy] Avoid overflow when dumping unsigned integer values (PR #85060)

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

[clang-tools-extra] [clang-tidy] Avoid overflow when dumping unsigned integer values (PR #85060)

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

[clang-tools-extra] [clang-tidy] Avoid overflow when dumping unsigned integer values (PR #85060)

2024-03-13 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: And just one comment, when this check uses max value as "limit", this behavior is also a reason why support for optional values were added. For me in this case check & description should be updated to handle this config as an optional, instead of mentioning max u64 in documenta

[clang-tools-extra] [clang-tidy]bugprone-unused-return-value ignore `++` and `--` operator overloading (PR #84922)

2024-03-13 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/84922 ___ 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-unused-return-value ignore `++` and `--` operator overloading (PR #84922)

2024-03-13 Thread Piotr Zegar via cfe-commits
@@ -169,16 +180,14 @@ void UnusedReturnValueCheck::registerMatchers(MatchFinder *Finder) { callee(functionDecl( // Don't match void overloads of checked functions. unless(returns(voidType())), - // Don't match copy or move ass

[clang-tools-extra] [clang-tidy]bugprone-unused-return-value ignore `++` and `--` operator overloading (PR #84922)

2024-03-13 Thread Piotr Zegar via cfe-commits
@@ -31,9 +31,20 @@ AST_MATCHER_P(FunctionDecl, isInstantiatedFrom, Matcher, Finder, Builder); } -AST_MATCHER_P(CXXMethodDecl, isOperatorOverloading, - llvm::SmallVector, Kinds) { - return llvm::is_contained(Kinds, Node.getOverloaded

[clang-tools-extra] [clang-tidy]bugprone-unused-return-value ignore `++` and `--` operator overloading (PR #84922)

2024-03-13 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL commented: Few more tests would be also nice, with free standing operators. https://github.com/llvm/llvm-project/pull/84922 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listi

[clang-tools-extra] Add clang-tidy check readability-math-missing-parentheses (PR #84481)

2024-03-14 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,68 @@ +//===--- MathMissingParenthesesCheck.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][NFC] Remove unnecessary nullptr check on cast subexpr (PR #85473)

2024-03-16 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. First this null-ptr check does nothing because in line 114 we still missing nullptr check. Proper way would be to "return" when we find nullptr were it shoudnt. Second thing, asserts mean nothing. In release mode they are disabled. This m

[clang-tools-extra] [clang-tidy] add check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-03-17 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,138 @@ +//===--- MinMaxUseInitializerListCheck.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 check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-03-17 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,138 @@ +//===--- MinMaxUseInitializerListCheck.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 check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

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

[clang-tools-extra] [clang-tidy] add check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-03-17 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL requested changes to this pull request. Some comments, and check documentation file is not added. https://github.com/llvm/llvm-project/pull/85572 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org

[clang-tools-extra] [clang-tidy] add check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-03-17 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,138 @@ +//===--- MinMaxUseInitializerListCheck.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 check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-03-17 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,138 @@ +//===--- MinMaxUseInitializerListCheck.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 check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-03-17 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,138 @@ +//===--- MinMaxUseInitializerListCheck.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 check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-03-17 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,58 @@ +//===--- MinMaxUseInitializerListCheck.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 check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-03-17 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,138 @@ +//===--- MinMaxUseInitializerListCheck.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 check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-03-17 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,138 @@ +//===--- MinMaxUseInitializerListCheck.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 check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-03-17 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,58 @@ +//===--- MinMaxUseInitializerListCheck.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 check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-03-17 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,138 @@ +//===--- MinMaxUseInitializerListCheck.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 check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-03-17 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,138 @@ +//===--- MinMaxUseInitializerListCheck.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 check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-03-17 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL commented: Tests are also missing. https://github.com/llvm/llvm-project/pull/85572 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Add clang-tidy check readability-math-missing-parentheses (PR #84481)

2024-03-19 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL requested changes to this pull request. Not bad, still few issues left, mainly with `getOpcode`. https://github.com/llvm/llvm-project/pull/84481 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org

[clang-tools-extra] Add clang-tidy check readability-math-missing-parentheses (PR #84481)

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

[clang-tools-extra] Add clang-tidy check readability-math-missing-parentheses (PR #84481)

2024-03-19 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,20 @@ +.. title:: clang-tidy - readability-math-missing-parentheses + +readability-math-missing-parentheses + + +Check for mising parantheses in mathematical expressions that involve operators +of different priorities. + +Before: + +.

[clang-tools-extra] Add clang-tidy check readability-math-missing-parentheses (PR #84481)

2024-03-19 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,68 @@ +//===--- MathMissingParenthesesCheck.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] Add clang-tidy check readability-math-missing-parentheses (PR #84481)

2024-03-19 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,68 @@ +//===--- MathMissingParenthesesCheck.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] Add clang-tidy check readability-math-missing-parentheses (PR #84481)

2024-03-19 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,76 @@ +// RUN: %check_clang_tidy %s readability-math-missing-parentheses %t + +int foo(){ +return 5; +} + +int bar(){ +return 4; +} + +class fun{ +public: +int A; +double B; +fun(){ +A = 5; +B = 5.4; +} +}; + +void f(){ +//C

[clang-tools-extra] Add clang-tidy check readability-math-missing-parentheses (PR #84481)

2024-03-19 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,20 @@ +.. title:: clang-tidy - readability-math-missing-parentheses + +readability-math-missing-parentheses + + +Check for mising parantheses in mathematical expressions that involve operators +of different priorities. + -

[clang-tools-extra] Add clang-tidy check readability-math-missing-parentheses (PR #84481)

2024-03-19 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,20 @@ +.. title:: clang-tidy - readability-math-missing-parentheses + +readability-math-missing-parentheses + + +Check for mising parantheses in mathematical expressions that involve operators PiotrZSL wrote: paranth

[clang-tools-extra] Add clang-tidy check readability-math-missing-parentheses (PR #84481)

2024-03-19 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,31 @@ +//===--- MathMissingParenthesesCheck.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 clang-tidy check readability-math-missing-parentheses (PR #84481)

2024-03-19 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,68 @@ +//===--- MathMissingParenthesesCheck.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] Add clang-tidy check readability-math-missing-parentheses (PR #84481)

2024-03-19 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,31 @@ +//===--- MathMissingParenthesesCheck.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

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