xref: /llvm-project/clang/test/CodeGen/xray-attributes-noxray-supported.cpp (revision fd739804e0591468762eb87488a497a3f7d4afb0)
1 // We want to ensure that the "never instrument" attributes show up even if we
2 // explicitly turn off XRay instrumentation.
3 //
4 /// -fno-xray-instrument is the default. It does not produce a CC1 option.
5 // RUN: %clang_cc1 %s -std=c++11 -x c++ -emit-llvm -o - \
6 // RUN:     -triple x86_64-unknown-linux-gnu | FileCheck %s
7 // RUN: %clang_cc1 %s -std=c++11 -x c++ -emit-llvm -o - \
8 // RUN:     -triple arm-unknown-linux-gnu -target-abi apcs-gnu | FileCheck %s
9 // RUN: %clang_cc1 %s -std=c++11 -x c++ -emit-llvm -o - \
10 // RUN:     -triple mips-unknown-linux-gnu | FileCheck %s
11 // RUN: %clang_cc1 %s -std=c++11 -x c++ -emit-llvm -o - \
12 // RUN:     -triple mipsel-unknown-linux-gnu | FileCheck %s
13 // RUN: %clang_cc1 %s -std=c++11 -x c++ -emit-llvm -o - \
14 // RUN:     -triple mips64-unknown-linux-gnu | FileCheck %s
15 // RUN: %clang_cc1 %s -std=c++11 -x c++ -emit-llvm -o - \
16 // RUN:     -triple mips64el-unknown-linux-gnu | FileCheck %s
17 // RUN: %clang_cc1 %s -std=c++11 -x c++ -emit-llvm -o - \
18 // RUN:     -triple powerpc64le-unknown-linux-gnu | FileCheck %s
19 
foo()20 [[clang::xray_always_instrument]] void foo() {
21 // CHECK: define{{.*}} void @_Z3foov() #0
22 }
23 
bar()24 [[clang::xray_never_instrument]] void bar() {
25 // CHECK: define{{.*}} void @_Z3barv() #1
26 }
27 
28 // CHECK-NOT: #0 = {{.*}}"function-instrument"="xray-always"
29 // CHECK: #1 = {{.*}}"function-instrument"="xray-never"
30 
31