mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-16 17:16:42 +00:00

The qualifier allows programmer to directly control how pointers are signed when they are stored in a particular variable. The qualifier takes three arguments: the signing key, a flag specifying whether address discrimination should be used, and a non-negative integer that is used for additional discrimination. ``` typedef void (*my_callback)(const void*); my_callback __ptrauth(ptrauth_key_process_dependent_code, 1, 0xe27a) callback; ``` Co-Authored-By: John McCall rjmccall@apple.com
57 lines
2.2 KiB
Objective-C
57 lines
2.2 KiB
Objective-C
// RUN: %clang_cc1 -triple arm64-apple-ios -fsyntax-only -verify -fptrauth-intrinsics %s
|
|
// RUN: %clang_cc1 -triple aarch64-linux-gnu -fsyntax-only -verify -fptrauth-intrinsics %s
|
|
|
|
#if __has_feature(ptrauth_qualifier)
|
|
#warning __ptrauth qualifier enabled!
|
|
// expected-warning@-1 {{__ptrauth qualifier enabled!}}
|
|
#endif
|
|
|
|
@interface Foo
|
|
// expected-warning@-1 {{class 'Foo' defined without specifying a base class}}
|
|
// expected-note@-2 {{add a super class to fix this problem}}
|
|
|
|
@property void *__ptrauth(1, 1, 1) invalid1;
|
|
// expected-error@-1 {{property may not be qualified with '__ptrauth'; type is 'void *__ptrauth(1,1,1)'}}
|
|
|
|
@property void *__ptrauth(1, 0, 1) invalid2;
|
|
// expected-error@-1 {{property may not be qualified with '__ptrauth'; type is 'void *__ptrauth(1,0,1)'}}
|
|
|
|
- (void *__ptrauth(1, 1, 1))invalid5;
|
|
// expected-error@-1 {{return type may not be qualified with '__ptrauth'; type is 'void *__ptrauth(1,1,1)'}}
|
|
|
|
- (void *__ptrauth(1, 0, 1))invalid6;
|
|
// expected-error@-1 {{return type may not be qualified with '__ptrauth'; type is 'void *__ptrauth(1,0,1)'}}
|
|
|
|
- (void)invalid9:(void *__ptrauth(1, 1, 1))a;
|
|
// expected-error@-1 {{parameter type may not be qualified with '__ptrauth'; type is 'void *__ptrauth(1,1,1)'}}
|
|
// expected-note@-2 {{method 'invalid9:' declared here}}
|
|
|
|
- (void)invalid10:(void *__ptrauth(1, 0, 1))a;
|
|
// expected-error@-1 {{parameter type may not be qualified with '__ptrauth'; type is 'void *__ptrauth(1,0,1)'}}
|
|
// expected-note@-2 {{method 'invalid10:' declared here}}
|
|
|
|
@end
|
|
|
|
@implementation Foo
|
|
// expected-warning@-1 2{{method definition for}}
|
|
|
|
- (void *__ptrauth(1, 1, 1))invalid13 {
|
|
// expected-error@-1 {{return type may not be qualified with '__ptrauth'; type is 'void *__ptrauth(1,1,1)'}}
|
|
return 0;
|
|
}
|
|
|
|
- (void *__ptrauth(1, 0, 1))invalid14 {
|
|
// expected-error@-1 {{return type may not be qualified with '__ptrauth'; type is 'void *__ptrauth(1,0,1)'}}
|
|
return 0;
|
|
}
|
|
|
|
- (void)invalid17:(void *__ptrauth(1, 1, 1))a {
|
|
// expected-error@-1 {{parameter type may not be qualified with '__ptrauth'; type is 'void *__ptrauth(1,1,1)'}}
|
|
}
|
|
|
|
- (void)invalid18:(void *__ptrauth(1, 0, 1))a {
|
|
// expected-error@-1 {{parameter type may not be qualified with '__ptrauth'; type is 'void *__ptrauth(1,0,1)'}}
|
|
}
|
|
|
|
@end
|