[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / xray-customevent.cpp
blobc64cbbd7c4236f1813add9463d8bedf6682260d2
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 static constexpr char kPhase[] = "instrument";
6 __xray_customevent(kPhase, 10);
7 // CHECK: call void @llvm.xray.customevent(ptr{{.*}}, i64 10)
10 // CHECK-LABEL: @_Z15neverInstrumentv
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(
17 // CHECK-LABEL: @_Z21conditionalInstrumenti
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);
26 // CHECK: call void @llvm.xray.customevent(ptr{{.*}}, i64 4)
27 // CHECK: call void @llvm.xray.customevent(ptr{{.*}}, i64 6)