summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/attr-speculative-load-hardening.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/CodeGen/attr-speculative-load-hardening.cpp')
-rw-r--r--clang/test/CodeGen/attr-speculative-load-hardening.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/CodeGen/attr-speculative-load-hardening.cpp b/clang/test/CodeGen/attr-speculative-load-hardening.cpp
new file mode 100644
index 00000000000..e2eb805cbb8
--- /dev/null
+++ b/clang/test/CodeGen/attr-speculative-load-hardening.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -std=c++11 -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK1
+// RUN: %clang_cc1 -std=c++11 -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK2
+//
+// Check that we set the attribute on each function.
+
+[[clang::speculative_load_hardening]]
+int test1() {
+ return 42;
+}
+
+int __attribute__((speculative_load_hardening)) test2() {
+ return 42;
+}
+// CHECK1: @{{.*}}test1{{.*}}[[SLH1:#[0-9]+]]
+// CHECK1: attributes [[SLH1]] = { {{.*}}speculative_load_hardening{{.*}} }
+
+// CHECK2: @{{.*}}test2{{.*}}[[SLH2:#[0-9]+]]
+// CHECK2: attributes [[SLH2]] = { {{.*}}speculative_load_hardening{{.*}} }
OpenPOWER on IntegriCloud