1 //===--- MakeSharedCheck.h - clang-tidy--------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_MAKE_SHARED_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_MAKE_SHARED_H
12 #include "MakeSmartPtrCheck.h"
14 namespace clang::tidy::modernize
{
16 /// Replace the pattern:
18 /// std::shared_ptr<type>(new type(args...))
21 /// With the safer version:
23 /// std::make_shared<type>(args...)
26 /// For the user-facing documentation see:
27 /// http://clang.llvm.org/extra/clang-tidy/checks/modernize/make-shared.html
28 class MakeSharedCheck
: public MakeSmartPtrCheck
{
30 MakeSharedCheck(StringRef Name
, ClangTidyContext
*Context
);
33 SmartPtrTypeMatcher
getSmartPointerTypeMatcher() const override
;
36 } // namespace clang::tidy::modernize
38 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_MAKE_SHARED_H