[clang] [clang][PAC][NFC] Provide addition support macros to ptrauth.h (PR #161027)

Anatoly Trosinenko via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 7 04:53:10 PDT 2025


================
@@ -384,9 +444,23 @@ typedef __UINTPTR_TYPE__ ptrauth_generic_signature_t;
 #define ptrauth_cxx_vtable_pointer(key, address_discrimination,                \
                                    extra_discrimination...)
 
+#define __ptrauth_function_pointer(__typekey)
----------------
atrosinenko wrote:

As far as I understand, they are intended to be used along the lines
```cpp
callback_t __ptrauth_function_pointer(ptrauth_function_pointer_type_discriminator(callback_t)) *cb;
```
or as a better example
```cpp
struct state {
  // ...
  uintptr_t __ptrauth_return_address saved_ret_addr;
  // ...
};
```
You have to "annotate" the variables with such macros at least once anyway, so without these empty defines you would have to duplicate variable definitions under `#ifdef`s (or even define empty macroses yourself and return to the original approach).

PS: Same as above :)
```suggestion
#define __ptrauth_function_pointer(__type_discriminator)
```

https://github.com/llvm/llvm-project/pull/161027


More information about the cfe-commits mailing list