[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
This commit is contained in:
Zola Bridges 2020-05-13 11:43:15 -07:00
parent 03c44c7584
commit 18a855da43
1 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,15 @@
// RUN: %clang -E -mspeculative-load-hardening %s -o - | FileCheck --check-prefix=CHECK-SLH %s
// RUN: %clang -E -mno-speculative-load-hardening %s -o - | FileCheck --check-prefix=CHECK-NOSLH %s
// RUN: %clang -E %s -o - | FileCheck --check-prefix=CHECK-DEFAULT %s
#if __has_feature(speculative_load_hardening)
int SpeculativeLoadHardeningEnabled();
#else
int SpeculativeLoadHardeningDisabled();
#endif
// CHECK-SLH: SpeculativeLoadHardeningEnabled
// CHECK-NOSLH: SpeculativeLoadHardeningDisabled
// CHECK-DEFAULT: SpeculativeLoadHardeningDisabled