[RISCV] Simplify MIPS CCMov patterns. NFC (#125318)
[llvm-project.git] / clang / test / Preprocessor / ptrauth_feature.c
bloba440791d6cc6950e49421a13781ed08d98fabfb2
1 //// Note: preprocessor features exactly match corresponding clang driver flags. However, some flags are only intended to be used in combination with other ones.
2 //// For example, -fptrauth-init-fini will not affect codegen without -fptrauth-calls, but the preprocessor feature would be set anyway.
4 // RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-intrinsics | \
5 // RUN: FileCheck %s --check-prefixes=INTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,NOINITFINI,NOINITFINI_ADDR_DISCR,NOGOTOS,NOELFGOT
7 // RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-calls | \
8 // RUN: FileCheck %s --check-prefixes=NOINTRIN,CALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,NOINITFINI,NOINITFINI_ADDR_DISCR,NOGOTOS,NOELFGOT
10 // RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-returns | \
11 // RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,RETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,NOINITFINI,NOINITFINI_ADDR_DISCR,NOGOTOS,NOELFGOT
13 // RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-vtable-pointer-address-discrimination | \
14 // RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,VPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,NOINITFINI,NOINITFINI_ADDR_DISCR,NOGOTOS,NOELFGOT
16 // RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-vtable-pointer-type-discrimination | \
17 // RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,VPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,NOINITFINI,NOINITFINI_ADDR_DISCR,NOGOTOS,NOELFGOT
19 // RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-type-info-vtable-pointer-discrimination | \
20 // RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,TYPE_INFO_DISCR,NOFUNC,NOINITFINI,NOINITFINI_ADDR_DISCR,NOGOTOS,NOELFGOT
22 // RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-function-pointer-type-discrimination | \
23 // RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,FUNC,NOINITFINI,NOINITFINI_ADDR_DISCR,NOGOTOS,NOELFGOT
25 // RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-init-fini | \
26 // RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,INITFINI,NOINITFINI_ADDR_DISCR,NOGOTOS,NOELFGOT
28 // RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-init-fini-address-discrimination | \
29 // RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,NOINITFINI,INITFINI_ADDR_DISCR,NOGOTOS,NOELFGOT
31 // RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-indirect-gotos | \
32 // RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,NOINITFINI,NOINITFINI_ADDR_DISCR,GOTOS,NOELFGOT
34 // RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-elf-got | \
35 // RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,NOINITFINI,NOINITFINI_ADDR_DISCR,NOGOTOS,ELFGOT
37 #if __has_feature(ptrauth_intrinsics)
38 // INTRIN: has_ptrauth_intrinsics
39 void has_ptrauth_intrinsics() {}
40 #else
41 // NOINTRIN: no_ptrauth_intrinsics
42 void no_ptrauth_intrinsics() {}
43 #endif
45 #if __has_feature(ptrauth_calls)
46 // CALLS: has_ptrauth_calls
47 void has_ptrauth_calls() {}
48 #else
49 // NOCALLS: no_ptrauth_calls
50 void no_ptrauth_calls() {}
51 #endif
53 // This is always enabled when ptrauth_calls is enabled
54 #if __has_feature(ptrauth_member_function_pointer_type_discrimination)
55 // CALLS: has_ptrauth_member_function_pointer_type_discrimination
56 void has_ptrauth_member_function_pointer_type_discrimination() {}
57 #else
58 // NOCALLS: no_ptrauth_member_function_pointer_type_discrimination
59 void no_ptrauth_member_function_pointer_type_discrimination() {}
60 #endif
62 #if __has_feature(ptrauth_returns)
63 // RETS: has_ptrauth_returns
64 void has_ptrauth_returns() {}
65 #else
66 // NORETS: no_ptrauth_returns
67 void no_ptrauth_returns() {}
68 #endif
70 #if __has_feature(ptrauth_vtable_pointer_address_discrimination)
71 // VPTR_ADDR_DISCR: has_ptrauth_vtable_pointer_address_discrimination
72 void has_ptrauth_vtable_pointer_address_discrimination() {}
73 #else
74 // NOVPTR_ADDR_DISCR: no_ptrauth_vtable_pointer_address_discrimination
75 void no_ptrauth_vtable_pointer_address_discrimination() {}
76 #endif
78 #if __has_feature(ptrauth_vtable_pointer_type_discrimination)
79 // VPTR_TYPE_DISCR: has_ptrauth_vtable_pointer_type_discrimination
80 void has_ptrauth_vtable_pointer_type_discrimination() {}
81 #else
82 // NOVPTR_TYPE_DISCR: no_ptrauth_vtable_pointer_type_discrimination
83 void no_ptrauth_vtable_pointer_type_discrimination() {}
84 #endif
86 #if __has_feature(ptrauth_type_info_vtable_pointer_discrimination)
87 // TYPE_INFO_DISCR: has_ptrauth_type_info_vtable_pointer_discrimination
88 void has_ptrauth_type_info_vtable_pointer_discrimination() {}
89 #else
90 // NOTYPE_INFO_DISCR: no_ptrauth_type_info_vtable_pointer_discrimination
91 void no_ptrauth_type_info_vtable_pointer_discrimination() {}
92 #endif
94 #if __has_feature(ptrauth_function_pointer_type_discrimination)
95 // FUNC: has_ptrauth_function_pointer_type_discrimination
96 void has_ptrauth_function_pointer_type_discrimination() {}
97 #else
98 // NOFUNC: no_ptrauth_function_pointer_type_discrimination
99 void no_ptrauth_function_pointer_type_discrimination() {}
100 #endif
102 #if __has_feature(ptrauth_init_fini)
103 // INITFINI: has_ptrauth_init_fini
104 void has_ptrauth_init_fini() {}
105 #else
106 // NOINITFINI: no_ptrauth_init_fini
107 void no_ptrauth_init_fini() {}
108 #endif
110 #if __has_feature(ptrauth_init_fini_address_discrimination)
111 // INITFINI_ADDR_DISCR: has_ptrauth_init_fini_address_discrimination
112 void has_ptrauth_init_fini_address_discrimination() {}
113 #else
114 // NOINITFINI_ADDR_DISCR: no_ptrauth_init_fini_address_discrimination
115 void no_ptrauth_init_fini_address_discrimination() {}
116 #endif
118 #if __has_feature(ptrauth_indirect_gotos)
119 // GOTOS: has_ptrauth_indirect_gotos
120 void has_ptrauth_indirect_gotos() {}
121 #else
122 // NOGOTOS: no_ptrauth_indirect_gotos
123 void no_ptrauth_indirect_gotos() {}
124 #endif
126 #if __has_feature(ptrauth_elf_got)
127 // ELFGOT: has_ptrauth_elf_got
128 void has_ptrauth_elf_got() {}
129 #else
130 // NOELFGOT: no_ptrauth_elf_got
131 void no_ptrauth_elf_got() {}
132 #endif