39 lines · c
1//===----------------------------------------------------------------------===//2//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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_MAKESHAREDCHECK_H10#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_MAKESHAREDCHECK_H11 12#include "MakeSmartPtrCheck.h"13 14namespace clang::tidy::modernize {15 16/// Replace the pattern:17/// \code18/// std::shared_ptr<type>(new type(args...))19/// \endcode20///21/// With the safer version:22/// \code23/// std::make_shared<type>(args...)24/// \endcode25///26/// For the user-facing documentation see:27/// https://clang.llvm.org/extra/clang-tidy/checks/modernize/make-shared.html28class MakeSharedCheck : public MakeSmartPtrCheck {29public:30 MakeSharedCheck(StringRef Name, ClangTidyContext *Context);31 32protected:33 SmartPtrTypeMatcher getSmartPointerTypeMatcher() const override;34};35 36} // namespace clang::tidy::modernize37 38#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_MAKESHAREDCHECK_H39