Clang Project

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