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 // RUN: %clang_cc1 -fxray-instrument \
38 // RUN: -fxray-instrumentation-bundle=function-entry -x c++ \
39 // RUN: -std=c++11 -triple x86_64-unknown-unknown -emit-llvm -o - %s \
40 // RUN: | FileCheck --check-prefixes CHECK,NOCUSTOM,NOTYPED,SKIPEXIT %s
41 // RUN: %clang_cc1 -fxray-instrument \
42 // RUN: -fxray-instrumentation-bundle=function-exit -x c++ \
43 // RUN: -std=c++11 -triple x86_64-unknown-unknown -emit-llvm -o - %s \
44 // RUN: | FileCheck --check-prefixes CHECK,NOCUSTOM,NOTYPED,SKIPENTRY %s
45 // RUN: %clang_cc1 -fxray-instrument \
46 // RUN: -fxray-instrumentation-bundle=function-entry,function-exit -x c++ \
47 // RUN: -std=c++11 -triple x86_64-unknown-unknown -emit-llvm -o - %s \
48 // RUN: | FileCheck --check-prefixes CHECK,FUNCTION,NOCUSTOM,NOTYPED %s
50 // CHECK: define{{.*}} void @_Z16alwaysInstrumentv() #[[ALWAYSATTR:[0-9]+]] {
51 [[clang::xray_always_instrument
]] void alwaysInstrument() {
52 static constexpr char kPhase
[] = "always";
53 __xray_customevent(kPhase
, 6);
54 __xray_typedevent(1, kPhase
, 6);
55 // CUSTOM: call void @llvm.xray.customevent(ptr{{.*}}, i32 6)
56 // NOCUSTOM-NOT: call void @llvm.xray.customevent(ptr{{.*}}, i32 6)
57 // TYPED: call void @llvm.xray.typedevent(i16 {{.*}}, ptr{{.*}}, i32 6)
58 // NOTYPED-NOT: call void @llvm.xray.typedevent(i16 {{.*}}, ptr{{.*}}, i32 6)
61 // FUNCTION: attributes #[[ALWAYSATTR]] = {{.*}} "function-instrument"="xray-always" {{.*}}
62 // NOFUNCTION-NOT: attributes #[[ALWAYSATTR]] = {{.*}} "function-instrument"="xray-always" {{.*}}
64 // SKIPENTRY: attributes #[[ALWAYSATTR]] = {{.*}} "function-instrument"="xray-always" {{.*}} "xray-skip-entry" {{.*}}
65 // SKIPEXIT: attributes #[[ALWAYSATTR]] = {{.*}} "function-instrument"="xray-always" {{.*}} "xray-skip-exit" {{.*}}