[TargetVersion] Only enable on RISC-V and AArch64 (#115991)
[llvm-project.git] / clang-tools-extra / clang-tidy / bugprone / SharedPtrArrayMismatchCheck.h
blob3787eb345b8576472cfe3351c05fbca9487ba684
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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_SHAREDPTRARRAYMISMATCHCHECK_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_SHAREDPTRARRAYMISMATCHCHECK_H
12 #include "SmartPtrArrayMismatchCheck.h"
14 namespace clang::tidy::bugprone {
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
24 class SharedPtrArrayMismatchCheck : public SmartPtrArrayMismatchCheck {
25 public:
26 SharedPtrArrayMismatchCheck(StringRef Name, ClangTidyContext *Context);
28 protected:
29 SmartPtrClassMatcher getSmartPointerClassMatcher() const override;
32 } // namespace clang::tidy::bugprone
34 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_SHAREDPTRARRAYMISMATCHCHECK_H