Skip to content

Commit 9436a51

Browse files
committed
[PAC][clang] Enhance preprocessor ptrauth tests
Test one feature at a time to make RUN lines shorter. See also llvm#96992 (comment)
1 parent 587308c commit 9436a51

File tree

1 file changed

+24
-69
lines changed

1 file changed

+24
-69
lines changed
Lines changed: 24 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,26 @@
1-
// RUN: %clang_cc1 -E %s -triple=aarch64 \
2-
// RUN: -fptrauth-intrinsics \
3-
// RUN: -fptrauth-calls \
4-
// RUN: -fptrauth-returns \
5-
// RUN: -fptrauth-vtable-pointer-address-discrimination \
6-
// RUN: -fptrauth-vtable-pointer-type-discrimination \
7-
// RUN: -fptrauth-init-fini | \
8-
// RUN: FileCheck %s --check-prefixes=INTRIN,CALLS,RETS,VPTR_ADDR_DISCR,VPTR_TYPE_DISCR,INITFINI,NOFUNC
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.
93

10-
// RUN: %clang_cc1 -E %s -triple=aarch64 \
11-
// RUN: -fptrauth-calls \
12-
// RUN: -fptrauth-returns \
13-
// RUN: -fptrauth-vtable-pointer-address-discrimination \
14-
// RUN: -fptrauth-vtable-pointer-type-discrimination \
15-
// RUN: -fptrauth-init-fini | \
16-
// RUN: FileCheck %s --check-prefixes=NOINTRIN,CALLS,RETS,VPTR_ADDR_DISCR,VPTR_TYPE_DISCR,INITFINI,NOFUNC
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,NOFUNC,NOINITFINI
176

18-
// RUN: %clang_cc1 -E %s -triple=aarch64 \
19-
// RUN: -fptrauth-intrinsics \
20-
// RUN: -fptrauth-returns \
21-
// RUN: -fptrauth-vtable-pointer-address-discrimination \
22-
// RUN: -fptrauth-vtable-pointer-type-discrimination \
23-
// RUN: -fptrauth-init-fini | \
24-
// RUN: FileCheck %s --check-prefixes=INTRIN,NOCALLS,RETS,VPTR_ADDR_DISCR,VPTR_TYPE_DISCR,INITFINI,NOFUNC
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,NOFUNC,NOINITFINI
259

26-
// RUN: %clang_cc1 -E %s -triple=aarch64 \
27-
// RUN: -fptrauth-intrinsics \
28-
// RUN: -fptrauth-calls \
29-
// RUN: -fptrauth-vtable-pointer-address-discrimination \
30-
// RUN: -fptrauth-vtable-pointer-type-discrimination \
31-
// RUN: -fptrauth-init-fini | \
32-
// RUN: FileCheck %s --check-prefixes=INTRIN,CALLS,NORETS,VPTR_ADDR_DISCR,VPTR_TYPE_DISCR,INITFINI,NOFUNC
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,NOFUNC,NOINITFINI
3312

34-
// RUN: %clang_cc1 -E %s -triple=aarch64 \
35-
// RUN: -fptrauth-intrinsics \
36-
// RUN: -fptrauth-calls \
37-
// RUN: -fptrauth-returns \
38-
// RUN: -fptrauth-vtable-pointer-type-discrimination \
39-
// RUN: -fptrauth-init-fini | \
40-
// RUN: FileCheck %s --check-prefixes=INTRIN,CALLS,RETS,NOVPTR_ADDR_DISCR,VPTR_TYPE_DISCR,INITFINI,NOFUNC
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,NOFUNC,NOINITFINI
4115

42-
// RUN: %clang_cc1 -E %s -triple=aarch64 \
43-
// RUN: -fptrauth-intrinsics \
44-
// RUN: -fptrauth-calls \
45-
// RUN: -fptrauth-returns \
46-
// RUN: -fptrauth-vtable-pointer-address-discrimination \
47-
// RUN: -fptrauth-init-fini | \
48-
// RUN: FileCheck %s --check-prefixes=INTRIN,CALLS,RETS,VPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,INITFINI,NOFUNC
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,NOFUNC,NOINITFINI
4918

50-
// RUN: %clang_cc1 -E %s -triple=aarch64 \
51-
// RUN: -fptrauth-intrinsics \
52-
// RUN: -fptrauth-calls \
53-
// RUN: -fptrauth-returns \
54-
// RUN: -fptrauth-vtable-pointer-address-discrimination \
55-
// RUN: -fptrauth-vtable-pointer-type-discrimination | \
56-
// RUN: FileCheck %s --check-prefixes=INTRIN,CALLS,RETS,VPTR_ADDR_DISCR,VPTR_TYPE_DISCR,NOINITFINI,NOFUNC
57-
58-
// RUN: %clang_cc1 -E %s -triple=aarch64 \
59-
// RUN: -fptrauth-intrinsics \
60-
// RUN: -fptrauth-calls \
61-
// RUN: -fptrauth-returns \
62-
// RUN: -fptrauth-vtable-pointer-address-discrimination \
63-
// RUN: -fptrauth-vtable-pointer-type-discrimination \
64-
// RUN: -fptrauth-function-pointer-type-discrimination | \
65-
// RUN: FileCheck %s --check-prefixes=INTRIN,CALLS,RETS,VPTR_ADDR_DISCR,VPTR_TYPE_DISCR,NOINITFINI,FUNC
19+
// RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-function-pointer-type-discrimination | \
20+
// RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,FUNC,NOINITFINI
6621

22+
// RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-init-fini | \
23+
// RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOFUNC,INITFINI
6724

6825
#if __has_feature(ptrauth_intrinsics)
6926
// INTRIN: has_ptrauth_intrinsics
@@ -114,20 +71,18 @@ void has_ptrauth_vtable_pointer_type_discrimination() {}
11471
void no_ptrauth_vtable_pointer_type_discrimination() {}
11572
#endif
11673

117-
#if __has_feature(ptrauth_init_fini)
118-
// INITFINI: has_ptrauth_init_fini
119-
void has_ptrauth_init_fini() {}
120-
#else
121-
// NOINITFINI: no_ptrauth_init_fini
122-
void no_ptrauth_init_fini() {}
123-
#endif
124-
125-
#include <ptrauth.h>
126-
12774
#if __has_feature(ptrauth_function_pointer_type_discrimination)
12875
// FUNC: has_ptrauth_function_pointer_type_discrimination
12976
void has_ptrauth_function_pointer_type_discrimination() {}
13077
#else
13178
// NOFUNC: no_ptrauth_function_pointer_type_discrimination
13279
void no_ptrauth_function_pointer_type_discrimination() {}
13380
#endif
81+
82+
#if __has_feature(ptrauth_init_fini)
83+
// INITFINI: has_ptrauth_init_fini
84+
void has_ptrauth_init_fini() {}
85+
#else
86+
// NOINITFINI: no_ptrauth_init_fini
87+
void no_ptrauth_init_fini() {}
88+
#endif

0 commit comments

Comments
 (0)