Clang Project

clang_source_code/test/CodeGen/xray-attr-list.cpp
1// RUN: echo "[always]" > %t.xray-attrlist
2// RUN: echo "fun:*always*" >> %t.xray-attrlist
3// RUN: echo "[never]" >> %t.xray-attrlist
4// RUN: echo "fun:*never*" >> %t.xray-attrlist
5// RUN: %clang_cc1 -fxray-instrument -x c++ -std=c++11 \
6// RUN:     -fxray-attr-list=%t.xray-attrlist -emit-llvm -o - %s \
7// RUN:     -triple x86_64-unknown-linux-gnu | FileCheck %s
8
9void always() {}
10void never() {}
11[[clang::xray_never_instrument]] void alwaysNever() {}
12[[clang::xray_always_instrument]] void neverAlways() {}
13
14// CHECK: define void @_Z6alwaysv() #[[ALWAYSATTR:[0-9]+]] {
15// CHECK: define void @_Z5neverv() #[[NEVERATTR:[0-9]+]] {
16// CHECK: define void @_Z11alwaysNeverv() #[[NEVERATTR]] {
17// CHECK: define void @_Z11neverAlwaysv() #[[ALWAYSATTR]] {
18// CHECK: attributes #[[ALWAYSATTR]] = {{.*}} "function-instrument"="xray-always" {{.*}}
19// CHECK: attributes #[[NEVERATTR]] = {{.*}} "function-instrument"="xray-never" {{.*}}
20