llvm-project/clang/test/AST/ast-dump-ptrauth-json.cpp
Akira Hatanaka a3283a92ae
[PAC] Add support for __ptrauth type qualifier (#100830)
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
2025-04-15 12:54:25 -07:00

9 lines
439 B
C++

// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -std=c++11 -ast-dump=json %s | FileCheck %s
// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -fptrauth-intrinsics -std=c++11 -ast-dump=json %s | FileCheck %s
// CHECK: "name": "__builtin_ptrauth_type_discriminator",
// CHECK: "qualType": "int *__ptrauth(1,1,123)"
int d = __builtin_ptrauth_type_discriminator(int());
int * __ptrauth(1,1,123) p;