clang-tools  14.0.0git
MakeSharedCheck.h
Go to the documentation of this file.
1 //===--- MakeSharedCheck.h - clang-tidy--------------------------*- C++ -*-===//
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-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_MAKE_SHARED_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_MAKE_SHARED_H
11 
12 #include "MakeSmartPtrCheck.h"
13 
14 namespace clang {
15 namespace tidy {
16 namespace modernize {
17 
18 /// Replace the pattern:
19 /// \code
20 /// std::shared_ptr<type>(new type(args...))
21 /// \endcode
22 ///
23 /// With the safer version:
24 /// \code
25 /// std::make_shared<type>(args...)
26 /// \endcode
27 ///
28 /// For the user-facing documentation see:
29 /// http://clang.llvm.org/extra/clang-tidy/checks/modernize-make-shared.html
31 public:
32  MakeSharedCheck(StringRef Name, ClangTidyContext *Context);
33 
34 protected:
36 };
37 
38 } // namespace modernize
39 } // namespace tidy
40 } // namespace clang
41 
42 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_MAKE_SHARED_H
MakeSmartPtrCheck.h
clang::tidy::modernize::MakeSharedCheck::getSmartPointerTypeMatcher
SmartPtrTypeMatcher getSmartPointerTypeMatcher() const override
Returns matcher that match with different smart pointer types.
Definition: MakeSharedCheck.cpp:24
clang::tidy::modernize::MakeSharedCheck
Replace the pattern:
Definition: MakeSharedCheck.h:30
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition: ClangTidyDiagnosticConsumer.h:72
Name
static constexpr llvm::StringLiteral Name
Definition: UppercaseLiteralSuffixCheck.cpp:28
clang::tidy::modernize::MakeSmartPtrCheck
Base class for MakeSharedCheck and MakeUniqueCheck.
Definition: MakeSmartPtrCheck.h:24
clang::tidy::modernize::MakeSharedCheck::MakeSharedCheck
MakeSharedCheck(StringRef Name, ClangTidyContext *Context)
Definition: MakeSharedCheck.cpp:20
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27
clang::tidy::modernize::MakeSmartPtrCheck::SmartPtrTypeMatcher
ast_matchers::internal::BindableMatcher< QualType > SmartPtrTypeMatcher
Definition: MakeSmartPtrCheck.h:35