blob: 79286c2c8aed36369606e1e8dbd4f4a973e5baaa [file] [log] [blame]
Dean Michael Berris488f7c22018-04-13 02:31:58 +00001// 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 \
Keith Wyssf437e352018-04-17 21:32:43 +00003// RUN: | FileCheck --check-prefixes CHECK,NOFUNCTION,NOCUSTOM,NOTYPED %s
4// RUN: %clang_cc1 -fxray-instrument -fxray-instrumentation-bundle=function -x c++ \
Dean Michael Berris488f7c22018-04-13 02:31:58 +00005// RUN: -std=c++11 -triple x86_64-unknown-unknown -emit-llvm -o - %s \
Keith Wyssf437e352018-04-17 21:32:43 +00006// RUN: | FileCheck --check-prefixes CHECK,FUNCTION,NOCUSTOM,NOTYPED %s
Dean Michael Berris488f7c22018-04-13 02:31:58 +00007// 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 \
Keith Wyssf437e352018-04-17 21:32:43 +000010// 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
Dean Michael Berris488f7c22018-04-13 02:31:58 +000019// 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 \
Keith Wyssf437e352018-04-17 21:32:43 +000022// 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
Dean Michael Berris488f7c22018-04-13 02:31:58 +000031// RUN: %clang_cc1 -fxray-instrument \
32// RUN: -fxray-instrumentation-bundle=function \
Keith Wyssf437e352018-04-17 21:32:43 +000033// RUN: -fxray-instrumentation-bundle=custom \
34// RUN: -fxray-instrumentation-bundle=typed -x c++ \
Dean Michael Berris488f7c22018-04-13 02:31:58 +000035// RUN: -std=c++11 -triple x86_64-unknown-unknown -emit-llvm -o - %s \
Keith Wyssf437e352018-04-17 21:32:43 +000036// RUN: | FileCheck --check-prefixes CHECK,FUNCTION,CUSTOM,TYPED %s
Dean Michael Berris488f7c22018-04-13 02:31:58 +000037
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);
Keith Wyssf437e352018-04-17 21:32:43 +000042 __xray_typedevent(1, kPhase, 6);
Dean Michael Berris488f7c22018-04-13 02:31:58 +000043 // CUSTOM: call void @llvm.xray.customevent(i8*{{.*}}, i32 6)
44 // NOCUSTOM-NOT: call void @llvm.xray.customevent(i8*{{.*}}, i32 6)
Keith Wyssf437e352018-04-17 21:32:43 +000045 // TYPED: call void @llvm.xray.typedevent(i16 {{.*}}, i8*{{.*}}, i32 6)
46 // NOTYPED-NOT: call void @llvm.xray.typedevent(i16 {{.*}}, i8*{{.*}}, i32 6)
Dean Michael Berris488f7c22018-04-13 02:31:58 +000047}
48
49// FUNCTION: attributes #[[ALWAYSATTR]] = {{.*}} "function-instrument"="xray-always" {{.*}}
50// NOFUNCTION-NOT: attributes #[[ALWAYSATTR]] = {{.*}} "function-instrument"="xray-always" {{.*}}