• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fxray-instrument -x c++ -std=c++11 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
2 
3 // CHECK-LABEL: @_Z16alwaysInstrumentv
alwaysInstrument()4 [[clang::xray_always_instrument]] void alwaysInstrument() {
5   static constexpr char kPhase[] = "instrument";
6   __xray_customevent(kPhase, 10);
7   // CHECK: call void @llvm.xray.customevent(i8*{{.*}}, i32 10)
8 }
9 
10 // CHECK-LABEL: @_Z15neverInstrumentv
neverInstrument()11 [[clang::xray_never_instrument]] void neverInstrument() {
12   static constexpr char kPhase[] = "never";
13   __xray_customevent(kPhase, 5);
14   // CHECK-NOT: call void @llvm.xray.customevent(i8*{{.*}}, i32 5)
15 }
16 
17 // CHECK-LABEL: @_Z21conditionalInstrumenti
conditionalInstrument(int v)18 [[clang::xray_always_instrument]] void conditionalInstrument(int v) {
19   static constexpr char kTrue[] = "true";
20   static constexpr char kUntrue[] = "untrue";
21   if (v % 2)
22     __xray_customevent(kTrue, 4);
23   else
24     __xray_customevent(kUntrue, 6);
25 
26   // CHECK: call void @llvm.xray.customevent(i8*{{.*}}, i32 4)
27   // CHECK: call void @llvm.xray.customevent(i8*{{.*}}, i32 6)
28 }
29