Clang Project

clang_source_code/test/CodeGen/xray-attributes-supported.cpp
1// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - \
2// RUN:     -triple x86_64-unknown-linux-gnu | FileCheck %s
3// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - \
4// RUN:     -triple arm-unknown-linux-gnu -target-abi apcs-gnu | FileCheck %s
5// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - \
6// RUN:     -triple mips-unknown-linux-gnu | FileCheck %s
7// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - \
8// RUN:     -triple mipsisa32r6-unknown-linux-gnu | FileCheck %s
9// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - \
10// RUN:     -triple mipsel-unknown-linux-gnu | FileCheck %s
11// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - \
12// RUN:     -triple mipsisa32r6el-unknown-linux-gnu | FileCheck %s
13// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - \
14// RUN:     -triple mips64-unknown-linux-gnu | FileCheck %s
15// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - \
16// RUN:     -triple mipsisa64r6-unknown-linux-gnu | FileCheck %s
17// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - \
18// RUN:     -triple mips64el-unknown-linux-gnu | FileCheck %s
19// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - \
20// RUN:     -triple mipsisa64r6el-unknown-linux-gnu | FileCheck %s
21// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - \
22// RUN:     -triple mips64-unknown-linux-gnuabi64 | FileCheck %s
23// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - \
24// RUN:     -triple mipsisa64r6-unknown-linux-gnuabi64 | FileCheck %s
25// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - \
26// RUN:     -triple mips64el-unknown-linux-gnuabi64 | FileCheck %s
27// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - \
28// RUN:     -triple mipsisa64r6el-unknown-linux-gnuabi64 | FileCheck %s
29// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - \
30// RUN:     -triple mips64-unknown-linux-gnuabin32 | FileCheck %s
31// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - \
32// RUN:     -triple mipsisa64r6-unknown-linux-gnuabin32 | FileCheck %s
33// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - \
34// RUN:     -triple mips64el-unknown-linux-gnuabin32 | FileCheck %s
35// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - \
36// RUN:     -triple mipsisa64r6el-unknown-linux-gnuabin32 | FileCheck %s
37// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - \
38// RUN:     -triple powerpc64le-unknown-linux-gnu | FileCheck %s
39
40// Make sure that the LLVM attribute for XRay-annotated functions do show up.
41[[clang::xray_always_instrument]] void foo() {
42// CHECK: define void @_Z3foov() #0
43};
44
45[[clang::xray_never_instrument]] void bar() {
46// CHECK: define void @_Z3barv() #1
47};
48
49// CHECK: #0 = {{.*}}"function-instrument"="xray-always"
50// CHECK: #1 = {{.*}}"function-instrument"="xray-never"
51