brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.8 KiB · 22c5dd5 Raw
63 lines · cpp
1// Check that we correctly set or did not set the attribute for each function.2// RUN: %clang_cc1 -std=c++11 -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK13// RUN: %clang_cc1 -std=c++11 -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK24 5// Check that we correctly set or did not set the attribute on each function despite the6// -mspeculative-load-hardening flag.7// RUN: %clang_cc1 -mspeculative-load-hardening -std=c++11 -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK38// RUN: %clang_cc1 -mspeculative-load-hardening -std=c++11 -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK49 10 11// Check that we correctly set or did not set the attribute on each function despite the12// -mno-speculative-load-hardening flag.13// RUN: %clang -mno-speculative-load-hardening -S -std=c++11 -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK514// RUN: %clang -mno-speculative-load-hardening -S -std=c++11 -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK615 16 17[[clang::speculative_load_hardening]]18int test1() {19  return 42;20}21 22int __attribute__((speculative_load_hardening)) test2() {23  return 42;24}25 26[[clang::no_speculative_load_hardening]]27int test3() {28  return 42;29}30 31int __attribute__((no_speculative_load_hardening)) test4() {32  return 42;33}34// CHECK1: @{{.*}}test1{{.*}}[[SLH:#[0-9]+]]35// CHECK1: @{{.*}}test3{{.*}}[[NOSLH:#[0-9]+]]36// CHECK1: attributes [[SLH]] = { {{.*}}speculative_load_hardening{{.*}} }37// CHECK1-NOT: attributes [[NOSLH]] = { {{.*}}speculative_load_hardening{{.*}} }38 39// CHECK2: @{{.*}}test2{{.*}}[[SLH:#[0-9]+]]40// CHECK2: @{{.*}}test4{{.*}}[[NOSLH:#[0-9]+]]41// CHECK2: attributes [[SLH]] = { {{.*}}speculative_load_hardening{{.*}} }42// CHECK2-NOT: attributes [[NOSLH]] = { {{.*}}speculative_load_hardening{{.*}} }43 44// CHECK3: @{{.*}}test1{{.*}}[[SLH:#[0-9]+]]45// CHECK3: @{{.*}}test3{{.*}}[[NOSLH:#[0-9]+]]46// CHECK3: attributes [[SLH]] = { {{.*}}speculative_load_hardening{{.*}} }47// CHECK3-NOT: attributes [[NOSLH]] = { {{.*}}speculative_load_hardening{{.*}} }48 49// CHECK4: @{{.*}}test2{{.*}}[[SLH:#[0-9]+]]50// CHECK4: @{{.*}}test4{{.*}}[[NOSLH:#[0-9]+]]51// CHECK4: attributes [[SLH]] = { {{.*}}speculative_load_hardening{{.*}} }52// CHECK4-NOT: attributes [[NOSLH]] = { {{.*}}speculative_load_hardening{{.*}} }53 54// CHECK5: @{{.*}}test1{{.*}}[[SLH:#[0-9]+]]55// CHECK5: @{{.*}}test3{{.*}}[[NOSLH:#[0-9]+]]56// CHECK5: attributes [[SLH]] = { {{.*}}speculative_load_hardening{{.*}} }57// CHECK5-NOT: attributes [[NOSLH]] = { {{.*}}speculative_load_hardening{{.*}} }58 59// CHECK6: @{{.*}}test2{{.*}}[[SLH:#[0-9]+]]60// CHECK6: @{{.*}}test4{{.*}}[[NOSLH:#[0-9]+]]61// CHECK6: attributes [[SLH]] = { {{.*}}speculative_load_hardening{{.*}} }62// CHECK6-NOT: attributes [[NOSLH]] = { {{.*}}speculative_load_hardening{{.*}} }63