clang-tools 19.0.0git
SharedPtrArrayMismatchCheck.h
Go to the documentation of this file.
1//===--- SharedPtrArrayMismatchCheck.h - clang-tidy -------------*- C++ -*-===//
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#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_SHAREDPTRARRAYMISMATCHCHECK_H
10#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_SHAREDPTRARRAYMISMATCHCHECK_H
11
13
14namespace clang::tidy::bugprone {
15
16/// Find `std::shared_ptr<T>(new T[...])`, replace it (if applicable) with
17/// `std::shared_ptr<T[]>(new T[...])`.
18///
19/// Example:
20///
21/// \code
22/// std::shared_ptr<int> PtrArr{new int[10]};
23/// \endcode
25public:
27
28protected:
30};
31
32} // namespace clang::tidy::bugprone
33
34#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_SHAREDPTRARRAYMISMATCHCHECK_H
llvm::SmallString< 256U > Name
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Find std::shared_ptr<T>(new T[...]), replace it (if applicable) with std::shared_ptr<T[]>(new T[....
SmartPtrClassMatcher getSmartPointerClassMatcher() const override
Returns matcher that match with different smart pointer classes.
Find constructions of smart (unique or shared) pointers where the pointer is declared with non-array ...
ast_matchers::internal::BindableMatcher< Decl > SmartPtrClassMatcher