[PATCH] D60507: [clang-tidy] new check: bugprone-unhandled-self-assignment
Jonas Toth via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 10 06:10:36 PDT 2019
JonasToth added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp:102
"bugprone-too-small-loop-variable");
+ CheckFactories.registerCheck<UnhandledSelfAssignmentCheck>(
+ "bugprone-unhandled-self-assignment");
----------------
please order this list alphabetically.
================
Comment at: clang-tools-extra/clang-tidy/bugprone/UnhandledSelfAssignmentCheck.cpp:51
+ // Matcher for standard smart pointers.
+ const auto SmartPointerType = qualType(hasUnqualifiedDesugaredType(
+ recordType(hasDeclaration(classTemplateSpecializationDecl(
----------------
what about `auto_ptr`? I am actually not sure if we should care, as its deprecated and removed already, on the other hand legacy code probably still has it.
================
Comment at: clang-tools-extra/docs/clang-tidy/checks/bugprone-unhandled-self-assignment.rst:10
+
+This check corresponds to the CERT C++ Coding Standard rule
+`OOP54-CPP. Gracefully handle self-copy assignment
----------------
It is worth an alias into the cert module. Please add this with this revision already.
================
Comment at: clang-tools-extra/test/clang-tidy/bugprone-unhandled-self-assignment.cpp:351
+ int *p;
+};
----------------
Please add tests with templated classes and self-assignment.
Repository:
rCTE Clang Tools Extra
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60507/new/
https://reviews.llvm.org/D60507
More information about the cfe-commits
mailing list