steakhal updated this revision to Diff 414065. steakhal added a comment. Herald added a subscriber: carlosgalvezp.
Register the checker with the alias name :D CHANGES SINCE LAST ACTION https://reviews.llvm.org/D121214/new/ https://reviews.llvm.org/D121214 Files: clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp clang-tools-extra/docs/clang-tidy/checks/bugprone-shared-ptr-array-mismatch.rst clang-tools-extra/docs/clang-tidy/checks/cert-mem51-cpp.rst clang-tools-extra/docs/clang-tidy/checks/list.rst Index: clang-tools-extra/docs/clang-tidy/checks/list.rst =================================================================== --- clang-tools-extra/docs/clang-tidy/checks/list.rst +++ clang-tools-extra/docs/clang-tidy/checks/list.rst @@ -350,6 +350,7 @@ `cert-exp42-c <cert-exp42-c.html>`_, `bugprone-suspicious-memory-comparison <bugprone-suspicious-memory-comparison.html>`_, `cert-fio38-c <cert-fio38-c.html>`_, `misc-non-copyable-objects <misc-non-copyable-objects.html>`_, `cert-flp37-c <cert-flp37-c.html>`_, `bugprone-suspicious-memory-comparison <bugprone-suspicious-memory-comparison.html>`_, + `cert-mem51-cpp <cert-mem51-cpp.html>`_, `bugprone-shared-ptr-array-mismatch <bugprone-shared-ptr-array-mismatch.html>`_, "Yes" `cert-msc30-c <cert-msc30-c.html>`_, `cert-msc50-cpp <cert-msc50-cpp.html>`_, `cert-msc32-c <cert-msc32-c.html>`_, `cert-msc51-cpp <cert-msc51-cpp.html>`_, `cert-oop11-cpp <cert-oop11-cpp.html>`_, `performance-move-constructor-init <performance-move-constructor-init.html>`_, Index: clang-tools-extra/docs/clang-tidy/checks/cert-mem51-cpp.rst =================================================================== --- /dev/null +++ clang-tools-extra/docs/clang-tidy/checks/cert-mem51-cpp.rst @@ -0,0 +1,12 @@ +.. title:: clang-tidy - cert-mem51-cpp +.. meta:: + :http-equiv=refresh: 5;URL=bugprone-shared-ptr-array-mismatch.html + +cert-mem51-cpp +============== + +The cert-mem51-cpp check is an alias, please see +`bugprone-shared-ptr-array-mismatch <bugprone-shared-ptr-array-mismatch.html>`_ +for more information. + +Please note that the check only partially covers the corresponding CERT rule. Index: clang-tools-extra/docs/clang-tidy/checks/bugprone-shared-ptr-array-mismatch.rst =================================================================== --- clang-tools-extra/docs/clang-tidy/checks/bugprone-shared-ptr-array-mismatch.rst +++ clang-tools-extra/docs/clang-tidy/checks/bugprone-shared-ptr-array-mismatch.rst @@ -29,3 +29,8 @@ std::shared_ptr<Foo> x(new Foo[10]); // no replacement in this case // ^ warning: shared pointer to non-array is initialized with array [bugprone-shared-ptr-array-mismatch] }; + +This check corresponds to the CERT C++ Coding Standard rule +`MEM51-CPP. Properly deallocate dynamically allocated resources +<https://wiki.sei.cmu.edu/confluence/display/cplusplus/MEM51-CPP.+Properly+deallocate+dynamically+allocated+resources>`_ +rule, but only partially implements it. Index: clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp =================================================================== --- clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp +++ clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp @@ -11,6 +11,7 @@ #include "../ClangTidyModuleRegistry.h" #include "../bugprone/BadSignalToKillThreadCheck.h" #include "../bugprone/ReservedIdentifierCheck.h" +#include "../bugprone/SharedPtrArrayMismatchCheck.h" #include "../bugprone/SignalHandlerCheck.h" #include "../bugprone/SignedCharMisuseCheck.h" #include "../bugprone/SpuriouslyWakeUpFunctionsCheck.h" @@ -300,6 +301,9 @@ "cert-flp37-c"); // FIO CheckFactories.registerCheck<misc::NonCopyableObjectsCheck>("cert-fio38-c"); + // MEM + CheckFactories.registerCheck<bugprone::SharedPtrArrayMismatchCheck>( + "cert-mem51-cpp"); // MSC CheckFactories.registerCheck<LimitedRandomnessCheck>("cert-msc30-c"); CheckFactories.registerCheck<ProperlySeededRandomGeneratorCheck>(
Index: clang-tools-extra/docs/clang-tidy/checks/list.rst =================================================================== --- clang-tools-extra/docs/clang-tidy/checks/list.rst +++ clang-tools-extra/docs/clang-tidy/checks/list.rst @@ -350,6 +350,7 @@ `cert-exp42-c <cert-exp42-c.html>`_, `bugprone-suspicious-memory-comparison <bugprone-suspicious-memory-comparison.html>`_, `cert-fio38-c <cert-fio38-c.html>`_, `misc-non-copyable-objects <misc-non-copyable-objects.html>`_, `cert-flp37-c <cert-flp37-c.html>`_, `bugprone-suspicious-memory-comparison <bugprone-suspicious-memory-comparison.html>`_, + `cert-mem51-cpp <cert-mem51-cpp.html>`_, `bugprone-shared-ptr-array-mismatch <bugprone-shared-ptr-array-mismatch.html>`_, "Yes" `cert-msc30-c <cert-msc30-c.html>`_, `cert-msc50-cpp <cert-msc50-cpp.html>`_, `cert-msc32-c <cert-msc32-c.html>`_, `cert-msc51-cpp <cert-msc51-cpp.html>`_, `cert-oop11-cpp <cert-oop11-cpp.html>`_, `performance-move-constructor-init <performance-move-constructor-init.html>`_, Index: clang-tools-extra/docs/clang-tidy/checks/cert-mem51-cpp.rst =================================================================== --- /dev/null +++ clang-tools-extra/docs/clang-tidy/checks/cert-mem51-cpp.rst @@ -0,0 +1,12 @@ +.. title:: clang-tidy - cert-mem51-cpp +.. meta:: + :http-equiv=refresh: 5;URL=bugprone-shared-ptr-array-mismatch.html + +cert-mem51-cpp +============== + +The cert-mem51-cpp check is an alias, please see +`bugprone-shared-ptr-array-mismatch <bugprone-shared-ptr-array-mismatch.html>`_ +for more information. + +Please note that the check only partially covers the corresponding CERT rule. Index: clang-tools-extra/docs/clang-tidy/checks/bugprone-shared-ptr-array-mismatch.rst =================================================================== --- clang-tools-extra/docs/clang-tidy/checks/bugprone-shared-ptr-array-mismatch.rst +++ clang-tools-extra/docs/clang-tidy/checks/bugprone-shared-ptr-array-mismatch.rst @@ -29,3 +29,8 @@ std::shared_ptr<Foo> x(new Foo[10]); // no replacement in this case // ^ warning: shared pointer to non-array is initialized with array [bugprone-shared-ptr-array-mismatch] }; + +This check corresponds to the CERT C++ Coding Standard rule +`MEM51-CPP. Properly deallocate dynamically allocated resources +<https://wiki.sei.cmu.edu/confluence/display/cplusplus/MEM51-CPP.+Properly+deallocate+dynamically+allocated+resources>`_ +rule, but only partially implements it. Index: clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp =================================================================== --- clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp +++ clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp @@ -11,6 +11,7 @@ #include "../ClangTidyModuleRegistry.h" #include "../bugprone/BadSignalToKillThreadCheck.h" #include "../bugprone/ReservedIdentifierCheck.h" +#include "../bugprone/SharedPtrArrayMismatchCheck.h" #include "../bugprone/SignalHandlerCheck.h" #include "../bugprone/SignedCharMisuseCheck.h" #include "../bugprone/SpuriouslyWakeUpFunctionsCheck.h" @@ -300,6 +301,9 @@ "cert-flp37-c"); // FIO CheckFactories.registerCheck<misc::NonCopyableObjectsCheck>("cert-fio38-c"); + // MEM + CheckFactories.registerCheck<bugprone::SharedPtrArrayMismatchCheck>( + "cert-mem51-cpp"); // MSC CheckFactories.registerCheck<LimitedRandomnessCheck>("cert-msc30-c"); CheckFactories.registerCheck<ProperlySeededRandomGeneratorCheck>(
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits