llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-tools-extra Author: Baranov Victor (vbvictor) <details> <summary>Changes</summary> In new tests we should encourage to use these "source of truth" files if possible. --- Patch is 33.76 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/183963.diff 29 Files Affected: - (renamed) clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/initializer_list (+13-11) - (added) clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/memory (+11) - (modified) clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/string (+2-3) - (added) clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/vector (+91) - (modified) clang-tools-extra/test/clang-tidy/checkers/boost/Inputs/use-ranges/fake_std.h (+3-21) - (modified) clang-tools-extra/test/clang-tidy/checkers/boost/use-ranges-pipe.cpp (+2-2) - (modified) clang-tools-extra/test/clang-tidy/checkers/boost/use-ranges.cpp (+2-2) - (modified) clang-tools-extra/test/clang-tidy/checkers/bugprone/argument-comment.cpp (+2-6) - (modified) clang-tools-extra/test/clang-tidy/checkers/bugprone/dangling-handle.cpp (+5-18) - (modified) clang-tools-extra/test/clang-tidy/checkers/bugprone/unchecked-optional-access.cpp (+2-10) - (modified) clang-tools-extra/test/clang-tidy/checkers/bugprone/unused-return-value.cpp (+2-9) - (modified) clang-tools-extra/test/clang-tidy/checkers/llvm/use-ranges.cpp (+2-14) - (modified) clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-ranges/fake_std.h (+2-21) - (modified) clang-tools-extra/test/clang-tidy/checkers/modernize/make-unique-default-init.cpp (+2-2) - (modified) clang-tools-extra/test/clang-tidy/checkers/modernize/make-unique.cpp (+2-2) - (modified) clang-tools-extra/test/clang-tidy/checkers/modernize/replace-random-shuffle.cpp (+2-8) - (modified) clang-tools-extra/test/clang-tidy/checkers/modernize/return-braced-init-list.cpp (+2-42) - (modified) clang-tools-extra/test/clang-tidy/checkers/modernize/shrink-to-fit.cpp (+2-5) - (modified) clang-tools-extra/test/clang-tidy/checkers/modernize/use-emplace-ignore-implicit-constructors.cpp (+3-26) - (modified) clang-tools-extra/test/clang-tidy/checkers/modernize/use-ranges-pipe.cpp (+2-2) - (modified) clang-tools-extra/test/clang-tidy/checkers/modernize/use-ranges.cpp (+2-2) - (modified) clang-tools-extra/test/clang-tidy/checkers/modernize/use-trailing-return-type-transform-lambdas-cxx14.cpp (+2-4) - (modified) clang-tools-extra/test/clang-tidy/checkers/modernize/use-trailing-return-type-transform-lambdas.cpp (+4-6) - (modified) clang-tools-extra/test/clang-tidy/checkers/performance/inefficient-vector-operation.cpp (+3-43) - (modified) clang-tools-extra/test/clang-tidy/checkers/readability/container-data-pointer.cpp (+1-13) - (modified) clang-tools-extra/test/clang-tidy/checkers/readability/isolate-declaration-cxx17.cpp (+2-10) - (modified) clang-tools-extra/test/clang-tidy/checkers/readability/qualified-auto-cxx20.cpp (+2-14) - (modified) clang-tools-extra/test/clang-tidy/checkers/readability/qualified-auto.cpp (+3-14) - (modified) clang-tools-extra/test/clang-tidy/checkers/readability/redundant-smartptr-get.cpp (+2-18) ``````````diff diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/smart-ptr/initializer_list.h b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/initializer_list similarity index 67% rename from clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/smart-ptr/initializer_list.h rename to clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/initializer_list index 28592cf8f70b1..bccea047d3e63 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/smart-ptr/initializer_list.h +++ b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/initializer_list @@ -1,32 +1,34 @@ +#ifndef _INITIALIZER_LIST_ +#define _INITIALIZER_LIST_ + +// For size_t +#include "string.h" +#include "memory" + namespace std { -typedef decltype(sizeof(int)) size_t; -template <class _E> class initializer_list { +template <class _E> +class initializer_list { const _E *__begin_; size_t __size_; - initializer_list(const _E *__b, size_t __s) : __begin_(__b), __size_(__s) {} + initializer_list(const _E *__b, size_t __s) + : __begin_(__b), __size_(__s) {} public: typedef _E value_type; typedef const _E &reference; typedef const _E &const_reference; typedef size_t size_type; - typedef const _E *iterator; typedef const _E *const_iterator; initializer_list() : __begin_(nullptr), __size_(0) {} - size_t size() const { return __size_; } const _E *begin() const { return __begin_; } const _E *end() const { return __begin_ + __size_; } }; -template <class _E> -class vector { - public: - vector(initializer_list<_E> init); - ~vector(); -}; } // namespace std + +#endif // _INITIALIZER_LIST_ diff --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/memory b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/memory new file mode 100644 index 0000000000000..2ec18dbec18f4 --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/memory @@ -0,0 +1,11 @@ +#ifndef _MEMORY_ +#define _MEMORY_ + +namespace std { + +template <typename T> +class allocator {}; + +} // namespace std + +#endif // _MEMORY_ diff --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/string b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/string index 7de709d07f2df..fc197d0afa714 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/string +++ b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/string @@ -2,14 +2,13 @@ #define _STRING_ // For size_t -#include <string.h> +#include "string.h" +#include "memory" typedef unsigned __INT16_TYPE__ char16; typedef unsigned __INT32_TYPE__ char32; namespace std { -template <typename T> -class allocator {}; template <typename T> class char_traits {}; diff --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/vector b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/vector new file mode 100644 index 0000000000000..32eebb9387172 --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/vector @@ -0,0 +1,91 @@ +#ifndef _VECTOR_ +#define _VECTOR_ + +#include "initializer_list" +#include "memory" + +namespace std { + +template <typename T, typename A = allocator<T>> +class vector { +public: + typedef T value_type; + typedef size_t size_type; + typedef T *iterator; + typedef const T *const_iterator; + typedef T *reverse_iterator; + typedef const T *const_reverse_iterator; + + vector(); + vector(size_type count); + vector(size_type count, const T &value, const A &alloc = A()); + vector(initializer_list<T>, const A &alloc = A()); + vector(const vector &other); + vector(vector &&other); + ~vector(); + + vector &operator=(const vector &other); + vector &operator=(vector &&other); + vector &operator=(initializer_list<T>); + + void push_back(const T &value); + void push_back(T &&value); + + template <typename... Args> + void emplace_back(Args &&...args); + + template <typename... Args> + iterator emplace(const_iterator pos, Args &&...args); + + T &operator[](size_type pos); + const T &operator[](size_type pos) const; + + T &front(); + T &back(); + T *data(); + const T *data() const; + + iterator begin(); + iterator end(); + const_iterator begin() const; + const_iterator end() const; + const_iterator cbegin() const; + const_iterator cend() const; + + reverse_iterator rbegin(); + reverse_iterator rend(); + const_reverse_iterator rbegin() const; + const_reverse_iterator rend() const; + const_reverse_iterator crbegin() const; + const_reverse_iterator crend() const; + + bool empty() const; + size_type size() const; + + void clear(); + void reserve(size_type new_cap); + void resize(size_type count); + void resize(size_type count, const T &value); + + void assign(size_type count, const T &value); + + iterator insert(const_iterator pos, const T &value); + iterator insert(const_iterator pos, T &&value); + iterator insert(const_iterator pos, size_type count, const T &value); + + iterator erase(const_iterator pos); + iterator erase(const_iterator first, const_iterator last); + + void swap(vector &other); + void shrink_to_fit(); +}; + +template <typename T, typename A> +bool operator==(const vector<T, A> &, const vector<T, A> &); + +template <typename T, typename A> +bool operator!=(const vector<T, A> &, const vector<T, A> &); + +} // namespace std + +#endif // _VECTOR_ diff --git a/clang-tools-extra/test/clang-tidy/checkers/boost/Inputs/use-ranges/fake_std.h b/clang-tools-extra/test/clang-tidy/checkers/boost/Inputs/use-ranges/fake_std.h index 7c3e39d6000d2..26842c4dbddcb 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/boost/Inputs/use-ranges/fake_std.h +++ b/clang-tools-extra/test/clang-tidy/checkers/boost/Inputs/use-ranges/fake_std.h @@ -1,27 +1,9 @@ #ifndef USE_RANGES_FAKE_STD_H #define USE_RANGES_FAKE_STD_H -namespace std { -template <typename T> class vector { -public: - using iterator = T *; - using const_iterator = const T *; - using reverse_iterator = T*; - using reverse_const_iterator = const T*; - - constexpr const_iterator begin() const; - constexpr const_iterator end() const; - constexpr const_iterator cbegin() const; - constexpr const_iterator cend() const; - constexpr iterator begin(); - constexpr iterator end(); - constexpr reverse_const_iterator rbegin() const; - constexpr reverse_const_iterator rend() const; - constexpr reverse_const_iterator crbegin() const; - constexpr reverse_const_iterator crend() const; - constexpr reverse_iterator rbegin(); - constexpr reverse_iterator rend(); -}; +#include <vector> + +namespace std { template <typename Container> constexpr auto begin(const Container &Cont) { return Cont.begin(); diff --git a/clang-tools-extra/test/clang-tidy/checkers/boost/use-ranges-pipe.cpp b/clang-tools-extra/test/clang-tidy/checkers/boost/use-ranges-pipe.cpp index c0ce374840098..2b32429a77a60 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/boost/use-ranges-pipe.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/boost/use-ranges-pipe.cpp @@ -1,7 +1,7 @@ // RUN: %check_clang_tidy -std=c++14 %s boost-use-ranges %t -check-suffixes=,PIPE \ // RUN: -config="{CheckOptions: { \ -// RUN: boost-use-ranges.UseReversePipe: true }}" -- -I %S/Inputs/use-ranges/ -// RUN: %check_clang_tidy -std=c++14 %s boost-use-ranges %t -check-suffixes=,NOPIPE -- -I %S/Inputs/use-ranges/ +// RUN: boost-use-ranges.UseReversePipe: true }}" -- -isystem %clang_tidy_headers -I %S/Inputs/use-ranges/ +// RUN: %check_clang_tidy -std=c++14 %s boost-use-ranges %t -check-suffixes=,NOPIPE -- -isystem %clang_tidy_headers -I %S/Inputs/use-ranges/ // CHECK-FIXES: #include <boost/algorithm/cxx11/is_sorted.hpp> // CHECK-FIXES: #include <boost/range/adaptor/reversed.hpp> diff --git a/clang-tools-extra/test/clang-tidy/checkers/boost/use-ranges.cpp b/clang-tools-extra/test/clang-tidy/checkers/boost/use-ranges.cpp index 06e70267da83a..a11915e26269f 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/boost/use-ranges.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/boost/use-ranges.cpp @@ -1,5 +1,5 @@ -// RUN: %check_clang_tidy -std=c++14 %s boost-use-ranges %t -- -- -I %S/Inputs/use-ranges/ -// RUN: %check_clang_tidy -std=c++17 %s boost-use-ranges %t -check-suffixes=,CPP17 -- -I %S/Inputs/use-ranges/ +// RUN: %check_clang_tidy -std=c++14 %s boost-use-ranges %t -- -- -isystem %clang_tidy_headers -I %S/Inputs/use-ranges/ +// RUN: %check_clang_tidy -std=c++17 %s boost-use-ranges %t -check-suffixes=,CPP17 -- -isystem %clang_tidy_headers -I %S/Inputs/use-ranges/ // CHECK-FIXES: #include <boost/range/algorithm/find.hpp> // CHECK-FIXES: #include <boost/range/algorithm/reverse.hpp> diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/argument-comment.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/argument-comment.cpp index 28b19ccdcf450..5576bc5541d60 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/argument-comment.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/argument-comment.cpp @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy %s bugprone-argument-comment %t -- -- -I %S/Inputs/argument-comment +// RUN: %check_clang_tidy %s bugprone-argument-comment %t -- -- -I %S/Inputs/argument-comment -isystem %clang_tidy_headers // FIXME: clang-tidy should provide a -verify mode to make writing these checks // easier and more accurate. @@ -117,12 +117,8 @@ void g() { f6(/*xxy=*/0, 0); } } +#include <vector> namespace std { -template <typename T> -class vector { -public: - void assign(int __n, const T &__val); -}; template<typename T> void swap(T& __a, T& __b); } // namespace std diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/dangling-handle.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/dangling-handle.cpp index 96c812617038a..eb044544d025e 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/dangling-handle.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/dangling-handle.cpp @@ -1,31 +1,18 @@ // RUN: %check_clang_tidy -std=c++11,c++14 -check-suffix=,CXX14 %s bugprone-dangling-handle %t -- \ // RUN: -config="{CheckOptions: \ // RUN: {bugprone-dangling-handle.HandleClasses: \ -// RUN: 'std::basic_string_view; ::llvm::StringRef;'}}" +// RUN: 'std::basic_string_view; ::llvm::StringRef;'}}" \ +// RUN: -- -isystem %clang_tidy_headers // RUN: %check_clang_tidy -std=c++17-or-later -check-suffix=,CXX17 %s bugprone-dangling-handle %t -- \ // RUN: -config="{CheckOptions: \ // RUN: {bugprone-dangling-handle.HandleClasses: \ -// RUN: 'std::basic_string_view; ::llvm::StringRef;'}}" +// RUN: 'std::basic_string_view; ::llvm::StringRef;'}}" \ +// RUN: -- -isystem %clang_tidy_headers +#include <vector> namespace std { -template <typename T> -class vector { - public: - using const_iterator = const T*; - using iterator = T*; - using size_type = int; - - void assign(size_type count, const T& value); - iterator insert(const_iterator pos, const T& value); - iterator insert(const_iterator pos, T&& value); - iterator insert(const_iterator pos, size_type count, const T& value); - void push_back(const T&); - void push_back(T&&); - void resize(size_type count, const T& value); -}; - template <typename, typename> class pair {}; diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/unchecked-optional-access.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/unchecked-optional-access.cpp index 984156c028c00..4831374bda6db 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/unchecked-optional-access.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/unchecked-optional-access.cpp @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy %s bugprone-unchecked-optional-access %t -- -- -I %S/Inputs/unchecked-optional-access +// RUN: %check_clang_tidy %s bugprone-unchecked-optional-access %t -- -- -I %S/Inputs/unchecked-optional-access -isystem %clang_tidy_headers #include "absl/types/optional.h" #include "folly/types/Optional.h" @@ -351,15 +351,7 @@ void std_forward_rvalue_ref_safe(absl::optional<int>&& opt) { std::forward<absl::optional<int>>(opt).value(); } -namespace std { - -template <typename T> class vector { -public: - T &operator[](unsigned long index); - bool empty(); -}; - -} // namespace std +#include <vector> struct S { absl::optional<float> x; diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/unused-return-value.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/unused-return-value.cpp index e784c9b85172c..938f12a582fbe 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/unused-return-value.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/unused-return-value.cpp @@ -1,5 +1,6 @@ // RUN: %check_clang_tidy %s bugprone-unused-return-value %t -- \ -// RUN: --config="{CheckOptions: {bugprone-unused-return-value.AllowCastToVoid: true}}" -- -fexceptions +// RUN: --config="{CheckOptions: {bugprone-unused-return-value.AllowCastToVoid: true}}" -- -fexceptions -isystem %clang_tidy_headers +#include <vector> namespace std { @@ -41,9 +42,6 @@ struct unique_ptr { template <typename T> struct char_traits; -template <typename T> -struct allocator; - template <typename CharT, typename Traits = char_traits<CharT>, typename Allocator = allocator<CharT>> @@ -53,11 +51,6 @@ struct basic_string { typedef basic_string<char> string; -template <typename T, typename Allocator = std::allocator<T>> -struct vector { - bool empty() const noexcept; -}; - class error_code { }; diff --git a/clang-tools-extra/test/clang-tidy/checkers/llvm/use-ranges.cpp b/clang-tools-extra/test/clang-tidy/checkers/llvm/use-ranges.cpp index 415593ae16a53..7be84f59b5a8c 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/llvm/use-ranges.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/llvm/use-ranges.cpp @@ -1,23 +1,11 @@ -// RUN: %check_clang_tidy %s llvm-use-ranges %t +// RUN: %check_clang_tidy %s llvm-use-ranges %t -- -- -isystem %clang_tidy_headers +#include <vector> // Test that the header is included // CHECK-FIXES: #include "llvm/ADT/STLExtras.h" namespace std { -template <typename T> class vector { -public: - using iterator = T *; - using const_iterator = const T *; - - iterator begin(); - iterator end(); - const_iterator begin() const; - const_iterator end() const; - const_iterator cbegin() const; - const_iterator cend() const; -}; - template <typename T> T* begin(T (&arr)[5]); template <typename T> T* end(T (&arr)[5]); diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-ranges/fake_std.h b/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-ranges/fake_std.h index 69ac9954f4afa..f417dd32d8946 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-ranges/fake_std.h +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-ranges/fake_std.h @@ -1,28 +1,9 @@ #ifndef USE_RANGES_FAKE_STD_H #define USE_RANGES_FAKE_STD_H -namespace std { +#include <vector> -template <typename T> class vector { -public: - using iterator = T *; - using const_iterator = const T *; - using reverse_iterator = T *; - using reverse_const_iterator = const T *; - - constexpr const_iterator begin() const; - constexpr const_iterator end() const; - constexpr const_iterator cbegin() const; - constexpr const_iterator cend() const; - constexpr iterator begin(); - constexpr iterator end(); - constexpr reverse_const_iterator rbegin() const; - constexpr reverse_const_iterator rend() const; - constexpr reverse_const_iterator crbegin() const; - constexpr reverse_const_iterator crend() const; - constexpr reverse_iterator rbegin(); - constexpr reverse_iterator rend(); -}; +namespace std { template <typename Container> constexpr auto begin(const Container &Cont) { return Cont.begin(); diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/make-unique-default-init.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/make-unique-default-init.cpp index 7b96d014c4ed3..4556cdf445d29 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/make-unique-default-init.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/make-unique-default-init.cpp @@ -3,10 +3,10 @@ // RUN: {modernize-make-unique.IgnoreDefaultInitialization: \ // RUN: 'false'}} \ // RUN: }" \ -// RUN: -- -I %S/Inputs/smart-ptr +// RUN: -- -I %S/Inputs/smart-ptr -isystem %clang_tidy_headers -#include "initializer_list.h" #include "unique_ptr.h" +#include <vector> // CHECK-FIXES: #include <memory> void basic() { diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/make-unique.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/make-unique.cpp index bcdf4fb4e3756..45d9d15315e95 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/make-unique.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/make-unique.cpp @@ -1,7 +1,7 @@ -// RUN: %check_clang_tidy -std=c++14-or-later %s modernize-make-unique %t -- -- -I %S/Inputs/smart-ptr +// RUN: %check_clang_tidy -std=c++14-or-later %s modernize-make-unique %t -- -- -I %S/Inputs/smart-ptr -isystem %clang_tidy_headers #include "unique_ptr.h" -#include "initializer_list.h" +#include <vector> // CHECK-FIXES: #include <memory> struct Base { diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/replace-random-shuffle.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/replace-random-shuffle.cpp index f96a60b377873..5a9c8560da8ce 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/replace-random-shuffle.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/replace-random-shuffle.cpp @@ -1,4 +1,5 @@ -// RUN: %check_clang_tidy %s modernize-replace-random-shuffle %t +// RUN: %check_clang_tidy %s modernize-replace-random-shuffle %t -- -- -isystem %clang_tidy_headers +#include <vector> //CHECK-FIXES: #include <random> @@ -8,13 +9,6 @@ template <typename T> struct vec_iterator { vec_iterator operator++(int); }; -template <typename T> struct vector { - typedef vec_iterator<T> iterator; - - iterator begin(); - iterator end(); -}; - template <typename FwIt> void random_shuffle(FwIt begin, FwIt end); diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/return-braced-init-list.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/return-braced-init-list.cpp index ae33d25d49152..42c01202055aa 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/return-braced-init-list.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/return-braced-init-list.cpp @@ -1,45 +1,5 @@ -// RUN: %check_clang_tidy -std=c++11-or-later %s modernize-return-braced-init-list %t - -namespace std { -typedef decltype(sizeof(int)) size_t; - -// libc++'s implementation -template <class _E> -class initializer_list { - const _E *__begin_; - size_t __size_; - - initializer_list(const _E *__b, size_t __s) - : __begin_(__b), - __size_(__s) {} - -public: - typedef _E value_type; - typedef const _E &reference; - typedef const _E &const_reference; - typedef size_t size_type; - - typedef const _E *iterator; - typedef const _E *const_iterator; - - initializer_list() : __begin_(nullptr), __size_(0) {} - - size_t size() const { return __size_; } - const _E *begin() const { return __begin_; } - const _E *end() const { return __begin_ + __size_; } -}; - -template <typename T> -struct allocator {}; - -template <typename T, typename Allocator = ::std::allocator<T>> -class vector { -public: - vector(T); - vector(size_t, T, const Allocator &alloc = Allocator()); - vector(std::initializer_list<T>); -}; -} // namespace std +// RUN: %check_clang_tidy -std=c++11-or-later %s modernize-return-braced-init-list %t -- -- -isystem %clang_tidy_headers +#include <vector> class Bar {}; diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/shrink-to-fit.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/shrink-to-fit.cpp index a3754e6822ac8..fc27719bab12b 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/shrink-to-fit.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/shrink-to-fit.cpp @@ -1,8 +1,5 @@ -// RUN: %check... [truncated] `````````` </details> https://github.com/llvm/llvm-project/pull/183963 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
