================
@@ -0,0 +1,894 @@
+// RUN: %check_clang_tidy -std=c++17-or-later %s
modernize-use-shared-ptr-array %t \
+// RUN: -- -- -isystem %clang_tidy_headers
+
+// Positive cases:
+// default_delete<T[]>: direct init, brace init, typedef alias, using alias,
+// fully qualified (::std::), namespace alias, using-declaration,
+// unqualified (using namespace)
+// Lambda: captureless, noexcept, explicit return type, parenthesized
delete[]
+// Free function deleter (body visible in TU)
+// CV-qualified elements: const, volatile, const volatile
+// Primitive element types (int)
+// Non-trivial destructor
+// Nested template element type (PairLike<int,int>)
+// Nested shared_ptr exercising >> token splitting
+// Array sizes: runtime, constexpr, zero
+// Array init: value-initialized, brace-initialized, extra parens
+// VarDecl styles: direct init, brace init, copy init (both sides rewritten),
+// static
+// Non-VarDecl contexts: auto (direct-init), auto (copy-init), return
+// statement, return of nested template
+// Formatting: multiline, inline comments, template comments
+//
+// Warn only (no fix-it):
+// Multi-declarator statement
+// Pointer declarator, reference declarator
+// Assignment expression
+// Chained assignment
+//
+// Negative cases (no warning):
+// Already correct shared_ptr<T[]>
+// Single-object new with array deleter (and vice versa)
+// Array new with no deleter
+// Type mismatch: allocated vs shared_ptr element type
+// Type mismatch: deleter pointee vs shared_ptr element type
+// Covariant array (Derived[] into shared_ptr<Base>)
+// Non-trivial destructor with wrong (non-array) deleter
+// Functor deleter
+// Template-dependent context
+// Function pointer variable (not a FunctionDecl ref)
+// Capturing lambda
+// Multi-statement lambda, delete-of-alias lambda,
+// conditional-delete lambda, return-before-delete lambda,
+// no-delete lambda, void-ptr-cast lambda
+// Function deleter: single delete, multi-statement, conditional,
+// deleting global, deleting unrelated pointer
+// reset() (member call, not constructor)
+// Macro touching new-expression or deleter
+
+
+// Minimal std stubs
+
+namespace std {
+
+ template <typename T>
----------------
zeyi2 wrote:
Please fix formatting in this test file.
https://github.com/llvm/llvm-project/pull/199458
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits