clang-tools
20.0.0git
llvm-project
clang-tools-extra
clang-tidy
modernize
MakeSharedCheck.cpp
Go to the documentation of this file.
1
//===--- MakeSharedCheck.cpp - clang-tidy----------------------------------===//
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
#include "
MakeSharedCheck.h
"
10
11
// FixItHint - Hint to check documentation script to mark this check as
12
// providing a FixIt.
13
14
using namespace
clang::ast_matchers
;
15
16
namespace
clang::tidy::modernize
{
17
18
MakeSharedCheck::MakeSharedCheck
(StringRef
Name
,
ClangTidyContext
*Context)
19
:
MakeSmartPtrCheck
(
Name
, Context,
"std::make_shared"
) {}
20
21
MakeSharedCheck::SmartPtrTypeMatcher
22
MakeSharedCheck::getSmartPointerTypeMatcher
()
const
{
23
return
qualType(hasUnqualifiedDesugaredType(
24
recordType(hasDeclaration(classTemplateSpecializationDecl(
25
hasName(
"::std::shared_ptr"
), templateArgumentCountIs(1),
26
hasTemplateArgument(0, templateArgument(refersToType(
27
qualType().bind(
PointerType
)))))))));
28
}
29
30
}
// namespace clang::tidy::modernize
Name
llvm::SmallString< 256U > Name
Definition:
ChainedComparisonCheck.cpp:42
MakeSharedCheck.h
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition:
ClangTidyDiagnosticConsumer.h:69
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::MakeSharedCheck::MakeSharedCheck
MakeSharedCheck(StringRef Name, ClangTidyContext *Context)
Definition:
MakeSharedCheck.cpp:18
clang::tidy::modernize::MakeSmartPtrCheck
Base class for MakeSharedCheck and MakeUniqueCheck.
Definition:
MakeSmartPtrCheck.h:22
clang::tidy::modernize::MakeSmartPtrCheck::PointerType
static const char PointerType[]
Definition:
MakeSmartPtrCheck.h:44
clang::tidy::modernize::MakeSmartPtrCheck::SmartPtrTypeMatcher
ast_matchers::internal::BindableMatcher< QualType > SmartPtrTypeMatcher
Definition:
MakeSmartPtrCheck.h:33
clang::ast_matchers
Definition:
AbseilMatcher.h:13
clang::tidy::modernize
Definition:
AvoidBindCheck.cpp:32
Generated on Thu Nov 21 2024 14:01:04 for clang-tools by
1.9.6