1 // RUN: %clang_cc1 -fxray-instrument -fxray-instrumentation-bundle=none -x c++ \
2 // RUN:     -std=c++11 -triple x86_64-unknown-unknown -emit-llvm -o - %s \
3 // RUN:     | FileCheck --check-prefixes CHECK,NOFUNCTION,NOCUSTOM,NOTYPED %s
4 // RUN: %clang_cc1 -fxray-instrument -fxray-instrumentation-bundle=function -x c++ \
5 // RUN:     -std=c++11 -triple x86_64-unknown-unknown -emit-llvm -o - %s \
6 // RUN:     | FileCheck --check-prefixes CHECK,FUNCTION,NOCUSTOM,NOTYPED %s
7 // RUN: %clang_cc1 -fxray-instrument \
8 // RUN:     -fxray-instrumentation-bundle=custom -x c++ \
9 // RUN:     -std=c++11 -triple x86_64-unknown-unknown -emit-llvm -o - %s \
10 // RUN:     | FileCheck --check-prefixes CHECK,NOFUNCTION,CUSTOM,NOTYPED %s
11 // RUN: %clang_cc1 -fxray-instrument \
12 // RUN:     -fxray-instrumentation-bundle=typed -x c++ \
13 // RUN:     -std=c++11 -triple x86_64-unknown-unknown -emit-llvm -o - %s \
14 // RUN:     | FileCheck --check-prefixes CHECK,NOFUNCTION,NOCUSTOM,TYPED %s
15 // RUN: %clang_cc1 -fxray-instrument \
16 // RUN:     -fxray-instrumentation-bundle=custom,typed -x c++ \
17 // RUN:     -std=c++11 -triple x86_64-unknown-unknown -emit-llvm -o - %s \
18 // RUN:     | FileCheck --check-prefixes CHECK,NOFUNCTION,CUSTOM,TYPED %s
19 // RUN: %clang_cc1 -fxray-instrument \
20 // RUN:     -fxray-instrumentation-bundle=function,custom -x c++ \
21 // RUN:     -std=c++11 -triple x86_64-unknown-unknown -emit-llvm -o - %s \
22 // RUN:     | FileCheck --check-prefixes CHECK,FUNCTION,CUSTOM,NOTYPED %s
23 // RUN: %clang_cc1 -fxray-instrument \
24 // RUN:     -fxray-instrumentation-bundle=function,typed -x c++ \
25 // RUN:     -std=c++11 -triple x86_64-unknown-unknown -emit-llvm -o - %s \
26 // RUN:     | FileCheck --check-prefixes CHECK,FUNCTION,NOCUSTOM,TYPED %s
27 // RUN: %clang_cc1 -fxray-instrument \
28 // RUN:     -fxray-instrumentation-bundle=function,custom,typed -x c++ \
29 // RUN:     -std=c++11 -triple x86_64-unknown-unknown -emit-llvm -o - %s \
30 // RUN:     | FileCheck --check-prefixes CHECK,FUNCTION,CUSTOM,TYPED %s
31 // RUN: %clang_cc1 -fxray-instrument \
32 // RUN:     -fxray-instrumentation-bundle=function \
33 // RUN:     -fxray-instrumentation-bundle=custom \
34 // RUN:     -fxray-instrumentation-bundle=typed -x c++ \
35 // RUN:     -std=c++11 -triple x86_64-unknown-unknown -emit-llvm -o - %s \
36 // RUN:     | FileCheck --check-prefixes CHECK,FUNCTION,CUSTOM,TYPED %s
37 
38 // CHECK: define void @_Z16alwaysInstrumentv() #[[ALWAYSATTR:[0-9]+]] {
39 [[clang::xray_always_instrument]] void alwaysInstrument() {
40   static constexpr char kPhase[] = "always";
41   __xray_customevent(kPhase, 6);
42   __xray_typedevent(1, kPhase, 6);
43   // CUSTOM: call void @llvm.xray.customevent(i8*{{.*}}, i32 6)
44   // NOCUSTOM-NOT: call void @llvm.xray.customevent(i8*{{.*}}, i32 6)
45   // TYPED: call void @llvm.xray.typedevent(i16 {{.*}}, i8*{{.*}}, i32 6)
46   // NOTYPED-NOT: call void @llvm.xray.typedevent(i16 {{.*}}, i8*{{.*}}, i32 6)
47 }
48 
49 // FUNCTION: attributes #[[ALWAYSATTR]] = {{.*}} "function-instrument"="xray-always" {{.*}}
50 // NOFUNCTION-NOT: attributes #[[ALWAYSATTR]] = {{.*}} "function-instrument"="xray-always" {{.*}}
51