[clang-tools-extra] [clang] [clang-tidy] fix misc-const-correctnes false-positive for fold expressions (PR #78320)

2024-01-21 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. https://github.com/llvm/llvm-project/pull/78320 ___ 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 macros handling in cppcoreguidelines-prefer-member-initializer (PR #72037)

2024-01-22 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL closed https://github.com/llvm/llvm-project/pull/72037 ___ 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-chained-comparison check (PR #76365)

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

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

2024-01-22 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. Just few style issues. For me from functional point of view this check looks fine and even in this limited state could be delivered. Personaly: - I would like to see more code moved into AST matchers - Support for if/else - Support for cod

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

2024-01-22 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] [clang-tools-extra] [llvm] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-22 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,137 @@ +//===--- UseStdMinMaxCheck.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

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

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

2024-01-22 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,32 @@ +.. title:: clang-tidy - readability-use-std-min-max + +readability-use-std-min-max +=== + +Replaces certain conditional statements with equivalent ``std::min`` or +``std::max`` expressions. Note: This may impact +performance in critical co

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

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

2024-01-22 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,137 @@ +//===--- UseStdMinMaxCheck.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

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

2024-01-22 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,137 @@ +//===--- UseStdMinMaxCheck.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

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

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

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

2024-01-22 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,137 @@ +//===--- UseStdMinMaxCheck.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] [clang-tidy] fix misc-const-correctnes false-positive for fold expressions (PR #78320)

2024-01-22 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: @PiotrZSL I would say: fell free to merge it. It's not that it would break too much. In worst case we got around ~1 month to fix it on a branch (if someone would complain). https://github.com/llvm/llvm-project/pull/78320 ___ cfe-commi

[clang-tools-extra] [clang] [clang-tidy] fix misc-const-correctnes false-positive for fold expressions (PR #78320)

2024-01-22 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: @5chmidti I would say: fell free to merge it. It's not that it would break too much. In worst case we got around ~1 month to fix it on a branch (if someone would complain). https://github.com/llvm/llvm-project/pull/78320 ___ cfe-commi

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

2024-01-22 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] [clang] [llvm] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-22 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. 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] [clang-tools-extra] [llvm] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-22 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,29 @@ +.. title:: clang-tidy - readability-use-std-min-max + +readability-use-std-min-max +=== + +Replaces certain conditional statements with equivalent ``std::min`` or +``std::max`` expressions. Note: This may impact PiotrZSL w

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

2024-01-22 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,29 @@ +.. title:: clang-tidy - readability-use-std-min-max + +readability-use-std-min-max +=== + +Replaces certain conditional statements with equivalent ``std::min`` or +``std::max`` expressions. Note: This may impact PiotrZSL w

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

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

2024-01-22 Thread Piotr Zegar via cfe-commits
@@ -241,6 +241,12 @@ New checks Detects C++ code where a reference variable is used to extend the lifetime of a temporary object that has just been constructed. +- New :doc:`readability-use-std-min-max + ` check. + + Replaces certain conditional statements with equivalen

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

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

2024-01-22 Thread Piotr Zegar via cfe-commits
@@ -18,6 +18,45 @@ namespace clang::tidy::readability { static const llvm::StringRef AlgorithmHeader(""); +static bool MinCondition(const BinaryOperator::Opcode &Op,const Expr *CondLhs,const Expr *CondRhs,const Expr *AssignLhs,const Expr *AssignRhs,const ASTContext &Context

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

2024-01-22 Thread Piotr Zegar via cfe-commits
@@ -18,6 +18,45 @@ namespace clang::tidy::readability { static const llvm::StringRef AlgorithmHeader(""); +static bool MinCondition(const BinaryOperator::Opcode &Op,const Expr *CondLhs,const Expr *CondRhs,const Expr *AssignLhs,const Expr *AssignRhs,const ASTContext &Context

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

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

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

2024-01-22 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,151 @@ +//===--- UseStdMinMaxCheck.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

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

2024-01-22 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

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

2024-01-22 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. Except reported nits, looks fine. 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-commit

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

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

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

2024-01-22 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,151 @@ +//===--- UseStdMinMaxCheck.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

[llvm] [clang] [clang-tools-extra] [clang-tidy] Fixes to readability-implicit-bool-conversion (PR #72050)

2024-01-22 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL updated https://github.com/llvm/llvm-project/pull/72050 >From 09bc9ecebe2e9d49a690c9864aa09d5b8c4403e4 Mon Sep 17 00:00:00 2001 From: Piotr Zegar Date: Sun, 12 Nov 2023 11:31:21 + Subject: [PATCH 1/3] [clang-tidy] Fixes to readability-implicit-bool-conversion -

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

2024-01-22 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL requested changes to this pull request. There are still some functional bugs. I would say safer would be to postpone this check to Clang-tidy 19. https://github.com/llvm/llvm-project/pull/77816 ___ cfe-commits mailing list

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

2024-01-22 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] [llvm] [clang] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-22 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,151 @@ +//===--- UseStdMinMaxCheck.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] 150a58b - [clang-tidy][DOC] Update list.rst

2024-01-22 Thread Piotr Zegar via cfe-commits
Author: Piotr Zegar Date: 2024-01-23T07:09:24Z New Revision: 150a58bed08f9f83ae4157a033ef1c67c210bbc4 URL: https://github.com/llvm/llvm-project/commit/150a58bed08f9f83ae4157a033ef1c67c210bbc4 DIFF: https://github.com/llvm/llvm-project/commit/150a58bed08f9f83ae4157a033ef1c67c210bbc4.diff LOG: [

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

2024-01-22 Thread Piotr Zegar via cfe-commits
@@ -147,10 +161,52 @@ void OwningMemoryCheck::registerMatchers(MatchFinder *Finder) { // Matching on functions, that return an owner/resource, but don't declare // their return type as owner. Finder->addMatcher( - functionDecl(hasDescendant(returnStmt(hasReturnValue

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

2024-01-23 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/77246 ___ 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-23 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/77246 ___ 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-23 Thread Piotr Zegar via cfe-commits
@@ -147,10 +161,52 @@ void OwningMemoryCheck::registerMatchers(MatchFinder *Finder) { // Matching on functions, that return an owner/resource, but don't declare // their return type as owner. Finder->addMatcher( - functionDecl(hasDescendant(returnStmt(hasReturnValue

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

2024-01-23 Thread Piotr Zegar via cfe-commits
@@ -147,10 +161,52 @@ void OwningMemoryCheck::registerMatchers(MatchFinder *Finder) { // Matching on functions, that return an owner/resource, but don't declare // their return type as owner. Finder->addMatcher( - functionDecl(hasDescendant(returnStmt(hasReturnValue

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

2024-01-23 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL updated https://github.com/llvm/llvm-project/pull/77246 >From b2e230f90f97c0fb3385ab05d0217371b72b9a88 Mon Sep 17 00:00:00 2001 From: Piotr Zegar Date: Sun, 7 Jan 2024 18:52:05 + Subject: [PATCH 1/2] [clang-tidy] Add support for lambdas in cppcoreguidelines-owni

[clang-tools-extra] [run-clang-tidy] Add option -export-directory (PR #69453)

2023-10-18 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: There is already --export_fixes that can be used in +- same way. Maybe better would be to change --export_fixes to take filename or directory (ends with / or exist as directory), and in that case it could save to directory or merge to single file. https://github.com/llvm/llvm-p

[clang-tools-extra] [run-clang-tidy] Accept directory as value for -export-fixes (PR #69453)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -384,14 +386,26 @@ def main(): clang_tidy_binary = find_binary(args.clang_tidy_binary, "clang-tidy", build_path) -tmpdir = None if args.fix: clang_apply_replacements_binary = find_binary( args.clang_apply_replacements_binary, "clang-appl

[clang-tools-extra] [run-clang-tidy] Accept directory as value for -export-fixes (PR #69453)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -384,14 +386,26 @@ def main(): clang_tidy_binary = find_binary(args.clang_tidy_binary, "clang-tidy", build_path) -tmpdir = None if args.fix: clang_apply_replacements_binary = find_binary( args.clang_apply_replacements_binary, "clang-appl

[clang-tools-extra] [run-clang-tidy] Accept directory as value for -export-fixes (PR #69453)

2023-10-18 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL commented: Release notes will be needed, in clang-tools-extra/docs/ReleaseNotes.rst. Additionally probably similar change should be done to clang-tidy-diff.py https://github.com/llvm/llvm-project/pull/69453 ___ cfe-commits m

[clang-tools-extra] [clang-tidy]Add new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,46 @@ +//===--- CastingThroughVoidCheck.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 new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,46 @@ +//===--- CastingThroughVoidCheck.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 new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,46 @@ +//===--- CastingThroughVoidCheck.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 new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,46 @@ +//===--- CastingThroughVoidCheck.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 new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,46 @@ +//===--- CastingThroughVoidCheck.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 new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,46 @@ +//===--- CastingThroughVoidCheck.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 new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,46 @@ +//===--- CastingThroughVoidCheck.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 new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,37 @@ +//===--- CastingThroughVoidCheck.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 new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,37 @@ +//===--- CastingThroughVoidCheck.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 new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -125,6 +125,12 @@ Improvements to clang-tidy New checks ^^ +- New :doc:`bugprone-casting-through-void + ` check. + + Detects usage of ``static_cast`` pointer to the other pointer throght PiotrZSL wrote: Not only static_cast, need some generic des

[clang-tools-extra] [clang-tidy]Add new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -82,6 +82,7 @@ Clang-Tidy Checks :doc:`bugprone-bad-signal-to-kill-thread `, :doc:`bugprone-bool-pointer-implicit-conversion `, "Yes" :doc:`bugprone-branch-clone `, + :doc:`bugprone-casting-through-void `, "Yes" PiotrZSL wrote: Remove "Yes", ch

[clang-tools-extra] [clang-tidy]Add new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,18 @@ +// RUN: %check_clang_tidy %s bugprone-casting-through-void %t + +using T = void*; + +void test() { + int i = 100; + double d = 100; + + static_cast(static_cast(&d)); + // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not cast double * to int * through void * [

[clang-tools-extra] [clang-tidy]Add new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL commented: Good start, I will look more closely into documentation once I finish work. https://github.com/llvm/llvm-project/pull/69465 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/ma

[clang-tools-extra] [run-clang-tidy, clang-tidy-diff] Accept directory as value for -export-fixes (PR #69453)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -327,14 +345,14 @@ def main(): if yaml and args.export_fixes: PiotrZSL wrote: if combine_fixes: https://github.com/llvm/llvm-project/pull/69453 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://li

[clang-tools-extra] [run-clang-tidy, clang-tidy-diff] Accept directory as value for -export-fixes (PR #69453)

2023-10-18 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. LGTM. Would be good to test if both scripts are working before merge. https://github.com/llvm/llvm-project/pull/69453 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org

[clang-tools-extra] [clang-tidy]Add new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,11 @@ +.. title:: clang-tidy - bugprone-casting-through-void + +bugprone-casting-through-void += + +A check detects usage of ``static_cast`` pointer to the other pointer throght PiotrZSL wrote: ```Detects unsafe or redundant

[clang] [clang-tidy]Add new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,11 @@ +.. title:: clang-tidy - bugprone-casting-through-void + +bugprone-casting-through-void += + +A check detects usage of ``static_cast`` pointer to the other pointer throght +``static_cast`` to ``void *`` in C++ code. + +Use of these cast

[clang] [clang-tidy]Add new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,11 @@ +.. title:: clang-tidy - bugprone-casting-through-void + +bugprone-casting-through-void += + +A check detects usage of ``static_cast`` pointer to the other pointer throght +``static_cast`` to ``void *`` in C++ code. + +Use of these cast

[clang-tools-extra] 5987123 - [clang-tidy][DOC] Fix list.rst

2023-10-18 Thread Piotr Zegar via cfe-commits
Author: Piotr Zegar Date: 2023-10-18T16:26:08Z New Revision: 598712315b0e55e860d8c82e6e212df20b4d3ff4 URL: https://github.com/llvm/llvm-project/commit/598712315b0e55e860d8c82e6e212df20b4d3ff4 DIFF: https://github.com/llvm/llvm-project/commit/598712315b0e55e860d8c82e6e212df20b4d3ff4.diff LOG: [

[clang-tools-extra] 1891d21 - [clang-tidy][DOC] Fix syntax in coroutine-hostile-raii.rst

2023-10-18 Thread Piotr Zegar via cfe-commits
Author: Piotr Zegar Date: 2023-10-18T16:30:18Z New Revision: 1891d21312cf45f070532bd3709eecf6a0e4f54e URL: https://github.com/llvm/llvm-project/commit/1891d21312cf45f070532bd3709eecf6a0e4f54e DIFF: https://github.com/llvm/llvm-project/commit/1891d21312cf45f070532bd3709eecf6a0e4f54e.diff LOG: [

[clang] [clang-tidy]Add new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,50 @@ +//===--- CastingThroughVoidCheck.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] [clang-tidy]Add new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,32 @@ +.. title:: clang-tidy - bugprone-casting-through-void + +bugprone-casting-through-void += + +A check detects unsafe or redundant two-step casting operations involving ``void*``. + +Two-step type conversions via void* are discouraged f

[clang] [clang-tidy]Add new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,32 @@ +.. title:: clang-tidy - bugprone-casting-through-void + +bugprone-casting-through-void += + +A check detects unsafe or redundant two-step casting operations involving ``void*``. PiotrZSL wrote: do not start with A ch

[clang] [clang-tidy]Add new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,32 @@ +.. title:: clang-tidy - bugprone-casting-through-void + +bugprone-casting-through-void += + +A check detects unsafe or redundant two-step casting operations involving ``void*``. + +Two-step type conversions via void* are discouraged f

[clang] [clang-tidy]Add new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,32 @@ +.. title:: clang-tidy - bugprone-casting-through-void + +bugprone-casting-through-void += + +A check detects unsafe or redundant two-step casting operations involving ``void*``. + +Two-step type conversions via void* are discouraged f

[clang] [clang-tidy]Add new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,96 @@ +// RUN: %check_clang_tidy %s bugprone-casting-through-void %t + +using V = void*; +using CV = const void*; + +int i = 100; +double d = 100; +const int ci = 100; +const double cd = 100; + +void normal_test() { + static_cast(static_cast(&d)); + // CHECK-MESSAGES:

[clang] [clang-tidy]Add new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,96 @@ +// RUN: %check_clang_tidy %s bugprone-casting-through-void %t + +using V = void*; +using CV = const void*; + +int i = 100; +double d = 100; +const int ci = 100; +const double cd = 100; + +void normal_test() { + static_cast(static_cast(&d)); + // CHECK-MESSAGES:

[clang] [clang-tidy]Add new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,96 @@ +// RUN: %check_clang_tidy %s bugprone-casting-through-void %t + +using V = void*; +using CV = const void*; + +int i = 100; +double d = 100; +const int ci = 100; +const double cd = 100; + +void normal_test() { + static_cast(static_cast(&d)); + // CHECK-MESSAGES:

[clang] [clang-tidy]Add new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,96 @@ +// RUN: %check_clang_tidy %s bugprone-casting-through-void %t + +using V = void*; +using CV = const void*; + +int i = 100; +double d = 100; +const int ci = 100; +const double cd = 100; + +void normal_test() { + static_cast(static_cast(&d)); + // CHECK-MESSAGES:

[clang] [clang-tidy]Add new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,50 @@ +//===--- CastingThroughVoidCheck.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] [clang-tidy]Add new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,32 @@ +.. title:: clang-tidy - bugprone-casting-through-void + +bugprone-casting-through-void += + +A check detects unsafe or redundant two-step casting operations involving ``void*``. + +Two-step type conversions via void* are discouraged f

[clang] [clang-tidy]Add new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -2732,6 +2732,16 @@ extern const internal::VariadicDynCastAllOfMatcher castExpr; extern const internal::VariadicDynCastAllOfMatcher cxxFunctionalCastExpr; +/// Matches a builtin bit cast expression. +/// +/// Example: Matches __builtin_bit_cast(double, i) in +/// \code

[clang] [clang-tidy]Add new check bugprone-casting-through-void (PR #69465)

2023-10-18 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,50 @@ +//===--- CastingThroughVoidCheck.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] fea55db - [clang-tidy][DOC] Fix syntax in coroutine-hostile-raii.rst

2023-10-18 Thread Piotr Zegar via cfe-commits
Author: Piotr Zegar Date: 2023-10-18T17:34:40Z New Revision: fea55db23372e24e764627c81dd7cf565dcf54c2 URL: https://github.com/llvm/llvm-project/commit/fea55db23372e24e764627c81dd7cf565dcf54c2 DIFF: https://github.com/llvm/llvm-project/commit/fea55db23372e24e764627c81dd7cf565dcf54c2.diff LOG: [

[clang-tools-extra] [clang-tidy] Improved cppcoreguidelines-pro-type-const-cast (PR #69501)

2023-10-18 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL created https://github.com/llvm/llvm-project/pull/69501 Improved cppcoreguidelines-pro-type-const-cast check to ignore casts to const type (controlled by option) and casts in implicitly invoked code. Fixes #69319 >From ada6ee07f310ce482ef0cb0339b25db6e31d8c13 Mon

[clang-tools-extra] [clang-tidy] Ignore deleted functions in cppcoreguidelines-rvalue-reference-param-not-moved (PR #69514)

2023-10-18 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL created https://github.com/llvm/llvm-project/pull/69514 Ignore functions and constructors that are maked deleted or defaulted in cppcoreguidelines-rvalue-reference-param-not-moved check. Fixes #69412 >From 1b32a05c1de0b22749e6f4c2754ade8f7544acce Mon Sep 17 00:00:

[clang-tools-extra] [clang-tidy] Add StrictMode to cppcoreguidelines-pro-type-static-cast-downcast (PR #69529)

2023-10-18 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL created https://github.com/llvm/llvm-project/pull/69529 Add StrictMode option that controls behavior whatever warnings are emitted for casts on non-polymorphic types. Fixes: #69414 >From 641a1daf6cd969a697c3cb4f0f7e168ca9187fe9 Mon Sep 17 00:00:00 2001 From: Piotr Z

[clang-tools-extra] [clang-tidy]Add new check bugprone-casting-through-void (PR #69465)

2023-10-20 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,46 @@ +//===--- CastingThroughVoidCheck.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 new check bugprone-casting-through-void (PR #69465)

2023-10-20 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. LGTM. About `static_cast(reinterpret_cast(&i));`: - I'm working now on a check for redundant casts, it will detect this one, so no need to do it in this check. You may consider adding support for double and more pointers, but that's not s

[clang-tools-extra] [run-clang-tidy, clang-tidy-diff] Accept directory as value for -export-fixes (PR #69453)

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

[clang-tools-extra] [clang-tidy] modernize-avoid-bind only return for non-void function (PR #69207)

2023-10-20 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: > Any particular reason for the `+-`? Maybe it can be resolved? I'm just not too familiar with this check. But current change looks fine, and could be merged. https://github.com/llvm/llvm-project/pull/69207 ___ cfe-commits mailing list

[clang-tools-extra] Fix #68492: point to the correct const location (PR #69103)

2023-10-20 Thread Piotr Zegar via cfe-commits
@@ -297,6 +297,10 @@ Changes in existing checks ` check to ignore false-positive for ``if constexpr`` in lambda expression. +- Improved :doc:`readability-const-params-in-decls + ` place the hint check under PiotrZSL wrote: `Improved xyz check to place .

[clang-tools-extra] Fix #68492: point to the correct const location (PR #69103)

2023-10-20 Thread Piotr Zegar via cfe-commits
@@ -297,6 +297,10 @@ Changes in existing checks ` check to ignore false-positive for ``if constexpr`` in lambda expression. +- Improved :doc:`readability-const-params-in-decls + ` place the hint check under PiotrZSL wrote: Or it can be just Improved xyz

[clang-tools-extra] Fix #68492: point to the correct const location (PR #69103)

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

[clang-tools-extra] Fix #35272: Don't replace typedefs in extern c scope (PR #69102)

2023-10-20 Thread Piotr Zegar via cfe-commits
@@ -285,6 +285,10 @@ Changes in existing checks ` check to fix function pointer and forward declared ``typedef`` correctly. +- Improved :doc:`modernize-use-using PiotrZSL wrote: merge with previous entry for this check. https://github.com/llvm/llvm-proje

[clang-tools-extra] Fix #35272: Don't replace typedefs in extern c scope (PR #69102)

2023-10-20 Thread Piotr Zegar via cfe-commits
@@ -325,6 +329,7 @@ Changes in existing checks identify calls to static member functions with out-of-class inline definitions. + PiotrZSL wrote: remove added empty line https://github.com/llvm/llvm-project/pull/69102 _

[clang-tools-extra] Fix #35272: Don't replace typedefs in extern c scope (PR #69102)

2023-10-20 Thread Piotr Zegar via cfe-commits
@@ -28,6 +28,15 @@ After: using R_t = struct { int a; }; using R_p = R_t*; +The checker ignores `typedef` within `extern "C" { ... }` blocks. + +.. code-block:: c++ + + extern "C" { + PiotrZSL wrote: remove empty line https://github.com/llvm/llvm-projec

[clang-tools-extra] Fix #35272: Don't replace typedefs in extern c scope (PR #69102)

2023-10-20 Thread Piotr Zegar via cfe-commits
@@ -28,6 +28,15 @@ After: using R_t = struct { int a; }; using R_p = R_t*; +The checker ignores `typedef` within `extern "C" { ... }` blocks. PiotrZSL wrote: Maybe this should be put into configuration option ? To give an option to preserve current behav

[clang-tools-extra] [run-clang-tidy] Accept export directory if PyYAML is not installed (PR #69700)

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

[clang-tools-extra] [run-clang-tidy] Accept export directory if PyYAML is not installed (PR #69700)

2023-10-20 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: > Is there any way to trigger the failing tests within this PR? No, in worst case we can revert faulty change. https://github.com/llvm/llvm-project/pull/69700 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.o

[clang-tools-extra] [run-clang-tidy] Accept export directory if PyYAML is not installed (PR #69700)

2023-10-20 Thread Piotr Zegar via cfe-commits
PiotrZSL wrote: Lets push this, if it wont help then we can revert oryginal change. https://github.com/llvm/llvm-project/pull/69700 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [run-clang-tidy] Accept export directory if PyYAML is not installed (PR #69700)

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

<    5   6   7   8   9   10   11   12   13   14   >