diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp @@ -12,6 +12,7 @@ #include "../misc/NonPrivateMemberVariablesInClassesCheck.h" #include "../misc/UnconventionalAssignOperatorCheck.h" #include "../modernize/AvoidCArraysCheck.h" +#include "../modernize/UseDefaultMemberInitCheck.h" #include "../modernize/UseOverrideCheck.h" #include "../readability/MagicNumbersCheck.h" #include "AvoidCapturingLambdaCoroutinesCheck.h" @@ -110,6 +111,8 @@ CheckFactories.registerCheck( "cppcoreguidelines-special-member-functions"); CheckFactories.registerCheck("cppcoreguidelines-slicing"); + CheckFactories.registerCheck( + "cppcoreguidelines-use-default-member-init"); CheckFactories.registerCheck( "cppcoreguidelines-c-copy-assignment-signature"); CheckFactories.registerCheck( diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -174,6 +174,11 @@ ` to :doc:`bugprone-unsafe-functions ` was added. +- New alias :doc:`cppcoreguidelines-use-default-member-init + ` to + :doc:`modernize-use-default-member-init + ` was added. + Changes in existing checks ^^^^^^^^^^^^^^^^^^^^^^^^^^ - Improved :doc:`readability-redundant-string-cstr @@ -215,6 +220,11 @@ - Deprecated :doc:`cert-dcl21-cpp ` check. +- Deprecated C.48 enforcement from :doc:`cppcoreguidelines-prefer-member-initializer + `. Please use + :doc:`cppcoreguidelines-use-default-member-init + ` instead. + - Deprecated check-local options `HeaderFileExtensions` in :doc:`google-build-namespaces ` check. diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/prefer-member-initializer.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/prefer-member-initializer.rst --- a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/prefer-member-initializer.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/prefer-member-initializer.rst @@ -23,6 +23,13 @@ initializations already implemented as member initializers. For that purpose see check `modernize-use-default-member-init <../modernize/use-default-member-init.html>`_. +.. note:: + + Enforcement of rule C.48 in this check is deprecated, to be removed in + :program:`clang-tidy` version 19 (only C.49 will be enforced by this check then). + Please use `cppcoreguidelines-use-default-member-init <../cppcoreguidelines/use-default-member-init.html>`_ + to enfoce rule C.48. + Example 1 --------- @@ -85,6 +92,11 @@ .. option:: UseAssignment + Note: this option is deprecated, to be removed in :program:`clang-tidy` + version 19. Please use the `UseAssignment` option from + `cppcoreguidelines-use-default-member-init <../cppcoreguidelines/use-default-member-init.html>`_ + instead. + If this option is set to `true` (by default `UseAssignment` from `modernize-use-default-member-init <../modernize/use-default-member-init.html>`_ will be used), diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/use-default-member-init.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/use-default-member-init.rst new file mode 100644 --- /dev/null +++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/use-default-member-init.rst @@ -0,0 +1,12 @@ +.. title:: clang-tidy - cppcoreguidelines-use-default-member-init +.. meta:: + :http-equiv=refresh: 5;URL=../modernize/use-default-member-init.html + +cppcoreguidelines-use-default-member-init +========================================= + +This check implements `C.48 `_ from the CppCoreGuidelines. + +The cppcoreguidelines-use-default-member-init check is an alias, please see +`modernize-use-default-member-init <../modernize/use-default-member-init.html>`_ +for more information. diff --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst b/clang-tools-extra/docs/clang-tidy/checks/list.rst --- a/clang-tools-extra/docs/clang-tidy/checks/list.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst @@ -477,6 +477,7 @@ `cppcoreguidelines-explicit-virtual-functions `_, `modernize-use-override `_, "Yes" `cppcoreguidelines-macro-to-enum `_, `modernize-macro-to-enum `_, "Yes" `cppcoreguidelines-non-private-member-variables-in-classes `_, `misc-non-private-member-variables-in-classes `_, + `cppcoreguidelines-use-default-member-init `_, `modernize-use-default-member-init `_, `fuchsia-header-anon-namespaces `_, `google-build-namespaces `_, `google-readability-braces-around-statements `_, `readability-braces-around-statements `_, "Yes" `google-readability-function-size `_, `readability-function-size `_,