1 // RUN: %clang_cc1 -fxray-instrument -x c++ -std=c++11 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
3 // CHECK-LABEL: @_Z16alwaysInstrumentv
4 [[clang::xray_always_instrument
]] void alwaysInstrument() {
5 // Event types would normally come from calling __xray_register_event_type
8 static constexpr char kPhase
[] = "instrument";
9 __xray_typedevent(EventType
, kPhase
, 10);
10 // CHECK: call void @llvm.xray.typedevent(i64 {{.*}}, ptr{{.*}}, i64 10)
13 // CHECK-LABEL: @_Z15neverInstrumentv
14 [[clang::xray_never_instrument
]] void neverInstrument() {
16 static constexpr char kPhase
[] = "never";
17 __xray_typedevent(EventType
, kPhase
, 5);
18 // CHECK-NOT: call void @llvm.xray.typedevent(i64 {{.*}}, ptr{{.*}}, i64 5)
21 // CHECK-LABEL: @_Z21conditionalInstrumenti
22 [[clang::xray_always_instrument
]] void conditionalInstrument(int v
) {
23 auto TrueEventType
= 3;
24 auto UntrueEventType
= 4;
25 static constexpr char kTrue
[] = "true";
26 static constexpr char kUntrue
[] = "untrue";
28 __xray_typedevent(TrueEventType
, kTrue
, 4);
30 __xray_typedevent(UntrueEventType
, kUntrue
, 6);
32 // CHECK: call void @llvm.xray.typedevent(i64 {{.*}}, ptr{{.*}}, i64 4)
33 // CHECK: call void @llvm.xray.typedevent(i64 {{.*}}, ptr{{.*}}, i64 6)