[clang-tools-extra] [clang-tidy] Fix false positive in modernize-make-unique (PR #229802)

via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 22 13:01:52 PDT 2026


================
@@ -73,6 +73,14 @@ void MakeSmartPtrCheck::registerMatchers(ast_matchers::MatchFinder *Finder) {
   const auto CanCallCtor = unless(has(ignoringImpCasts(
       cxxConstructExpr(hasDeclaration(decl(unless(isPublic())))))));
 
+  // A private/deleted destructor would require somehow making std::make_unique
+  // or some of its internal befriend the created type, so better be
+  // conservative in that case.
+  const auto CanCallDtor = unless(hasType(hasUnqualifiedDesugaredType(
+      pointerType(pointee(hasUnqualifiedDesugaredType(
+          recordType(hasDeclaration(has(cxxDestructorDecl(
----------------
serge-sans-paille wrote:

Done and done!

https://github.com/llvm/llvm-project/pull/229802


More information about the cfe-commits mailing list