clang-tools  4.0.0
MakeSharedCheck.cpp
Go to the documentation of this file.
1 //===--- MakeSharedCheck.cpp - clang-tidy----------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "MakeSharedCheck.h"
11 
12 using namespace clang::ast_matchers;
13 
14 namespace clang {
15 namespace tidy {
16 namespace modernize {
17 
18 MakeSharedCheck::MakeSharedCheck(StringRef Name, ClangTidyContext *Context)
19  : MakeSmartPtrCheck(Name, Context, "std::make_shared") {}
20 
23  return qualType(hasDeclaration(classTemplateSpecializationDecl(
24  matchesName("::std::shared_ptr"), templateArgumentCountIs(1),
25  hasTemplateArgument(
26  0, templateArgument(refersToType(qualType().bind(PointerType)))))));
27 }
28 
29 } // namespace modernize
30 } // namespace tidy
31 } // namespace clang
const std::string Name
Definition: USRFinder.cpp:164
SmartPtrTypeMatcher getSmartPointerTypeMatcher() const override
Returns matcher that match with different smart pointer types.
ast_matchers::internal::BindableMatcher< QualType > SmartPtrTypeMatcher
ClangTidyContext & Context
Definition: ClangTidy.cpp:87
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Base class for MakeSharedCheck and MakeUniqueCheck.