11// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
2- // RUN: %clang_cc1 -fsyntax-only -verify %s -triple x86_64-windows-msvc -std=c++11
3-
42
53void __attribute__ ((trivial_abi)) foo(); // expected-warning {{'trivial_abi' attribute only applies to classes}}
64
@@ -12,38 +10,30 @@ class __attribute__((trivial_abi)) a { a(a &&); };
1210// (And it is only trivially relocatable, currently, if it is trivial for calls.)
1311// In this case, it is suppressed by an explicitly defined move constructor.
1412// Similar concerns apply to later tests that have #if defined(_WIN64) && !defined(__MINGW32__)
15- static_assert (!__is_trivially_relocatable(a<int >), " " ); // expected-warning{{deprecated}}
16- static_assert (!__builtin_is_cpp_trivially_relocatable(a<int >), " " );
13+ static_assert (!__is_trivially_relocatable(a<int >), " " );
1714#else
18- static_assert (__is_trivially_relocatable(a<int >), " " ); // expected-warning{{deprecated}}
19- static_assert (!__builtin_is_cpp_trivially_relocatable(a<int >), " " );
15+ static_assert (__is_trivially_relocatable(a<int >), " " );
2016#endif
2117
2218struct [[clang::trivial_abi]] S0 {
2319 int a;
2420};
25- static_assert (__is_trivially_relocatable(S0), " " ); // expected-warning{{deprecated}}
26- static_assert (__builtin_is_cpp_trivially_relocatable(S0), " " );
21+ static_assert (__is_trivially_relocatable(S0), " " );
2722
2823struct __attribute__ ((trivial_abi)) S1 {
2924 int a;
3025};
31- static_assert (__is_trivially_relocatable(S1), " " ); // expected-warning{{deprecated}}
32- static_assert (__builtin_is_cpp_trivially_relocatable(S1), " " );
33-
26+ static_assert (__is_trivially_relocatable(S1), " " );
3427
3528struct __attribute__ ((trivial_abi)) S3 { // expected-warning {{'trivial_abi' cannot be applied to 'S3'}} expected-note {{is polymorphic}}
3629 virtual void m ();
3730};
38- static_assert (!__is_trivially_relocatable(S3), " " ); // expected-warning{{deprecated}}
39- static_assert (__builtin_is_cpp_trivially_relocatable(S3), " " );
40-
31+ static_assert (!__is_trivially_relocatable(S3), " " );
4132
4233struct S3_2 {
4334 virtual void m ();
4435} __attribute__((trivial_abi)); // expected-warning {{'trivial_abi' cannot be applied to 'S3_2'}} expected-note {{is polymorphic}}
45- static_assert (!__is_trivially_relocatable(S3_2), " " ); // expected-warning{{deprecated}}
46- static_assert (__builtin_is_cpp_trivially_relocatable(S3_2), " " );
36+ static_assert (!__is_trivially_relocatable(S3_2), " " );
4737
4838struct __attribute__ ((trivial_abi)) S3_3 { // expected-warning {{'trivial_abi' cannot be applied to 'S3_3'}} expected-note {{has a field of a non-trivial class type}}
4939 S3_3 (S3_3 &&);
@@ -53,13 +43,9 @@ struct __attribute__((trivial_abi)) S3_3 { // expected-warning {{'trivial_abi' c
5343// The ClangABI4OrPS4 calling convention kind passes classes in registers if the
5444// copy constructor is trivial for calls *or deleted*, while other platforms do
5545// not accept deleted constructors.
56- static_assert (__is_trivially_relocatable(S3_3), " " ); // expected-warning{{deprecated}}
57- static_assert (__builtin_is_cpp_trivially_relocatable(S3_3), " " );
58-
46+ static_assert (__is_trivially_relocatable(S3_3), " " );
5947#else
60- static_assert (!__is_trivially_relocatable(S3_3), " " ); // expected-warning{{deprecated}}
61- static_assert (!__builtin_is_cpp_trivially_relocatable(S3_3), " " );
62-
48+ static_assert (!__is_trivially_relocatable(S3_3), " " );
6349#endif
6450
6551// Diagnose invalid trivial_abi even when the type is templated because it has a non-trivial field.
@@ -68,28 +54,20 @@ struct __attribute__((trivial_abi)) S3_4 { // expected-warning {{'trivial_abi' c
6854 S3_4 (S3_4 &&);
6955 S3_2 s32;
7056};
71- static_assert (!__is_trivially_relocatable(S3_4<int >), " " ); // expected-warning{{deprecated}}
72- static_assert (!__builtin_is_cpp_trivially_relocatable(S3_4<int >), " " );
73-
57+ static_assert (!__is_trivially_relocatable(S3_4<int >), " " );
7458
7559struct S4 {
7660 int a;
7761};
78- static_assert (__is_trivially_relocatable(S4), " " ); // expected-warning{{deprecated}}
79- static_assert (__builtin_is_cpp_trivially_relocatable(S4), " " );
80-
62+ static_assert (__is_trivially_relocatable(S4), " " );
8163
8264struct __attribute__ ((trivial_abi)) S5 : public virtual S4 { // expected-warning {{'trivial_abi' cannot be applied to 'S5'}} expected-note {{has a virtual base}}
8365};
84- static_assert (!__is_trivially_relocatable(S5), " " ); // expected-warning{{deprecated}}
85- static_assert (!__builtin_is_cpp_trivially_relocatable(S5), " " );
86-
66+ static_assert (!__is_trivially_relocatable(S5), " " );
8767
8868struct __attribute__ ((trivial_abi)) S9 : public S4 {
8969};
90- static_assert (__is_trivially_relocatable(S9), " " ); // expected-warning{{deprecated}}
91- static_assert (__builtin_is_cpp_trivially_relocatable(S9), " " );
92-
70+ static_assert (__is_trivially_relocatable(S9), " " );
9371
9472struct __attribute__ ((trivial_abi(1 ))) S8 { // expected-error {{'trivial_abi' attribute takes no arguments}}
9573 int a;
@@ -102,12 +80,8 @@ struct __attribute__((trivial_abi)) S10 {
10280};
10381
10482S10<int *> p1;
105- static_assert (__is_trivially_relocatable(S10<int >), " " ); // expected-warning{{deprecated}}
106- static_assert (__builtin_is_cpp_trivially_relocatable(S10<int >), " " );
107-
108- static_assert (__is_trivially_relocatable(S10<S3>), " " ); // expected-warning{{deprecated}}
109- static_assert (__builtin_is_cpp_trivially_relocatable(S10<S3>), " " );
110-
83+ static_assert (__is_trivially_relocatable(S10<int >), " " );
84+ static_assert (__is_trivially_relocatable(S10<S3>), " " );
11185
11286template <class T >
11387struct S14 {
@@ -119,21 +93,15 @@ struct __attribute__((trivial_abi)) S15 : S14<T> {
11993};
12094
12195S15<int > s15;
122- static_assert (__is_trivially_relocatable(S15<int >), " " ); // expected-warning{{deprecated}}
123- static_assert (__builtin_is_cpp_trivially_relocatable(S15<int >), " " );
124-
125- static_assert (__is_trivially_relocatable(S15<S3>), " " ); // expected-warning{{deprecated}}
126- static_assert (__builtin_is_cpp_trivially_relocatable(S15<S3>), " " );
96+ static_assert (__is_trivially_relocatable(S15<int >), " " );
97+ static_assert (__is_trivially_relocatable(S15<S3>), " " );
12798
12899template <class T >
129100struct __attribute__ ((trivial_abi)) S16 {
130101 S14<T> a;
131102};
132- static_assert (__is_trivially_relocatable(S16<int >), " " ); // expected-warning{{deprecated}}
133- static_assert (__builtin_is_cpp_trivially_relocatable(S16<int >), " " );
134-
135- static_assert (__is_trivially_relocatable(S16<S3>), " " ); // expected-warning{{deprecated}}
136- static_assert (__builtin_is_cpp_trivially_relocatable(S16<S3>), " " );
103+ static_assert (__is_trivially_relocatable(S16<int >), " " );
104+ static_assert (__is_trivially_relocatable(S16<S3>), " " );
137105
138106S16<int > s16;
139107
@@ -142,80 +110,62 @@ struct __attribute__((trivial_abi)) S17 {
142110};
143111
144112S17<int > s17;
145- static_assert (__is_trivially_relocatable(S17<int >), " " ); // expected-warning{{deprecated}}
146- static_assert (__builtin_is_cpp_trivially_relocatable(S17<int >), " " );
147-
148- static_assert (__is_trivially_relocatable(S17<S3>), " " ); // expected-warning{{deprecated}}
149- static_assert (__builtin_is_cpp_trivially_relocatable(S17<S3>), " " );
150-
113+ static_assert (__is_trivially_relocatable(S17<int >), " " );
114+ static_assert (__is_trivially_relocatable(S17<S3>), " " );
151115
152116namespace deletedCopyMoveConstructor {
153117struct __attribute__ ((trivial_abi)) CopyMoveDeleted { // expected-warning {{'trivial_abi' cannot be applied to 'CopyMoveDeleted'}} expected-note {{copy constructors and move constructors are all deleted}}
154118 CopyMoveDeleted (const CopyMoveDeleted &) = delete ;
155119 CopyMoveDeleted (CopyMoveDeleted &&) = delete ;
156120};
157121#ifdef __ORBIS__
158- static_assert (__is_trivially_relocatable(CopyMoveDeleted), " " ); // expected-warning{{deprecated}}
159- static_assert (__builtin_is_cpp_trivially_relocatable(CopyMoveDeleted), " " );
160-
122+ static_assert (__is_trivially_relocatable(CopyMoveDeleted), " " );
161123#else
162- static_assert (!__is_trivially_relocatable(CopyMoveDeleted), " " ); // expected-warning{{deprecated}}
163- static_assert (!__builtin_is_cpp_trivially_relocatable(CopyMoveDeleted), " " );
164-
124+ static_assert (!__is_trivially_relocatable(CopyMoveDeleted), " " );
165125#endif
166126
167127struct __attribute__ ((trivial_abi)) S18 { // expected-warning {{'trivial_abi' cannot be applied to 'S18'}} expected-note {{copy constructors and move constructors are all deleted}}
168128 CopyMoveDeleted a;
169129};
170130#ifdef __ORBIS__
171- static_assert (__is_trivially_relocatable(S18), " " ); // expected-warning{{deprecated}}
172- static_assert (__builtin_is_cpp_trivially_relocatable(S18), " " );
131+ static_assert (__is_trivially_relocatable(S18), " " );
173132#else
174- static_assert (!__is_trivially_relocatable(S18), " " ); // expected-warning{{deprecated}}
175- static_assert (!__builtin_is_cpp_trivially_relocatable(S18), " " );
133+ static_assert (!__is_trivially_relocatable(S18), " " );
176134#endif
177135
178136struct __attribute__ ((trivial_abi)) CopyDeleted {
179137 CopyDeleted (const CopyDeleted &) = delete ;
180138 CopyDeleted (CopyDeleted &&) = default ;
181139};
182140#if defined(_WIN64) && !defined(__MINGW32__)
183- static_assert (!__is_trivially_relocatable(CopyDeleted), " " ); // expected-warning{{deprecated}}
184- static_assert (!__builtin_is_cpp_trivially_relocatable(CopyDeleted), " " );
185-
141+ static_assert (!__is_trivially_relocatable(CopyDeleted), " " );
186142#else
187- static_assert (__is_trivially_relocatable(CopyDeleted), " " ); // expected-warning{{deprecated}}
188- static_assert (!__builtin_is_cpp_trivially_relocatable(CopyDeleted), " " );
143+ static_assert (__is_trivially_relocatable(CopyDeleted), " " );
189144#endif
190145
191146struct __attribute__ ((trivial_abi)) MoveDeleted {
192147 MoveDeleted (const MoveDeleted &) = default ;
193148 MoveDeleted (MoveDeleted &&) = delete ;
194149};
195- static_assert (__is_trivially_relocatable(MoveDeleted), " " ); // expected-warning{{deprecated}}
196- static_assert (!__builtin_is_cpp_trivially_relocatable(MoveDeleted), " " );
150+ static_assert (__is_trivially_relocatable(MoveDeleted), " " );
151+
197152struct __attribute__ ((trivial_abi)) S19 { // expected-warning {{'trivial_abi' cannot be applied to 'S19'}} expected-note {{copy constructors and move constructors are all deleted}}
198153 CopyDeleted a;
199154 MoveDeleted b;
200155};
201156#ifdef __ORBIS__
202- static_assert (__is_trivially_relocatable(S19), " " ); // expected-warning{{deprecated}}
203- static_assert (__builtin_is_cpp_trivially_relocatable(S19), " " );
204- static_assert (!__is_trivially_relocatable(S19), " " ); // expected-warning{{deprecated}}
205- static_assert (!__builtin_is_cpp_trivially_relocatable(S19), " " );
157+ static_assert (__is_trivially_relocatable(S19), " " );
158+ #else
159+ static_assert (!__is_trivially_relocatable(S19), " " );
206160#endif
207161
208162// This is fine since the move constructor isn't deleted.
209163struct __attribute__ ((trivial_abi)) S20 {
210164 int &&a; // a member of rvalue reference type deletes the copy constructor.
211165};
212166#if defined(_WIN64) && !defined(__MINGW32__)
213- static_assert (!__is_trivially_relocatable(S20), " " ); // expected-warning{{deprecated}}
214- static_assert (!__builtin_is_cpp_trivially_relocatable(S20), " " );
215-
167+ static_assert (!__is_trivially_relocatable(S20), " " );
216168#else
217- static_assert (__is_trivially_relocatable(S20), " " ); // expected-warning{{deprecated}}
218- static_assert (!__builtin_is_cpp_trivially_relocatable(S20), " " );
219-
169+ static_assert (__is_trivially_relocatable(S20), " " );
220170#endif
221171} // namespace deletedCopyMoveConstructor
0 commit comments