[llvm-branch-commits] [clang-tools-extra] [clang-tidy][docs] Rewrite modernize check docs to Markdown [1/4] (PR #232207)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Oct 15 08:06:53 PDT 2026
================
@@ -1,56 +1,63 @@
-.. title:: clang-tidy - modernize-make-shared
+```{title} clang-tidy - modernize-make-shared
+```
-modernize-make-shared
-=====================
+# modernize-make-shared
-This check finds the creation of ``std::shared_ptr`` objects by explicitly
-calling the constructor and a ``new`` expression, and replaces it with a call
-to ``std::make_shared``.
+This check finds the creation of `std::shared_ptr` objects by explicitly
+calling the constructor and a `new` expression, and replaces it with a call
+to `std::make_shared`.
-.. code-block:: c++
+```c++
+auto my_ptr = std::shared_ptr<MyPair>(new MyPair(1, 2));
- auto my_ptr = std::shared_ptr<MyPair>(new MyPair(1, 2));
+// becomes
- // becomes
+auto my_ptr = std::make_shared<MyPair>(1, 2);
+```
- auto my_ptr = std::make_shared<MyPair>(1, 2);
+This check also finds calls to `std::shared_ptr::reset()` with a `new`
+expression, and replaces it with a call to `std::make_shared`.
-This check also finds calls to ``std::shared_ptr::reset()`` with a ``new``
-expression, and replaces it with a call to ``std::make_shared``.
+```c++
+my_ptr.reset(new MyPair(1, 2));
-.. code-block:: c++
+// becomes
- my_ptr.reset(new MyPair(1, 2));
+my_ptr = std::make_shared<MyPair>(1, 2);
+```
- // becomes
+## Options
- my_ptr = std::make_shared<MyPair>(1, 2);
+(modernize-make-shared-make-smart-ptr-function)=
----------------
EugeneZelenko wrote:
Is it needed?
https://github.com/llvm/llvm-project/pull/232207
More information about the llvm-branch-commits
mailing list