[clang-tools-extra] [clang-tidy] Add modernize-make-direct check (PR #118120)
Denis Mikhailov via cfe-commits
cfe-commits at lists.llvm.org
Sun May 18 06:30:58 PDT 2025
================
@@ -0,0 +1,17 @@
+.. title:: clang-tidy - modernize-make-direct
+
+modernize-make-direct
+====================
+
+Replaces ``std::make_*`` function calls with direct constructor calls using class template
+argument deduction (CTAD).
+
+================================== ====================================
+ Before After
+---------------------------------- ------------------------------------
+``std::make_optional<int>(42)`` ``std::optional(42)``
+``std::make_unique<Widget>(1)`` ``std::unique_ptr(new Widget(1))``
+``std::make_shared<Widget>(2)`` ``std::shared_ptr(new Widget(2))``
+``std::make_pair(1, "test")`` ``std::pair(1, "test")``
----------------
denzor200 wrote:
forgot about ``std::make_tuple(1, "test")`` ``std::tuple(1, "test")``
https://github.com/llvm/llvm-project/pull/118120
More information about the cfe-commits
mailing list