clang-tools
20.0.0git
llvm-project
clang-tools-extra
clang-tidy
modernize
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::tidy::modernize
{
15
16
/// Replace the pattern:
17
/// \code
18
/// std::shared_ptr<type>(new type(args...))
19
/// \endcode
20
///
21
/// With the safer version:
22
/// \code
23
/// std::make_shared<type>(args...)
24
/// \endcode
25
///
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
{
29
public
:
30
MakeSharedCheck
(StringRef
Name
,
ClangTidyContext
*Context);
31
32
protected
:
33
SmartPtrTypeMatcher
getSmartPointerTypeMatcher
()
const override
;
34
};
35
36
}
// namespace clang::tidy::modernize
37
38
#endif
// LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_MAKE_SHARED_H
Name
llvm::SmallString< 256U > Name
Definition:
ChainedComparisonCheck.cpp:42
MakeSmartPtrCheck.h
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition:
ClangTidyDiagnosticConsumer.h:69
clang::tidy::modernize::MakeSharedCheck
Replace the pattern:
Definition:
MakeSharedCheck.h:28
clang::tidy::modernize::MakeSharedCheck::getSmartPointerTypeMatcher
SmartPtrTypeMatcher getSmartPointerTypeMatcher() const override
Returns matcher that match with different smart pointer types.
Definition:
MakeSharedCheck.cpp:22
clang::tidy::modernize::MakeSmartPtrCheck
Base class for MakeSharedCheck and MakeUniqueCheck.
Definition:
MakeSmartPtrCheck.h:22
clang::tidy::modernize::MakeSmartPtrCheck::SmartPtrTypeMatcher
ast_matchers::internal::BindableMatcher< QualType > SmartPtrTypeMatcher
Definition:
MakeSmartPtrCheck.h:33
clang::tidy::modernize
Definition:
AvoidBindCheck.cpp:32
Generated on Fri Dec 6 2024 16:55:10 for clang-tools by
1.9.6