clang-tools 22.0.0git
|
Find constructions of smart (unique or shared) pointers where the pointer is declared with non-array target type and an array (created with a new-expression) is passed to it. More...
#include <SmartPtrArrayMismatchCheck.h>
Public Member Functions | |
SmartPtrArrayMismatchCheck (StringRef Name, ClangTidyContext *Context, StringRef SmartPointerName) | |
bool | isLanguageVersionSupported (const LangOptions &LangOpts) const override |
void | registerMatchers (ast_matchers::MatchFinder *Finder) override |
void | check (const ast_matchers::MatchFinder::MatchResult &Result) override |
void | storeOptions (ClangTidyOptions::OptionMap &Opts) override |
Protected Types | |
using | SmartPtrClassMatcher = ast_matchers::internal::BindableMatcher<Decl> |
Protected Member Functions | |
virtual SmartPtrClassMatcher | getSmartPointerClassMatcher () const =0 |
Returns matcher that match with different smart pointer classes. |
Static Protected Attributes | |
static const char | PointerTypeN [] = "pointer_type" |
Find constructions of smart (unique or shared) pointers where the pointer is declared with non-array target type and an array (created with a new-expression) is passed to it.
Definition at line 19 of file SmartPtrArrayMismatchCheck.h.
|
protected |
Definition at line 32 of file SmartPtrArrayMismatchCheck.h.
clang::tidy::bugprone::SmartPtrArrayMismatchCheck::SmartPtrArrayMismatchCheck | ( | StringRef | Name, |
ClangTidyContext * | Context, | ||
StringRef | SmartPointerName ) |
Definition at line 50 of file SmartPtrArrayMismatchCheck.cpp.
Referenced by clang::tidy::bugprone::SharedPtrArrayMismatchCheck::SharedPtrArrayMismatchCheck(), and clang::tidy::bugprone::UniquePtrArrayMismatchCheck::UniquePtrArrayMismatchCheck().
|
override |
Definition at line 77 of file SmartPtrArrayMismatchCheck.cpp.
References clang::tidy::utils::rangeCanBeFixed().
|
protectedpure virtual |
Returns matcher that match with different smart pointer classes.
Requires to bind pointer type (qualType) with PointerTypeN string declared in this class.
Implemented in clang::tidy::bugprone::SharedPtrArrayMismatchCheck, and clang::tidy::bugprone::UniquePtrArrayMismatchCheck.
Referenced by registerMatchers().
|
inlineoverride |
Definition at line 24 of file SmartPtrArrayMismatchCheck.h.
|
override |
Definition at line 57 of file SmartPtrArrayMismatchCheck.cpp.
References getSmartPointerClassMatcher(), and PointerTypeN.
|
override |
Definition at line 54 of file SmartPtrArrayMismatchCheck.cpp.
|
staticprotected |
Definition at line 40 of file SmartPtrArrayMismatchCheck.h.
Referenced by clang::tidy::bugprone::SharedPtrArrayMismatchCheck::getSmartPointerClassMatcher(), clang::tidy::bugprone::UniquePtrArrayMismatchCheck::getSmartPointerClassMatcher(), and registerMatchers().