1 //===--- SharedPtrArrayMismatchCheck.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 "SharedPtrArrayMismatchCheck.h"
10 
11 using namespace clang::ast_matchers;
12 
13 namespace clang {
14 namespace tidy {
15 namespace bugprone {
16 
SharedPtrArrayMismatchCheck(StringRef Name,ClangTidyContext * Context)17 SharedPtrArrayMismatchCheck::SharedPtrArrayMismatchCheck(
18     StringRef Name, ClangTidyContext *Context)
19     : SmartPtrArrayMismatchCheck(Name, Context, "shared") {}
20 
21 SharedPtrArrayMismatchCheck::SmartPtrClassMatcher
getSmartPointerClassMatcher() const22 SharedPtrArrayMismatchCheck::getSmartPointerClassMatcher() const {
23   return classTemplateSpecializationDecl(
24       hasName("::std::shared_ptr"), templateArgumentCountIs(1),
25       hasTemplateArgument(
26           0, templateArgument(refersToType(qualType().bind(PointerTypeN)))));
27 }
28 
29 } // namespace bugprone
30 } // namespace tidy
31 } // namespace clang
32