Mercurial > hg > CbC > CbC_llvm
comparison clang/test/SemaObjCXX/attr-trivial-abi.mm @ 150:1d019706d866
LLVM10
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 15:10:13 +0900 |
parents | |
children | 2e18cbf3894f |
comparison
equal
deleted
inserted
replaced
147:c2174574ed3a | 150:1d019706d866 |
---|---|
1 // RUN: %clang_cc1 -std=c++11 -fobjc-runtime-has-weak -fobjc-weak -fobjc-arc -fsyntax-only -verify %s | |
2 | |
3 void __attribute__((trivial_abi)) foo(); // expected-warning {{'trivial_abi' attribute only applies to classes}} | |
4 | |
5 struct [[clang::trivial_abi]] S0 { | |
6 int a; | |
7 }; | |
8 | |
9 struct __attribute__((trivial_abi)) S1 { | |
10 int a; | |
11 }; | |
12 | |
13 struct __attribute__((trivial_abi)) S2 { // expected-warning {{'trivial_abi' cannot be applied to 'S2'}} | |
14 __weak id a; | |
15 }; | |
16 | |
17 struct __attribute__((trivial_abi)) S3 { // expected-warning {{'trivial_abi' cannot be applied to 'S3'}} | |
18 virtual void m(); | |
19 }; | |
20 | |
21 struct S3_2 { | |
22 virtual void m(); | |
23 } __attribute__((trivial_abi)); // expected-warning {{'trivial_abi' cannot be applied to 'S3_2'}} | |
24 | |
25 struct S4 { | |
26 int a; | |
27 }; | |
28 | |
29 struct __attribute__((trivial_abi)) S5 : public virtual S4 { // expected-warning {{'trivial_abi' cannot be applied to 'S5'}} | |
30 }; | |
31 | |
32 struct __attribute__((trivial_abi)) S9 : public S4 { | |
33 }; | |
34 | |
35 struct S6 { | |
36 __weak id a; | |
37 }; | |
38 | |
39 struct __attribute__((trivial_abi)) S12 { // expected-warning {{'trivial_abi' cannot be applied to 'S12'}} | |
40 __weak id a; | |
41 }; | |
42 | |
43 struct __attribute__((trivial_abi)) S13 { // expected-warning {{'trivial_abi' cannot be applied to 'S13'}} | |
44 __weak id a[2]; | |
45 }; | |
46 | |
47 struct __attribute__((trivial_abi)) S7 { // expected-warning {{'trivial_abi' cannot be applied to 'S7'}} | |
48 S6 a; | |
49 }; | |
50 | |
51 struct __attribute__((trivial_abi)) S11 { // expected-warning {{'trivial_abi' cannot be applied to 'S11'}} | |
52 S6 a[2]; | |
53 }; | |
54 | |
55 struct __attribute__((trivial_abi(1))) S8 { // expected-error {{'trivial_abi' attribute takes no arguments}} | |
56 int a; | |
57 }; | |
58 | |
59 // Do not warn when 'trivial_abi' is used to annotate a template class. | |
60 template<class T> | |
61 struct __attribute__((trivial_abi)) S10 { | |
62 T p; | |
63 }; | |
64 | |
65 S10<int *> p1; | |
66 S10<__weak id> p2; | |
67 | |
68 template<> | |
69 struct __attribute__((trivial_abi)) S10<id> { // expected-warning {{'trivial_abi' cannot be applied to 'S10<id>'}} | |
70 __weak id a; | |
71 }; | |
72 | |
73 template<class T> | |
74 struct S14 { | |
75 T a; | |
76 __weak id b; | |
77 }; | |
78 | |
79 template<class T> | |
80 struct __attribute__((trivial_abi)) S15 : S14<T> { | |
81 }; | |
82 | |
83 S15<int> s15; | |
84 | |
85 template<class T> | |
86 struct __attribute__((trivial_abi)) S16 { | |
87 S14<T> a; | |
88 }; | |
89 | |
90 S16<int> s16; | |
91 | |
92 template<class T> | |
93 struct __attribute__((trivial_abi)) S17 { // expected-warning {{'trivial_abi' cannot be applied to 'S17'}} | |
94 __weak id a; | |
95 }; | |
96 | |
97 S17<int> s17; |