forked from OSchip/llvm-project
[clang-tidy] Don't rely on <array> being available.
The STL isn't necessarily around when running tests. Make our own fake std::array to test this. llvm-svn: 270581
This commit is contained in:
parent
2ffff19134
commit
e78ace55df
|
@ -1,8 +1,5 @@
|
||||||
// RUN: %check_clang_tidy %s modernize-pass-by-value %t -- -- -std=c++11 -fno-delayed-template-parsing
|
// RUN: %check_clang_tidy %s modernize-pass-by-value %t -- -- -std=c++11 -fno-delayed-template-parsing
|
||||||
|
|
||||||
// CHECK-FIXES: #include <utility>
|
|
||||||
#include <array>
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
// POD types are trivially move constructible.
|
// POD types are trivially move constructible.
|
||||||
struct Movable {
|
struct Movable {
|
||||||
|
@ -193,10 +190,12 @@ struct S {
|
||||||
Movable M;
|
Movable M;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename T, int N> struct array { T A[N]; };
|
||||||
|
|
||||||
// Test that types that are trivially copyable will not use std::move. This will
|
// Test that types that are trivially copyable will not use std::move. This will
|
||||||
// cause problems with misc-move-const-arg, as it will revert it.
|
// cause problems with misc-move-const-arg, as it will revert it.
|
||||||
struct T {
|
struct T {
|
||||||
T(std::array<int, 10> a) : a_(a) {}
|
T(array<int, 10> a) : a_(a) {}
|
||||||
// CHECK-FIXES: T(std::array<int, 10> a) : a_(a) {}
|
// CHECK-FIXES: T(array<int, 10> a) : a_(a) {}
|
||||||
std::array<int, 10> a_;
|
array<int, 10> a_;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue