[clang] 18a855d - [clang][slh] Add test for SLH feature checking macro
Zola Bridges via cfe-commits
cfe-commits at lists.llvm.org
Fri May 15 12:23:56 PDT 2020
Author: Zola Bridges
Date: 2020-05-15T12:23:31-07:00
New Revision: 18a855da431e74499695ce43a8db23a1755ba632
URL: https://github.com/llvm/llvm-project/commit/18a855da431e74499695ce43a8db23a1755ba632
DIFF: https://github.com/llvm/llvm-project/commit/18a855da431e74499695ce43a8db23a1755ba632.diff
LOG: [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
Added:
clang/test/Lexer/has_feature_speculative_load_hardening.cpp
Modified:
Removed:
################################################################################
diff --git a/clang/test/Lexer/has_feature_speculative_load_hardening.cpp b/clang/test/Lexer/has_feature_speculative_load_hardening.cpp
new file mode 100644
index 000000000000..3bc743f286c7
--- /dev/null
+++ b/clang/test/Lexer/has_feature_speculative_load_hardening.cpp
@@ -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
More information about the cfe-commits
mailing list