clang-tools
11.0.0
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
{
17
namespace
tidy {
18
namespace
modernize {
19
20
MakeSharedCheck::MakeSharedCheck(StringRef
Name
,
ClangTidyContext
*Context)
21
:
MakeSmartPtrCheck
(
Name
, Context,
"std::make_shared"
) {}
22
23
MakeSharedCheck::SmartPtrTypeMatcher
24
MakeSharedCheck::getSmartPointerTypeMatcher
()
const
{
25
return
qualType(hasUnqualifiedDesugaredType(
26
recordType(hasDeclaration(classTemplateSpecializationDecl(
27
hasName(
"::std::shared_ptr"
), templateArgumentCountIs(1),
28
hasTemplateArgument(0, templateArgument(refersToType(
29
qualType().bind(
PointerType
)))))))));
30
}
31
32
}
// namespace modernize
33
}
// namespace tidy
34
}
// namespace clang
clang::tidy::modernize::MakeSharedCheck::getSmartPointerTypeMatcher
SmartPtrTypeMatcher getSmartPointerTypeMatcher() const override
Returns matcher that match with different smart pointer types.
Definition:
MakeSharedCheck.cpp:24
clang::ast_matchers
Definition:
AbseilMatcher.h:14
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition:
ClangTidyDiagnosticConsumer.h:76
Name
static constexpr llvm::StringLiteral Name
Definition:
UppercaseLiteralSuffixCheck.cpp:27
MakeSharedCheck.h
clang::tidy::modernize::MakeSmartPtrCheck
Base class for MakeSharedCheck and MakeUniqueCheck.
Definition:
MakeSmartPtrCheck.h:24
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
clang::tidy::modernize::MakeSmartPtrCheck::PointerType
static const char PointerType[]
Definition:
MakeSmartPtrCheck.h:46
Generated on Tue Jul 28 2020 16:14:02 for clang-tools by
1.8.16