Skip to content

Commit 18a855d

Browse files
committed
[clang][slh] Add test for SLH feature checking macro
Summary: I forgot to include a test in this commit: https://reviews.llvm.org/rG379e68a763097bed55556c6dc7453e4b732e3d68 Here's the test. It passes after that commit and fails before that commit. Reviewed By: mattdr Differential Revision: https://reviews.llvm.org/D79894
1 parent 03c44c7 commit 18a855d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// RUN: %clang -E -mspeculative-load-hardening %s -o - | FileCheck --check-prefix=CHECK-SLH %s
2+
// RUN: %clang -E -mno-speculative-load-hardening %s -o - | FileCheck --check-prefix=CHECK-NOSLH %s
3+
// RUN: %clang -E %s -o - | FileCheck --check-prefix=CHECK-DEFAULT %s
4+
5+
#if __has_feature(speculative_load_hardening)
6+
int SpeculativeLoadHardeningEnabled();
7+
#else
8+
int SpeculativeLoadHardeningDisabled();
9+
#endif
10+
11+
// CHECK-SLH: SpeculativeLoadHardeningEnabled
12+
13+
// CHECK-NOSLH: SpeculativeLoadHardeningDisabled
14+
15+
// CHECK-DEFAULT: SpeculativeLoadHardeningDisabled

0 commit comments

Comments
 (0)