https://github.com/kovdan01 created https://github.com/llvm/llvm-project/pull/98862
Test one feature at a time to make RUN lines shorter. See also https://github.com/llvm/llvm-project/pull/96992#discussion_r1669394582 >From 9436a51f2545434da511c4421099f7501a5472c5 Mon Sep 17 00:00:00 2001 From: Daniil Kovalev <dkova...@accesssoftek.com> Date: Mon, 15 Jul 2024 09:51:36 +0300 Subject: [PATCH] [PAC][clang] Enhance preprocessor ptrauth tests Test one feature at a time to make RUN lines shorter. See also https://github.com/llvm/llvm-project/pull/96992#discussion_r1669394582 --- clang/test/Preprocessor/ptrauth_feature.c | 93 ++++++----------------- 1 file changed, 24 insertions(+), 69 deletions(-) diff --git a/clang/test/Preprocessor/ptrauth_feature.c b/clang/test/Preprocessor/ptrauth_feature.c index 88b6982c01657..1330ad10b4b47 100644 --- a/clang/test/Preprocessor/ptrauth_feature.c +++ b/clang/test/Preprocessor/ptrauth_feature.c @@ -1,69 +1,26 @@ -// RUN: %clang_cc1 -E %s -triple=aarch64 \ -// RUN: -fptrauth-intrinsics \ -// RUN: -fptrauth-calls \ -// RUN: -fptrauth-returns \ -// RUN: -fptrauth-vtable-pointer-address-discrimination \ -// RUN: -fptrauth-vtable-pointer-type-discrimination \ -// RUN: -fptrauth-init-fini | \ -// RUN: FileCheck %s --check-prefixes=INTRIN,CALLS,RETS,VPTR_ADDR_DISCR,VPTR_TYPE_DISCR,INITFINI,NOFUNC +//// Note: preprocessor features exactly match corresponding clang driver flags. However, some flags are only intended to be used in combination with other ones. +//// For example, -fptrauth-init-fini will not affect codegen without -fptrauth-calls, but the preprocessor feature would be set anyway. -// RUN: %clang_cc1 -E %s -triple=aarch64 \ -// RUN: -fptrauth-calls \ -// RUN: -fptrauth-returns \ -// RUN: -fptrauth-vtable-pointer-address-discrimination \ -// RUN: -fptrauth-vtable-pointer-type-discrimination \ -// RUN: -fptrauth-init-fini | \ -// RUN: FileCheck %s --check-prefixes=NOINTRIN,CALLS,RETS,VPTR_ADDR_DISCR,VPTR_TYPE_DISCR,INITFINI,NOFUNC +// RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-intrinsics | \ +// RUN: FileCheck %s --check-prefixes=INTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOFUNC,NOINITFINI -// RUN: %clang_cc1 -E %s -triple=aarch64 \ -// RUN: -fptrauth-intrinsics \ -// RUN: -fptrauth-returns \ -// RUN: -fptrauth-vtable-pointer-address-discrimination \ -// RUN: -fptrauth-vtable-pointer-type-discrimination \ -// RUN: -fptrauth-init-fini | \ -// RUN: FileCheck %s --check-prefixes=INTRIN,NOCALLS,RETS,VPTR_ADDR_DISCR,VPTR_TYPE_DISCR,INITFINI,NOFUNC +// RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-calls | \ +// RUN: FileCheck %s --check-prefixes=NOINTRIN,CALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOFUNC,NOINITFINI -// RUN: %clang_cc1 -E %s -triple=aarch64 \ -// RUN: -fptrauth-intrinsics \ -// RUN: -fptrauth-calls \ -// RUN: -fptrauth-vtable-pointer-address-discrimination \ -// RUN: -fptrauth-vtable-pointer-type-discrimination \ -// RUN: -fptrauth-init-fini | \ -// RUN: FileCheck %s --check-prefixes=INTRIN,CALLS,NORETS,VPTR_ADDR_DISCR,VPTR_TYPE_DISCR,INITFINI,NOFUNC +// RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-returns | \ +// RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,RETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOFUNC,NOINITFINI -// RUN: %clang_cc1 -E %s -triple=aarch64 \ -// RUN: -fptrauth-intrinsics \ -// RUN: -fptrauth-calls \ -// RUN: -fptrauth-returns \ -// RUN: -fptrauth-vtable-pointer-type-discrimination \ -// RUN: -fptrauth-init-fini | \ -// RUN: FileCheck %s --check-prefixes=INTRIN,CALLS,RETS,NOVPTR_ADDR_DISCR,VPTR_TYPE_DISCR,INITFINI,NOFUNC +// RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-vtable-pointer-address-discrimination | \ +// RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,VPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOFUNC,NOINITFINI -// RUN: %clang_cc1 -E %s -triple=aarch64 \ -// RUN: -fptrauth-intrinsics \ -// RUN: -fptrauth-calls \ -// RUN: -fptrauth-returns \ -// RUN: -fptrauth-vtable-pointer-address-discrimination \ -// RUN: -fptrauth-init-fini | \ -// RUN: FileCheck %s --check-prefixes=INTRIN,CALLS,RETS,VPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,INITFINI,NOFUNC +// RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-vtable-pointer-type-discrimination | \ +// RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,VPTR_TYPE_DISCR,NOFUNC,NOINITFINI -// RUN: %clang_cc1 -E %s -triple=aarch64 \ -// RUN: -fptrauth-intrinsics \ -// RUN: -fptrauth-calls \ -// RUN: -fptrauth-returns \ -// RUN: -fptrauth-vtable-pointer-address-discrimination \ -// RUN: -fptrauth-vtable-pointer-type-discrimination | \ -// RUN: FileCheck %s --check-prefixes=INTRIN,CALLS,RETS,VPTR_ADDR_DISCR,VPTR_TYPE_DISCR,NOINITFINI,NOFUNC - -// RUN: %clang_cc1 -E %s -triple=aarch64 \ -// RUN: -fptrauth-intrinsics \ -// RUN: -fptrauth-calls \ -// RUN: -fptrauth-returns \ -// RUN: -fptrauth-vtable-pointer-address-discrimination \ -// RUN: -fptrauth-vtable-pointer-type-discrimination \ -// RUN: -fptrauth-function-pointer-type-discrimination | \ -// RUN: FileCheck %s --check-prefixes=INTRIN,CALLS,RETS,VPTR_ADDR_DISCR,VPTR_TYPE_DISCR,NOINITFINI,FUNC +// RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-function-pointer-type-discrimination | \ +// RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,FUNC,NOINITFINI +// RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-init-fini | \ +// RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOFUNC,INITFINI #if __has_feature(ptrauth_intrinsics) // INTRIN: has_ptrauth_intrinsics @@ -114,16 +71,6 @@ void has_ptrauth_vtable_pointer_type_discrimination() {} void no_ptrauth_vtable_pointer_type_discrimination() {} #endif -#if __has_feature(ptrauth_init_fini) -// INITFINI: has_ptrauth_init_fini -void has_ptrauth_init_fini() {} -#else -// NOINITFINI: no_ptrauth_init_fini -void no_ptrauth_init_fini() {} -#endif - -#include <ptrauth.h> - #if __has_feature(ptrauth_function_pointer_type_discrimination) // FUNC: has_ptrauth_function_pointer_type_discrimination void has_ptrauth_function_pointer_type_discrimination() {} @@ -131,3 +78,11 @@ void has_ptrauth_function_pointer_type_discrimination() {} // NOFUNC: no_ptrauth_function_pointer_type_discrimination void no_ptrauth_function_pointer_type_discrimination() {} #endif + +#if __has_feature(ptrauth_init_fini) +// INITFINI: has_ptrauth_init_fini +void has_ptrauth_init_fini() {} +#else +// NOINITFINI: no_ptrauth_init_fini +void no_ptrauth_init_fini() {} +#endif _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits