[clang-tools-extra] Add check 'modernize-use-enum-class' (PR #138282)

2025-05-02 Thread Philipp Jung via cfe-commits
https://github.com/JungPhilipp created https://github.com/llvm/llvm-project/pull/138282 Warn on non-class enum definitions as suggested by the Core Guidelines: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Renum-class >From 9e2d442e38d2e4ec28c4bbd432bab25aaa6fee51 Mon Sep 17 00:

[clang-tools-extra] Add check 'cppcoreguidelines-use-enum-class' (PR #138282)

2025-05-12 Thread Philipp Jung via cfe-commits
https://github.com/JungPhilipp updated https://github.com/llvm/llvm-project/pull/138282 >From 0567bc8e1168bb409ee759dd5505861a644a8ead Mon Sep 17 00:00:00 2001 From: Philipp Jung Date: Fri, 2 May 2025 15:22:40 +0200 Subject: [PATCH 1/7] Add check 'modernize-use-enum-class' Warn on non-class en

[clang-tools-extra] Add check 'cppcoreguidelines-use-enum-class' (PR #138282)

2025-05-12 Thread Philipp Jung via cfe-commits
https://github.com/JungPhilipp updated https://github.com/llvm/llvm-project/pull/138282 >From 0567bc8e1168bb409ee759dd5505861a644a8ead Mon Sep 17 00:00:00 2001 From: Philipp Jung Date: Fri, 2 May 2025 15:22:40 +0200 Subject: [PATCH 1/8] Add check 'modernize-use-enum-class' Warn on non-class en

[clang-tools-extra] Add check 'cppcoreguidelines-use-enum-class' (PR #138282)

2025-05-12 Thread Philipp Jung via cfe-commits
@@ -117,6 +117,11 @@ Improvements to clang-tidy New checks ^^ +- New :doc:`cppcoreguidelines-use-enum-class JungPhilipp wrote: Done https://github.com/llvm/llvm-project/pull/138282 ___ cfe-commits mailing l

[clang-tools-extra] Add check 'cppcoreguidelines-use-enum-class' (PR #138282)

2025-05-12 Thread Philipp Jung via cfe-commits
@@ -198,7 +203,7 @@ Changes in existing checks diagnosing designated initializers for ``std::array`` initializations. - Improved :doc:`modernize-use-ranges - ` check by updating suppress + ` check by updating suppress JungPhilipp wrote: Done. Was added b

[clang-tools-extra] Add check 'modernize-use-enum-class' (PR #138282)

2025-05-09 Thread Philipp Jung via cfe-commits
@@ -0,0 +1,13 @@ +// RUN: %check_clang_tidy -std=c++11-or-later %s cppcoreguidelines-use-enum-class %t -- -config="{CheckOptions: {cppcoreguidelines-use-enum-class.IgnoreUnscopedEnumsInClasses: true}}" -- + +enum E {}; +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: enum 'E' is uns

[clang-tools-extra] Add check 'modernize-use-enum-class' (PR #138282)

2025-05-09 Thread Philipp Jung via cfe-commits
@@ -0,0 +1,13 @@ +// RUN: %check_clang_tidy -std=c++11-or-later %s cppcoreguidelines-use-enum-class %t -- -config="{CheckOptions: {cppcoreguidelines-use-enum-class.IgnoreUnscopedEnumsInClasses: true}}" -- JungPhilipp wrote: Done https://github.com/llvm/llvm-pr

[clang-tools-extra] Add check 'modernize-use-enum-class' (PR #138282)

2025-05-09 Thread Philipp Jung via cfe-commits
@@ -0,0 +1,31 @@ +.. title:: clang-tidy - cppcoreguidelines-use-enum-class + +cppcoreguidelines-use-enum-class += JungPhilipp wrote: Done https://github.com/llvm/llvm-project/pull/138282 ___

[clang-tools-extra] Add check 'modernize-use-enum-class' (PR #138282)

2025-05-09 Thread Philipp Jung via cfe-commits
@@ -0,0 +1,31 @@ +.. title:: clang-tidy - cppcoreguidelines-use-enum-class + +cppcoreguidelines-use-enum-class += + +Finds plain non-class ``enum`` definitions that could use ``enum class``. + +This check implements `Enum.3 +

[clang-tools-extra] Add check 'modernize-use-enum-class' (PR #138282)

2025-05-09 Thread Philipp Jung via cfe-commits
@@ -59,6 +60,8 @@ class CppCoreGuidelinesModule : public ClangTidyModule { void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { CheckFactories.registerCheck( "cppcoreguidelines-avoid-capturing-lambda-coroutines"); +CheckFactories.register

[clang-tools-extra] Add check 'modernize-use-enum-class' (PR #138282)

2025-05-09 Thread Philipp Jung via cfe-commits
@@ -136,6 +136,11 @@ New checks Finds potentially erroneous calls to ``reset`` method on smart pointers when the pointee type also has a ``reset`` method. +- New :doc:`cppcoreguidelines-use-enum-class JungPhilipp wrote: Done https://github.com/llvm/llvm-

[clang-tools-extra] Add check 'modernize-use-enum-class' (PR #138282)

2025-05-09 Thread Philipp Jung via cfe-commits
@@ -211,6 +211,7 @@ Clang-Tidy Checks :doc:`cppcoreguidelines-rvalue-reference-param-not-moved `, :doc:`cppcoreguidelines-slicing `, :doc:`cppcoreguidelines-special-member-functions `, + :doc:`cppcoreguidelines-use-enum-class `, "Yes" JungPhilipp

[clang-tools-extra] Add check 'modernize-use-enum-class' (PR #138282)

2025-05-09 Thread Philipp Jung via cfe-commits
@@ -0,0 +1,31 @@ +.. title:: clang-tidy - cppcoreguidelines-use-enum-class + +cppcoreguidelines-use-enum-class += + +Finds plain non-class ``enum`` definitions that could use ``enum class``. + +This check implements `Enum.3 +

[clang-tools-extra] Add check 'modernize-use-enum-class' (PR #138282)

2025-05-09 Thread Philipp Jung via cfe-commits
@@ -0,0 +1,13 @@ +// RUN: %check_clang_tidy -std=c++11-or-later %s cppcoreguidelines-use-enum-class %t -- -config="{CheckOptions: {cppcoreguidelines-use-enum-class.IgnoreUnscopedEnumsInClasses: true}}" -- + +enum E {}; +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: enum 'E' is uns

[clang-tools-extra] Add check 'modernize-use-enum-class' (PR #138282)

2025-05-09 Thread Philipp Jung via cfe-commits
@@ -0,0 +1,31 @@ +.. title:: clang-tidy - cppcoreguidelines-use-enum-class + +cppcoreguidelines-use-enum-class += + +Finds plain non-class ``enum`` definitions that could use ``enum class``. JungPhilipp wrote: Done https://github.com/

[clang-tools-extra] Add check 'modernize-use-enum-class' (PR #138282)

2025-05-09 Thread Philipp Jung via cfe-commits
https://github.com/JungPhilipp updated https://github.com/llvm/llvm-project/pull/138282 >From 0567bc8e1168bb409ee759dd5505861a644a8ead Mon Sep 17 00:00:00 2001 From: Philipp Jung Date: Fri, 2 May 2025 15:22:40 +0200 Subject: [PATCH 1/6] Add check 'modernize-use-enum-class' Warn on non-class en

[clang-tools-extra] Add check 'cppcoreguidelines-use-enum-class' (PR #138282)

2025-05-09 Thread Philipp Jung via cfe-commits
https://github.com/JungPhilipp edited https://github.com/llvm/llvm-project/pull/138282 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Add check 'modernize-use-enum-class' (PR #138282)

2025-05-09 Thread Philipp Jung via cfe-commits
https://github.com/JungPhilipp updated https://github.com/llvm/llvm-project/pull/138282 >From 0567bc8e1168bb409ee759dd5505861a644a8ead Mon Sep 17 00:00:00 2001 From: Philipp Jung Date: Fri, 2 May 2025 15:22:40 +0200 Subject: [PATCH 1/5] Add check 'modernize-use-enum-class' Warn on non-class en

[clang-tools-extra] Add check 'modernize-use-enum-class' (PR #138282)

2025-05-09 Thread Philipp Jung via cfe-commits
@@ -0,0 +1,26 @@ +.. title:: clang-tidy - modernize-use-enum-class + +modernize-use-enum-class += + +Scoped enums (enum class) should be preferred over unscoped enums: JungPhilipp wrote: Done https://github.com/llvm/llvm-project/pull/

[clang-tools-extra] Add check 'modernize-use-enum-class' (PR #138282)

2025-05-09 Thread Philipp Jung via cfe-commits
@@ -0,0 +1,34 @@ +//===--- UseEnumClassCheck.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 check 'modernize-use-enum-class' (PR #138282)

2025-05-09 Thread Philipp Jung via cfe-commits
@@ -0,0 +1,58 @@ +// RUN: %check_clang_tidy -std=c++17-or-later %s modernize-use-enum-class %t JungPhilipp wrote: Done https://github.com/llvm/llvm-project/pull/138282 ___ cfe-commits mailing list cfe-commits@lists.llv

[clang-tools-extra] Add check 'modernize-use-enum-class' (PR #138282)

2025-05-09 Thread Philipp Jung via cfe-commits
@@ -0,0 +1,34 @@ +//===--- UseEnumClassCheck.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 check 'modernize-use-enum-class' (PR #138282)

2025-05-09 Thread Philipp Jung via cfe-commits
@@ -0,0 +1,34 @@ +//===--- UseEnumClassCheck.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 check 'modernize-use-enum-class' (PR #138282)

2025-05-09 Thread Philipp Jung via cfe-commits
@@ -115,6 +115,11 @@ New checks Gives warnings for tagged unions, where the number of tags is different from the number of data members inside the union. +- New :doc:`modernize-use-enum-class + ` check. + + Finds plain non-class enum definitions that could use ``enum cla

[clang-tools-extra] Add check 'modernize-use-enum-class' (PR #138282)

2025-05-09 Thread Philipp Jung via cfe-commits
@@ -0,0 +1,34 @@ +//===--- UseEnumClassCheck.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 check 'modernize-use-enum-class' (PR #138282)

2025-05-09 Thread Philipp Jung via cfe-commits
@@ -0,0 +1,26 @@ +.. title:: clang-tidy - modernize-use-enum-class + +modernize-use-enum-class += + +Scoped enums (enum class) should be preferred over unscoped enums: +https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Renum-class ---

[clang-tools-extra] Add check 'modernize-use-enum-class' (PR #138282)

2025-05-09 Thread Philipp Jung via cfe-commits
@@ -0,0 +1,34 @@ +//===--- UseEnumClassCheck.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 check 'modernize-use-enum-class' (PR #138282)

2025-05-09 Thread Philipp Jung via cfe-commits
JungPhilipp wrote: > Your branch seems to be way behind current `main`, and > `clang-tools-extra/docs/ReleaseNotes.rst` seems to be from already released > 20th version of LLVM. (I don't know how can it even show some kind of diff) > Could you please rebase on fresh `main` branch. Done https

[clang-tools-extra] Add check 'modernize-use-enum-class' (PR #138282)

2025-05-09 Thread Philipp Jung via cfe-commits
@@ -0,0 +1,26 @@ +.. title:: clang-tidy - modernize-use-enum-class + +modernize-use-enum-class += + +Scoped enums (enum class) should be preferred over unscoped enums: +https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Renum-class + +Unscoped

[clang-tools-extra] Add check 'cppcoreguidelines-use-enum-class' (PR #138282)

2025-05-19 Thread Philipp Jung via cfe-commits
https://github.com/JungPhilipp updated https://github.com/llvm/llvm-project/pull/138282 >From 0567bc8e1168bb409ee759dd5505861a644a8ead Mon Sep 17 00:00:00 2001 From: Philipp Jung Date: Fri, 2 May 2025 15:22:40 +0200 Subject: [PATCH 1/9] Add check 'modernize-use-enum-class' Warn on non-class en

[clang-tools-extra] Add check 'cppcoreguidelines-use-enum-class' (PR #138282)

2025-05-19 Thread Philipp Jung via cfe-commits
@@ -130,6 +130,11 @@ New checks Finds unintended character output from ``unsigned char`` and ``signed char`` to an ``ostream``. +- New :doc:`cppcoreguidelines-use-enum-class + ` check. + + Finds plain non-class ``enum`` definitions that could use ``enum class``.

[clang-tools-extra] Add check 'cppcoreguidelines-use-enum-class' (PR #138282)

2025-05-16 Thread Philipp Jung via cfe-commits
JungPhilipp wrote: Thanks to everybody for the quick and thorough reviews. I really appreciate the help! Is there anything else to do for me at this point? https://github.com/llvm/llvm-project/pull/138282 ___ cfe-commits mailing list cfe-commits@lists

[clang-tools-extra] Add check 'cppcoreguidelines-use-enum-class' (PR #138282)

2025-06-13 Thread Philipp Jung via cfe-commits
https://github.com/JungPhilipp updated https://github.com/llvm/llvm-project/pull/138282 >From 414fd293764c04bc86154f2d7b42c31a3a0ea693 Mon Sep 17 00:00:00 2001 From: Philipp Jung Date: Fri, 2 May 2025 15:22:40 +0200 Subject: [PATCH 01/11] Add check 'modernize-use-enum-class' Warn on non-class

[clang-tools-extra] Add check 'cppcoreguidelines-use-enum-class' (PR #138282)

2025-06-13 Thread Philipp Jung via cfe-commits
JungPhilipp wrote: > Also, please rebase (there are some merge conflicts), and also mark > conversations as resolved (I see there's a few remaining) Done, ready-for-review https://github.com/llvm/llvm-project/pull/138282 ___ cfe-commits mailing list

[clang-tools-extra] Add check 'cppcoreguidelines-use-enum-class' (PR #138282)

2025-06-13 Thread Philipp Jung via cfe-commits
https://github.com/JungPhilipp updated https://github.com/llvm/llvm-project/pull/138282 >From 0567bc8e1168bb409ee759dd5505861a644a8ead Mon Sep 17 00:00:00 2001 From: Philipp Jung Date: Fri, 2 May 2025 15:22:40 +0200 Subject: [PATCH 01/10] Add check 'modernize-use-enum-class' Warn on non-class

[clang-tools-extra] Add check 'cppcoreguidelines-use-enum-class' (PR #138282)

2025-06-13 Thread Philipp Jung via cfe-commits
https://github.com/JungPhilipp updated https://github.com/llvm/llvm-project/pull/138282 >From 414fd293764c04bc86154f2d7b42c31a3a0ea693 Mon Sep 17 00:00:00 2001 From: Philipp Jung Date: Fri, 2 May 2025 15:22:40 +0200 Subject: [PATCH 01/10] Add check 'modernize-use-enum-class' Warn on non-class

[clang-tools-extra] Add check 'cppcoreguidelines-use-enum-class' (PR #138282)

2025-06-13 Thread Philipp Jung via cfe-commits
https://github.com/JungPhilipp updated https://github.com/llvm/llvm-project/pull/138282 >From 414fd293764c04bc86154f2d7b42c31a3a0ea693 Mon Sep 17 00:00:00 2001 From: Philipp Jung Date: Fri, 2 May 2025 15:22:40 +0200 Subject: [PATCH 01/12] Add check 'modernize-use-enum-class' Warn on non-class

[clang-tools-extra] Add check 'cppcoreguidelines-use-enum-class' (PR #138282)

2025-06-13 Thread Philipp Jung via cfe-commits
@@ -110,6 +110,7 @@ class ModernizeModule : public ClangTidyModule { CheckFactories.registerCheck( "modernize-use-default-member-init"); CheckFactories.registerCheck("modernize-use-emplace"); + CheckFactories.registerCheck("modernize-use-enum-class"); --