[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-05-23 Thread via cfe-commits
___ 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 bugprone-tagged-union-member-count (PR #89925)

2024-05-23 Thread via cfe-commits
=?utf-8?b?R8OhYm9yIFTDs3RodsOhcmk=?= Message-ID: In-Reply-To: @@ -0,0 +1,145 @@ +//===--- TaggedUnionMemberCountCheck.cpp - clang-tidy -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-05-23 Thread via cfe-commits
___ 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 bugprone-tagged-union-member-count (PR #89925)

2024-05-23 Thread via cfe-commits
=?utf-8?b?R8OhYm9yIFTDs3RodsOhcmk=?= Message-ID: In-Reply-To: @@ -0,0 +1,145 @@ +//===--- TaggedUnionMemberCountCheck.cpp - clang-tidy -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-05-23 Thread via cfe-commits
=?utf-8?b?R8OhYm9yIFTDs3RodsOhcmk=?= Message-ID: In-Reply-To: @@ -0,0 +1,37 @@ +//===--- TaggedUnionMemberCountCheck.h - clang-tidy -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-05-23 Thread via cfe-commits
=?utf-8?b?R8OhYm9yIFTDs3RodsOhcmk=?= Message-ID: In-Reply-To: @@ -0,0 +1,37 @@ +//===--- TaggedUnionMemberCountCheck.h - clang-tidy -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-05-23 Thread via cfe-commits
=?utf-8?b?R8OhYm9yIFTDs3RodsOhcmk=?= Message-ID: In-Reply-To: https://github.com/whisperity edited https://github.com/llvm/llvm-project/pull/89925 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-05-23 Thread via cfe-commits
=?utf-8?b?R8OhYm9yIFTDs3RodsOhcmk=?= Message-ID: In-Reply-To: @@ -0,0 +1,150 @@ +// RUN: %check_clang_tidy -std=c++98-or-later %s bugprone-tagged-union-member-count %t \ +// RUN: -config='{CheckOptions: { \ +// RUN: bugprone-tagged-union-member-count.StrictMode: 1, \

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-05-23 Thread via cfe-commits
=?utf-8?b?R8OhYm9yIFTDs3RodsOhcmk=?= Message-ID: In-Reply-To: https://github.com/whisperity requested changes to this pull request. https://github.com/llvm/llvm-project/pull/89925 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-05-22 Thread via cfe-commits
=?utf-8?b?R8OhYm9yIFTDs3RodsOhcmk=?= Message-ID: In-Reply-To: https://github.com/tigbr updated https://github.com/llvm/llvm-project/pull/89925 >From 0dff511a0f63480dea527b6e823dcf230755f312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20T=C3=B3thv=C3=A1ri?= Date: Sun, 3 Mar 2024

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
@@ -0,0 +1,181 @@ +// RUN: %check_clang_tidy %s bugprone-tagged-union-member-count %t + +enum tags3 { + tags3_1, + tags3_2, + tags3_3, +}; + +enum tags4 { + tags4_1, + tags4_2, + tags4_3, + tags4_4, +}; + +enum tags5 { + tags5_1, +

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
@@ -0,0 +1,125 @@ +//===--- TaggedUnionMemberCountCheck.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:

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
@@ -0,0 +1,181 @@ +// RUN: %check_clang_tidy %s bugprone-tagged-union-member-count %t + +enum tags3 { + tags3_1, + tags3_2, + tags3_3, +}; + +enum tags4 { + tags4_1, + tags4_2, + tags4_3, + tags4_4, +}; + +enum tags5 { + tags5_1, +

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
@@ -0,0 +1,125 @@ +//===--- TaggedUnionMemberCountCheck.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:

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
@@ -0,0 +1,125 @@ +//===--- TaggedUnionMemberCountCheck.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:

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
@@ -0,0 +1,125 @@ +//===--- TaggedUnionMemberCountCheck.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:

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
@@ -0,0 +1,181 @@ +// RUN: %check_clang_tidy %s bugprone-tagged-union-member-count %t + +enum tags3 { + tags3_1, + tags3_2, + tags3_3, +}; + +enum tags4 { + tags4_1, + tags4_2, + tags4_3, + tags4_4, +}; + +enum tags5 { + tags5_1, +

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
@@ -0,0 +1,66 @@ +.. title:: clang-tidy - bugprone-tagged-union-member-count + +bugprone-tagged-union-member-count +== + +Gives warnings for tagged unions, where the number of tags is +different from the number of data members inside the union. +

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
@@ -0,0 +1,125 @@ +//===--- TaggedUnionMemberCountCheck.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:

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
@@ -0,0 +1,125 @@ +//===--- TaggedUnionMemberCountCheck.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:

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
@@ -0,0 +1,125 @@ +//===--- TaggedUnionMemberCountCheck.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:

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
https://github.com/isuckatcs requested changes to this pull request. I like the motivation behind the check, but I would also like to see more testing and some formatting to be fixed. https://github.com/llvm/llvm-project/pull/89925 ___ cfe-commits

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
@@ -0,0 +1,125 @@ +//===--- TaggedUnionMemberCountCheck.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:

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
@@ -0,0 +1,125 @@ +//===--- TaggedUnionMemberCountCheck.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:

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
@@ -0,0 +1,125 @@ +//===--- TaggedUnionMemberCountCheck.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:

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
@@ -0,0 +1,125 @@ +//===--- TaggedUnionMemberCountCheck.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:

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
https://github.com/isuckatcs edited https://github.com/llvm/llvm-project/pull/89925 ___ 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 bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,181 @@ +// RUN: %check_clang_tidy %s bugprone-tagged-union-member-count %t + +enum tags3 { + tags3_1, + tags3_2, + tags3_3, +}; + +enum tags4 { + tags4_1, + tags4_2, + tags4_3, + tags4_4, +}; + +enum tags5 { + tags5_1, +

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread Piotr Zegar via cfe-commits
@@ -142,6 +142,7 @@ Clang-Tidy Checks :doc:`bugprone-suspicious-stringview-data-usage `, :doc:`bugprone-swapped-arguments `, "Yes" :doc:`bugprone-switch-missing-default-case `, + :doc:`bugprone-tagged-union-member-count `, "Yes" PiotrZSL wrote:

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread Piotr Zegar via cfe-commits
@@ -129,6 +129,12 @@ New checks Replaces certain conditional statements with equivalent calls to ``std::min`` or ``std::max``. +- New :doc:`bugprone-tagged-union-member-count + ` check. + + Warns about suspicious looking tagged unions where the number of enum +

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread Piotr Zegar via cfe-commits
@@ -129,6 +129,12 @@ New checks Replaces certain conditional statements with equivalent calls to ``std::min`` or ``std::max``. +- New :doc:`bugprone-tagged-union-member-count PiotrZSL wrote: move to line 119, keep in alphabetical order

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,181 @@ +// RUN: %check_clang_tidy %s bugprone-tagged-union-member-count %t + +enum tags3 { + tags3_1, + tags3_2, + tags3_3, +}; + +enum tags4 { + tags4_1, + tags4_2, + tags4_3, + tags4_4, +}; + +enum tags5 { + tags5_1, +

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,125 @@ +//===--- TaggedUnionMemberCountCheck.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:

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,181 @@ +// RUN: %check_clang_tidy %s bugprone-tagged-union-member-count %t + +enum tags3 { + tags3_1, + tags3_2, + tags3_3, +}; + +enum tags4 { + tags4_1, + tags4_2, + tags4_3, + tags4_4, +}; + +enum tags5 { + tags5_1, +

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,31 @@ +//===--- TaggedUnionMemberCountCheck.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:

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,125 @@ +//===--- TaggedUnionMemberCountCheck.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:

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,125 @@ +//===--- TaggedUnionMemberCountCheck.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:

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL requested changes to this pull request. This check may not have to many users, but that's fine. I'm 100% sure that I seen such structures already. As for code changes, please fix pointed out nits and after that checkout probably could be merged.

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/89925 ___ 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 bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
@@ -0,0 +1,66 @@ +.. title:: clang-tidy - bugprone-tagged-union-member-count + +bugprone-tagged-union-member-count +== + +Gives warnings for tagged unions, where the number of tags is +different from the number of data members inside the union. +

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
@@ -0,0 +1,125 @@ +//===--- TaggedUnionMemberCountCheck.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:

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
@@ -0,0 +1,125 @@ +//===--- TaggedUnionMemberCountCheck.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:

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
@@ -0,0 +1,181 @@ +// RUN: %check_clang_tidy %s bugprone-tagged-union-member-count %t + +enum tags3 { + tags3_1, + tags3_2, + tags3_3, +}; + +enum tags4 { + tags4_1, + tags4_2, + tags4_3, + tags4_4, +}; + +enum tags5 { + tags5_1, +

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
@@ -0,0 +1,181 @@ +// RUN: %check_clang_tidy %s bugprone-tagged-union-member-count %t + +enum tags3 { + tags3_1, EugeneZelenko wrote: Will be good idea to run Clang-format over this file. https://github.com/llvm/llvm-project/pull/89925

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
github-actions[bot] wrote: Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you,

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-tidy Author: None (tigbr) Changes This patch introduces a new check to find mismatches between the number of data members in a union and the number enum values present in variant-like structures. Variant-like types can look something like this:

[clang-tools-extra] [clang-tidy] Add new check bugprone-tagged-union-member-count (PR #89925)

2024-04-24 Thread via cfe-commits
https://github.com/tigbr created https://github.com/llvm/llvm-project/pull/89925 This patch introduces a new check to find mismatches between the number of data members in a union and the number enum values present in variant-like structures. Variant-like types can look something like this: