Debian Codegraph @

clang/test/SemaObjC/ptrauth-qualifier.m

raw
1 // RUN: %clang_cc1 -triple arm64-apple-ios -DIS_DARWIN -fsyntax-only -verify -fptrauth-intrinsics %s
2 // RUN: %clang_cc1 -triple aarch64-linux-gnu -fsyntax-only -verify -fptrauth-intrinsics %s
3
4 #if defined(IS_DARWIN) && !__has_extension(ptrauth_qualifier)
5 // This error means that the __ptrauth qualifier availability test says that it
6 // is not available. This error is not expected in the output, if it is seen
7 // there is a feature detection regression.
8 #error __ptrauth qualifier not enabled
9 #endif
10
11 #if defined(IS_DARWIN) && !__has_feature(ptrauth_qualifier)
12 // This error means that the __has_feature test for ptrauth_qualifier has
13 // failed, despite it being expected on darwin.
14 #error __ptrauth qualifier not enabled
15 #elif !defined(IS_DARWIN) && (__has_feature(ptrauth_qualifier) || __has_extension(ptrauth_qualifier))
16 #error ptrauth_qualifier labeled a feature on a non-darwin platform
17 #endif
18
19 #if !defined (__PTRAUTH__)
20 #error __PTRAUTH__ test macro not defined when ptrauth is enabled
21 #endif
22
23 @interface Foo
24 // expected-warning@-1 {{class 'Foo' defined without specifying a base class}}
25 // expected-note@-2 {{add a super class to fix this problem}}
26
27 @property void *__ptrauth(1, 1, 1) invalid1;
28 // expected-error@-1 {{property may not be qualified with '__ptrauth'; type is 'void *__ptrauth(1,1,1)'}}
29
30 @property void *__ptrauth(1, 0, 1) invalid2;
31 // expected-error@-1 {{property may not be qualified with '__ptrauth'; type is 'void *__ptrauth(1,0,1)'}}
32
33 @property unsigned long long __ptrauth(1, 1, 1) invalid3;
34 // expected-error@-1 {{property may not be qualified with '__ptrauth'; type is '__ptrauth(1,1,1) unsigned long long'}}
35
36 @property unsigned long long __ptrauth(1, 0, 1) invalid4;
37 // expected-error@-1 {{property may not be qualified with '__ptrauth'; type is '__ptrauth(1,0,1) unsigned long long'}}
38
39 - (void *__ptrauth(1, 1, 1))invalid5;
40 // expected-error@-1 {{return type may not be qualified with '__ptrauth'; type is 'void *__ptrauth(1,1,1)'}}
41
42 - (void *__ptrauth(1, 0, 1))invalid6;
43 // expected-error@-1 {{return type may not be qualified with '__ptrauth'; type is 'void *__ptrauth(1,0,1)'}}
44
45 - (unsigned long long __ptrauth(1, 1, 1))invalid7;
46 // expected-error@-1 {{return type may not be qualified with '__ptrauth'; type is '__ptrauth(1,1,1) unsigned long long'}}
47
48 - (unsigned long long __ptrauth(1, 0, 1))invalid8;
49 // expected-error@-1 {{return type may not be qualified with '__ptrauth'; type is '__ptrauth(1,0,1) unsigned long long'}}
50
51 - (void)invalid9:(void *__ptrauth(1, 1, 1))a;
52 // expected-error@-1 {{parameter type may not be qualified with '__ptrauth'; type is 'void *__ptrauth(1,1,1)'}}
53 // expected-note@-2 {{method 'invalid9:' declared here}}
54
55 - (void)invalid10:(void *__ptrauth(1, 0, 1))a;
56 // expected-error@-1 {{parameter type may not be qualified with '__ptrauth'; type is 'void *__ptrauth(1,0,1)'}}
57 // expected-note@-2 {{method 'invalid10:' declared here}}
58
59 - (void)invalid11:(unsigned long long __ptrauth(1, 1, 1))a;
60 // expected-error@-1 {{parameter type may not be qualified with '__ptrauth'; type is '__ptrauth(1,1,1) unsigned long long'}}
61 // expected-note@-2 {{method 'invalid11:' declared here}}
62
63 - (void)invalid12:(unsigned long long __ptrauth(1, 0, 1))a;
64 // expected-error@-1 {{parameter type may not be qualified with '__ptrauth'; type is '__ptrauth(1,0,1) unsigned long long'}}
65 // expected-note@-2 {{method 'invalid12:' declared here}}
66 @end
67
68 @implementation Foo
69 // expected-warning@-1 4{{method definition for}}
70
71 - (void *__ptrauth(1, 1, 1))invalid13 {
72 // expected-error@-1 {{return type may not be qualified with '__ptrauth'; type is 'void *__ptrauth(1,1,1)'}}
73 return 0;
74 }
75
76 - (void *__ptrauth(1, 0, 1))invalid14 {
77 // expected-error@-1 {{return type may not be qualified with '__ptrauth'; type is 'void *__ptrauth(1,0,1)'}}
78 return 0;
79 }
80
81 - (unsigned long long __ptrauth(1, 1, 1))invalid15 {
82 // expected-error@-1 {{return type may not be qualified with '__ptrauth'; type is '__ptrauth(1,1,1) unsigned long long'}}
83 return 0;
84 }
85
86 - (unsigned long long __ptrauth(1, 0, 1))invalid16 {
87 // expected-error@-1 {{return type may not be qualified with '__ptrauth'; type is '__ptrauth(1,0,1) unsigned long long'}}
88 return 0;
89 }
90
91 - (void)invalid17:(void *__ptrauth(1, 1, 1))a {
92 // expected-error@-1 {{parameter type may not be qualified with '__ptrauth'; type is 'void *__ptrauth(1,1,1)'}}
93 }
94
95 - (void)invalid18:(void *__ptrauth(1, 0, 1))a {
96 // expected-error@-1 {{parameter type may not be qualified with '__ptrauth'; type is 'void *__ptrauth(1,0,1)'}}
97 }
98
99 - (void)invalid19:(unsigned long long __ptrauth(1, 1, 1))a {
100 // expected-error@-1 {{parameter type may not be qualified with '__ptrauth'; type is '__ptrauth(1,1,1) unsigned long long'}}
101 }
102
103 - (void)invalid20:(unsigned long long __ptrauth(1, 0, 1))a {
104 // expected-error@-1 {{parameter type may not be qualified with '__ptrauth'; type is '__ptrauth(1,0,1) unsigned long long'}}
105 }
106
107 @end