[clang-tools-extra] [cland-tidy] Fixed documentation for modernize-make-unique check (PR #158421)

via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 13 04:09:57 PDT 2025


https://github.com/0hDEADBEAF created https://github.com/llvm/llvm-project/pull/158421

I was surprised to see a different value for the `MakeSmartPtrFunctionHeader` option of the `modernize-make-unique` and `modernize-make-shared` clang-tidy checks. See, respectively: [modernize-make-unique](https://github.com/llvm/llvm-project/blob/86397f55d5b3ac2ebefc91bbf1a7a6a23b44a3e2/clang-tools-extra/docs/clang-tidy/checks/modernize/make-unique.rst?plain=1#L40) and [modernize-make-shared](https://github.com/llvm/llvm-project/blob/86397f55d5b3ac2ebefc91bbf1a7a6a23b44a3e2/clang-tools-extra/docs/clang-tidy/checks/modernize/make-shared.rst?plain=1#L40).

>From what I've read in the codebase, I believe both checks use the same default value for the `MakeSmartPtrFunctionHeader`: `<memory>` (from [here](https://github.com/llvm/llvm-project/blob/86397f55d5b3ac2ebefc91bbf1a7a6a23b44a3e2/clang-tools-extra/docs/clang-tidy/checks/modernize/make-shared.rst?plain=1#L40)).

>From 91b53f7a66fb449b4caf6d830a29368f06dcba96 Mon Sep 17 00:00:00 2001
From: 0hDEADBEAF <0xdeadbeaf at tutamail.com>
Date: Sat, 13 Sep 2025 12:54:22 +0200
Subject: [PATCH] Fixed documentation for modernize-make-shared clang-tidy
 check

---
 clang-tools-extra/docs/ReleaseNotes.rst                       | 4 ++++
 .../docs/clang-tidy/checks/modernize/make-shared.rst          | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst
index 23d757b5e6f2e..3143bd3dbc435 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -248,6 +248,10 @@ Changes in existing checks
   <clang-tidy/checks/modernize/avoid-c-arrays>` to not diagnose array types
   which are part of an implicit instantiation of a template.
 
+- Improved :doc:`modernize-make-shared
+  <clang-tidy/checks/modernize/make-shared>` check by fixing documentation
+  for the default value for the ``MakeSmartPtrFunctionHeader`` option.
+
 - Improved :doc:`modernize-use-constraints
   <clang-tidy/checks/modernize/use-constraints>` check by fixing a crash on
   uses of non-standard ``enable_if`` with a signature different from
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/make-shared.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/make-shared.rst
index 982138fc5e781..cd953e7ee394d 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/make-shared.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/make-shared.rst
@@ -37,7 +37,7 @@ Options
 .. option:: MakeSmartPtrFunctionHeader
 
    A string specifying the corresponding header of make-shared-ptr function.
-   Default is `memory`.
+   Default is `<memory>`.
 
 .. option:: IncludeStyle
 



More information about the cfe-commits mailing list