llvm-project/clang/test/AST/ast-dump-ptrauth-json.cpp
Akira Hatanaka 666e3326fe
[PAC] Define __builtin_ptrauth_type_discriminator (#100204)
The builtin computes the discriminator for a type, which can be used to
sign/authenticate function pointers and member function pointers.

If the type passed to the builtin is a C++ member function pointer type,
the result is the discriminator used to signed member function pointers
of that type. If the type is a function, function pointer, or function
reference type, the result is the discriminator used to sign functions
of that type. It is ill-formed to use this builtin with any other type.

A call to this function is an integer constant expression.

Co-Authored-By: John McCall rjmccall@apple.com
2024-07-24 02:04:37 -07:00

6 lines
237 B
C++

// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -std=c++11 -ast-dump=json %s | FileCheck %s
// CHECK: "name": "__builtin_ptrauth_type_discriminator",
int d = __builtin_ptrauth_type_discriminator(int());