-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[PAC][clang] Enhance preprocessor ptrauth tests #98862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PAC][clang] Enhance preprocessor ptrauth tests #98862
Conversation
Test one feature at a time to make RUN lines shorter. See also llvm#96992 (comment)
@llvm/pr-subscribers-clang Author: Daniil Kovalev (kovdan01) ChangesTest one feature at a time to make RUN lines shorter. See also #96992 (comment) Full diff: https://github.com/llvm/llvm-project/pull/98862.diff 1 Files Affected:
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/66/builds/1535 Here is the relevant piece of the build log for the reference:
|
Summary: Test one feature at a time to make RUN lines shorter. See also #96992 (comment) Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60251767
Test one feature at a time to make RUN lines shorter. See also #96992 (comment)