[PATCH] D79894: [clang][slh] Add test for SLH feature checking macro

Zola Bridges via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 13 11:58:07 PDT 2020


zbrid created this revision.
zbrid added reviewers: craig.topper, mattdr.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79894

Files:
  clang/test/Lexer/has_feature_speculative_load_hardening.cpp


Index: clang/test/Lexer/has_feature_speculative_load_hardening.cpp
===================================================================
--- /dev/null
+++ 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79894.263806.patch
Type: text/x-patch
Size: 798 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200513/12884b99/attachment-0001.bin>


More information about the cfe-commits mailing list