clang-tools  9.0.0
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 using namespace clang::ast_matchers;
12 
13 namespace clang {
14 namespace tidy {
15 namespace modernize {
16 
17 MakeSharedCheck::MakeSharedCheck(StringRef Name, ClangTidyContext *Context)
18  : MakeSmartPtrCheck(Name, Context, "std::make_shared") {}
19 
22  return qualType(hasUnqualifiedDesugaredType(
23  recordType(hasDeclaration(classTemplateSpecializationDecl(
24  hasName("::std::shared_ptr"), templateArgumentCountIs(1),
25  hasTemplateArgument(0, templateArgument(refersToType(
26  qualType().bind(PointerType)))))))));
27 }
28 
29 } // namespace modernize
30 } // namespace tidy
31 } // namespace clang
SmartPtrTypeMatcher getSmartPointerTypeMatcher() const override
Returns matcher that match with different smart pointer types.
ast_matchers::internal::BindableMatcher< QualType > SmartPtrTypeMatcher
static constexpr llvm::StringLiteral Name
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Base class for MakeSharedCheck and MakeUniqueCheck.