Index: clang-tools-extra/trunk/clang-tidy/hicpp/HICPPTidyModule.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/hicpp/HICPPTidyModule.cpp +++ clang-tools-extra/trunk/clang-tidy/hicpp/HICPPTidyModule.cpp @@ -10,6 +10,19 @@ #include "../ClangTidy.h" #include "../ClangTidyModule.h" #include "../ClangTidyModuleRegistry.h" +#include "../cppcoreguidelines/ProTypeMemberInitCheck.h" +#include "../cppcoreguidelines/SpecialMemberFunctionsCheck.h" +#include "../google/DefaultArgumentsCheck.h" +#include "../google/ExplicitConstructorCheck.h" +#include "../misc/NewDeleteOverloadsCheck.h" +#include "../misc/NoexceptMoveConstructorCheck.h" +#include "../misc/UndelegatedConstructor.h" +#include "../misc/UseAfterMoveCheck.h" +#include "../modernize/UseEqualsDefaultCheck.h" +#include "../modernize/UseEqualsDeleteCheck.h" +#include "../modernize/UseOverrideCheck.h" +#include "../readability/FunctionSizeCheck.h" +#include "../readability/IdentifierNamingCheck.h" #include "NoAssemblerCheck.h" namespace clang { @@ -19,8 +32,32 @@ class HICPPModule : public ClangTidyModule { public: void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { - CheckFactories.registerCheck( - "hicpp-no-assembler"); + CheckFactories.registerCheck( + "hicpp-explicit-conversions"); + CheckFactories.registerCheck( + "hicpp-function-size"); + CheckFactories.registerCheck( + "hicpp-named-parameter"); + CheckFactories.registerCheck( + "hicpp-invalid-access-moved"); + CheckFactories.registerCheck( + "hicpp-member-init"); + CheckFactories.registerCheck( + "hicpp-new-delete-operators"); + CheckFactories.registerCheck( + "hicpp-noexcept-move"); + CheckFactories.registerCheck("hicpp-no-assembler"); + CheckFactories + .registerCheck( + "hicpp-special-member-functions"); + CheckFactories.registerCheck( + "hicpp-undelegated-constructor"); + CheckFactories.registerCheck( + "hicpp-use-equals-default"); + CheckFactories.registerCheck( + "hicpp-use-equals-delete"); + CheckFactories.registerCheck( + "hicpp-use-override"); } }; Index: clang-tools-extra/trunk/docs/ReleaseNotes.rst =================================================================== --- clang-tools-extra/trunk/docs/ReleaseNotes.rst +++ clang-tools-extra/trunk/docs/ReleaseNotes.rst @@ -76,10 +76,10 @@ Finds functions that have more then `ParameterThreshold` parameters and emits a warning. -- New `safety-no-assembler - `_ check +- New `hicpp` module - Finds uses of inline assembler. + Adds checks that implement the `High Integrity C++ Coding Standard `_ and other safety + standards. Many checks are aliased to other modules. - New `modernize-return-braced-init-list `_ check Index: clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-explicit-conversions.rst =================================================================== --- clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-explicit-conversions.rst +++ clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-explicit-conversions.rst @@ -0,0 +1,15 @@ +.. title:: clang-tidy - hicpp-explicit-conversions + +hicpp-explicit-conversions +========================== + +This check is an alias for `google-explicit-constructor `_. +Used to enforce parts of `rule 5.4.1 `_. +This check will enforce that constructors and conversion operators are marked `explicit`. +Other forms of casting checks are implemented in other places. +The following checks can be used to check for more forms of casting: + +- `cppcoreguidelines-pro-type-static-cast-downcast `_ +- `cppcoreguidelines-pro-type-reinterpret-cast `_ +- `cppcoreguidelines-pro-type-const-cast `_ +- `cppcoreguidelines-pro-type-cstyle-cast `_ Index: clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-function-size.rst =================================================================== --- clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-function-size.rst +++ clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-function-size.rst @@ -0,0 +1,11 @@ +.. title:: clang-tidy - hicpp-function-size + +hicpp-function-size +=================== + +This check is an alias for `readability-function-size `_. +Useful to enforce multiple sections on function complexity. + +- `rule 8.2.2 `_ +- `rule 8.3.1 `_ +- `rule 8.3.2 `_ Index: clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-invalid-access-moved.rst =================================================================== --- clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-invalid-access-moved.rst +++ clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-invalid-access-moved.rst @@ -0,0 +1,8 @@ +.. title:: clang-tidy - hicpp-invalid-access-moved + +hicpp-invalid-access-moved +========================== + +This check is an alias for `misc-use-after-move `_. + +Implements parts of the `rule 8.4.1 `_ to check if moved-from objects are accessed. Index: clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-member-init.rst =================================================================== --- clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-member-init.rst +++ clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-member-init.rst @@ -0,0 +1,9 @@ +.. title:: clang-tidy - hicpp-member-init + +hicpp-member-init +================= + +This check is an alias for `cppcoreguidelines-pro-type-member-init `_. +Implements the check for +`rule 12.4.2 `_ +to initialize class members in the right order. Index: clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-named-parameter.rst =================================================================== --- clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-named-parameter.rst +++ clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-named-parameter.rst @@ -0,0 +1,8 @@ +.. title:: clang-tidy - hicpp-named-parameter + +hicpp-named-parameter +===================== + +This check is an alias for `readability-named-parameter `_. + +Implements `rule 8.2.1 `_. Index: clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-new-delete-operators.rst =================================================================== --- clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-new-delete-operators.rst +++ clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-new-delete-operators.rst @@ -0,0 +1,8 @@ +.. title:: clang-tidy - hicpp-new-delete-operators + +hicpp-new-delete-operators +========================== + +This check is an alias for `misc-new-delete-overloads `_. +Implements `rule 12.3.1 `_ to ensure +the `new` and `delete` operators have the correct signature. Index: clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-noexcept-move.rst =================================================================== --- clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-noexcept-move.rst +++ clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-noexcept-move.rst @@ -0,0 +1,7 @@ +.. title:: clang-tidy - hicpp-noexcept-move + +hicpp-noexcept-move +=================== + +This check is an alias for `misc-noexcept-moveconstructor `_. +Checks `rule 12.5.4 `_. +Checks that special member functions have the correct signature, according to `rule 12.5.7 `_. Index: clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-undelegated-constructor.rst =================================================================== --- clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-undelegated-constructor.rst +++ clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-undelegated-constructor.rst @@ -0,0 +1,23 @@ +.. title:: clang-tidy - hicpp-undelegated-construtor + +hicpp-undelegated-constructor +============================= + +This check is an alias for `misc-undelegated-constructor `_. +Partially implements `rule 12.4.5 `_ +to find misplaced constructor calls inside a constructor. + +.. code-block:: c++ + + struct Ctor { + Ctor(); + Ctor(int); + Ctor(int, int); + Ctor(Ctor *i) { + // All Ctor() calls result in a temporary object + Ctor(); // did you intend to call a delegated constructor? + Ctor(0); // did you intend to call a delegated constructor? + Ctor(1, 2); // did you intend to call a delegated constructor? + foo(); + } + }; Index: clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-use-equals-default.rst =================================================================== --- clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-use-equals-default.rst +++ clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-use-equals-default.rst @@ -0,0 +1,7 @@ +.. title:: clang-tidy - hicpp-use-equals-defaults + +hicpp-use-equals-default +======================== + +This check is an alias for `modernize-use-equals-default `_. +Implements `rule 12.5.1 `_ to explicitly default special member functions. Index: clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-use-equals-delete.rst =================================================================== --- clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-use-equals-delete.rst +++ clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-use-equals-delete.rst @@ -0,0 +1,8 @@ +.. title:: clang-tidy - hicpp-use-equals-delete + +hicpp-use-equals-delete +======================= + +This check is an alias for `modernize-use-equals-delete `_. +Implements `rule 12.5.1 `_ +to explicitly default or delete special member functions. Index: clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-use-override.rst =================================================================== --- clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-use-override.rst +++ clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-use-override.rst @@ -0,0 +1,8 @@ +.. title:: clang-tidy - hicpp-use-override + +hicpp-use-override +================== + +This check is an alias for `modernize-use-override `_. +Implements `rule 10.2.1 `_ to +declare a virtual function `override` when overriding.