Index: clang-tidy/modernize/MakeSmartPtrCheck.h =================================================================== --- clang-tidy/modernize/MakeSmartPtrCheck.h +++ clang-tidy/modernize/MakeSmartPtrCheck.h @@ -24,9 +24,10 @@ class MakeSmartPtrCheck : public ClangTidyCheck { public: MakeSmartPtrCheck(StringRef Name, ClangTidyContext *Context, - std::string makeSmartPtrFunctionName); + StringRef makeSmartPtrFunctionName); void registerMatchers(ast_matchers::MatchFinder *Finder) final; void check(const ast_matchers::MatchFinder::MatchResult &Result) final; + void storeOptions(ClangTidyOptions::OptionMap &Opts) override; protected: using SmartPtrTypeMatcher = ast_matchers::internal::BindableMatcher; Index: clang-tidy/modernize/MakeSmartPtrCheck.cpp =================================================================== --- clang-tidy/modernize/MakeSmartPtrCheck.cpp +++ clang-tidy/modernize/MakeSmartPtrCheck.cpp @@ -21,10 +21,17 @@ const char MakeSmartPtrCheck::ResetCall[] = "resetCall"; const char MakeSmartPtrCheck::NewExpression[] = "newExpression"; -MakeSmartPtrCheck::MakeSmartPtrCheck(StringRef Name, ClangTidyContext *Context, - std::string makeSmartPtrFunctionName) +MakeSmartPtrCheck::MakeSmartPtrCheck(StringRef Name, + ClangTidyContext* Context, + StringRef makeSmartPtrFunctionName) : ClangTidyCheck(Name, Context), - makeSmartPtrFunctionName(std::move(makeSmartPtrFunctionName)) {} + makeSmartPtrFunctionName( + Options.get("MakeSmartPtrFunction", makeSmartPtrFunctionName)) {} + +void MakeSmartPtrCheck::storeOptions( + ClangTidyOptions::OptionMap &Opts) { + Options.store(Opts, "MakeSmartPtrFunction", makeSmartPtrFunctionName); +} void MakeSmartPtrCheck::registerMatchers(ast_matchers::MatchFinder *Finder) { if (!getLangOpts().CPlusPlus11) Index: docs/clang-tidy/checks/modernize-make-shared.rst =================================================================== --- docs/clang-tidy/checks/modernize-make-shared.rst +++ docs/clang-tidy/checks/modernize-make-shared.rst @@ -25,3 +25,11 @@ // becomes my_ptr = std::make_shared(1, 2); + +Options +------- + +.. option:: MakeSmartPtrFunction + + A string specifying the name of make-shared-ptr function. Default is + `std::make_shared`. Index: docs/clang-tidy/checks/modernize-make-unique.rst =================================================================== --- docs/clang-tidy/checks/modernize-make-unique.rst +++ docs/clang-tidy/checks/modernize-make-unique.rst @@ -25,3 +25,11 @@ // becomes my_ptr = std::make_unique(1, 2); + +Options +------- + +.. option:: MakeSmartPtrFunction + + A string specifying the name of make-unique-ptr function. Default is + `std::make_unique`.