clang-tools 22.0.0git
clang::tidy::bugprone::UniquePtrArrayMismatchCheck Class Reference

Finds initializations of C++ unique pointers to non-array type that are initialized with an array. More...

#include <UniquePtrArrayMismatchCheck.h>

Inheritance diagram for clang::tidy::bugprone::UniquePtrArrayMismatchCheck:
[legend]

Public Member Functions

 UniquePtrArrayMismatchCheck (StringRef Name, ClangTidyContext *Context)
Public Member Functions inherited from clang::tidy::bugprone::SmartPtrArrayMismatchCheck
 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 Member Functions

SmartPtrClassMatcher getSmartPointerClassMatcher () const override
 Returns matcher that match with different smart pointer classes.

Additional Inherited Members

Protected Types inherited from clang::tidy::bugprone::SmartPtrArrayMismatchCheck
using SmartPtrClassMatcher = ast_matchers::internal::BindableMatcher<Decl>
Static Protected Attributes inherited from clang::tidy::bugprone::SmartPtrArrayMismatchCheck
static const char PointerTypeN [] = "pointer_type"

Detailed Description

Finds initializations of C++ unique pointers to non-array type that are initialized with an array.

Example:

std::unique_ptr<int> PtrArr{new int[10]};

Definition at line 24 of file UniquePtrArrayMismatchCheck.h.

Constructor & Destructor Documentation

◆ UniquePtrArrayMismatchCheck()

clang::tidy::bugprone::UniquePtrArrayMismatchCheck::UniquePtrArrayMismatchCheck ( StringRef Name,
ClangTidyContext * Context )

Member Function Documentation

◆ getSmartPointerClassMatcher()

UniquePtrArrayMismatchCheck::SmartPtrClassMatcher clang::tidy::bugprone::UniquePtrArrayMismatchCheck::getSmartPointerClassMatcher ( ) const
overrideprotectedvirtual

Returns matcher that match with different smart pointer classes.

Requires to bind pointer type (qualType) with PointerTypeN string declared in this class.

Implements clang::tidy::bugprone::SmartPtrArrayMismatchCheck.

Definition at line 20 of file UniquePtrArrayMismatchCheck.cpp.

References clang::tidy::bugprone::SmartPtrArrayMismatchCheck::PointerTypeN.


The documentation for this class was generated from the following files: