[PATCH] [clang-tidy] Ignore expressions with incompatible deleters.

Samuel Benzaquen sbenza at google.com
Tue Apr 7 15:56:38 PDT 2015


================
Comment at: clang-tidy/misc/UniqueptrResetReleaseCheck.cpp:43
@@ +42,3 @@
+      Result.Nodes.getNodeAs<ClassTemplateSpecializationDecl>(ID);
+  if (!Class) return nullptr;
+  auto DeleterArgument = Class->getTemplateArgs()[1];
----------------
alexfh wrote:
> nit: put `return` on the next line.
Done. And another one 2 lines below. clang-format fixed it for me.

================
Comment at: clang-tidy/misc/UniqueptrResetReleaseCheck.cpp:50
@@ +49,3 @@
+bool areDeletersCompatible(const MatchFinder::MatchResult &Result) {
+  const auto *LeftDeleter = getDeleterForUniquePtr(Result, "left_class");
+  const auto *RightDeleter = getDeleterForUniquePtr(Result, "right_class");
----------------
alexfh wrote:
> nit: I'd use the concrete type here.
Done.

================
Comment at: clang-tidy/misc/UniqueptrResetReleaseCheck.cpp:52
@@ +51,3 @@
+  const auto *RightDeleter = getDeleterForUniquePtr(Result, "right_class");
+  if (!LeftDeleter || !RightDeleter)
+    return false;
----------------
alexfh wrote:
> Can this only happen if unique_ptr is defined in a nonstandard way?
The deleter could be a function pointer.

================
Comment at: clang-tidy/misc/UniqueptrResetReleaseCheck.cpp:90
@@ -43,2 +89,3 @@
 
+
   std::string LeftText = clang::Lexer::getSourceText(
----------------
alexfh wrote:
> nit: Why another empty line?
clang-format to the rescue.

http://reviews.llvm.org/D8422

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list