| 1 |
// RUN: %clang_cc1 -fblocks -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -verify %s |
| 2 |
|
| 3 |
#if __has_feature(ptrauth_objc_signable_class) |
| 4 |
@class TestClass; |
| 5 |
typedef TestClass *ClassPtr; |
| 6 |
typedef void(^BlockPtr)(); |
| 7 |
@interface TestClass { |
| 8 |
@public |
| 9 |
__ptrauth(2, 1, 1) Class a; |
| 10 |
__ptrauth(2, 1, 3) volatile Class vi; |
| 11 |
__ptrauth(2, 1, 3) const Class ci; |
| 12 |
__ptrauth(2, 1, 1) id b; |
| 13 |
// expected-error@-1 {{'__ptrauth' qualifier only applies to pointer or pointer sized integer types; 'id' is invalid}} |
| 14 |
__ptrauth(2, 1, 2) ClassPtr c; |
| 15 |
// expected-error@-1 {{'__ptrauth' qualifier only applies to pointer or pointer sized integer types; 'ClassPtr' (aka 'TestClass *') is invalid}} |
| 16 |
__ptrauth(2, 1, 2) BlockPtr d; |
| 17 |
// expected-error@-1 {{'__ptrauth' qualifier only applies to pointer or pointer sized integer types; 'BlockPtr' (aka 'void (^)()') is invalid}} |
| 18 |
} |
| 19 |
|
| 20 |
struct TestStruct { |
| 21 |
__ptrauth(2, 1, 3) Class e; |
| 22 |
__ptrauth(2, 1, 3) volatile Class vi; |
| 23 |
__ptrauth(2, 1, 3) const Class ci; |
| 24 |
__ptrauth(2, 1, 4) id f; |
| 25 |
// expected-error@-1 {{'__ptrauth' qualifier only applies to pointer or pointer sized integer types; 'id' is invalid}} |
| 26 |
__ptrauth(2, 1, 5) ClassPtr g; |
| 27 |
// expected-error@-1 {{'__ptrauth' qualifier only applies to pointer or pointer sized integer types; 'ClassPtr' (aka 'TestClass *') is invalid}} |
| 28 |
__ptrauth(2, 1, 2) BlockPtr h; |
| 29 |
// expected-error@-1 {{'__ptrauth' qualifier only applies to pointer or pointer sized integer types; 'BlockPtr' (aka 'void (^)()') is invalid}} |
| 30 |
}; |
| 31 |
|
| 32 |
@end |
| 33 |
|
| 34 |
void foo() { |
| 35 |
__ptrauth(2, 1, 3) Class i; |
| 36 |
__ptrauth(2, 1, 3) volatile Class vi; |
| 37 |
__ptrauth(2, 1, 3) const Class ci = 0; |
| 38 |
__ptrauth(2, 1, 4) id j; |
| 39 |
// expected-error@-1 {{'__ptrauth' qualifier only applies to pointer or pointer sized integer types; 'id' is invalid}} |
| 40 |
__ptrauth(2, 1, 5) ClassPtr k; |
| 41 |
// expected-error@-1 {{'__ptrauth' qualifier only applies to pointer or pointer sized integer types; 'ClassPtr' (aka 'TestClass *') is invalid}} |
| 42 |
__ptrauth(2, 1, 2) BlockPtr l; |
| 43 |
// expected-error@-1 {{'__ptrauth' qualifier only applies to pointer or pointer sized integer types; 'BlockPtr' (aka 'void (^)()') is invalid}} |
| 44 |
} |
| 45 |
|
| 46 |
#endif |