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

Alexander Kornienko alexfh at google.com
Tue Mar 31 07:30:43 PDT 2015


Looks good!


================
Comment at: clang-tidy/misc/UniqueptrResetReleaseCheck.cpp:43
@@ +42,3 @@
+      Result.Nodes.getNodeAs<ClassTemplateSpecializationDecl>(ID);
+  if (!Class) return nullptr;
+  auto DeleterArgument = Class->getTemplateArgs()[1];
----------------
nit: put `return` on the next line.

================
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");
----------------
nit: I'd use the concrete type here.

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

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

http://reviews.llvm.org/D8422

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






More information about the cfe-commits mailing list