[clang] [compiler-rt] [XRay][Darwin] Enable XRay runtime on macOS (arm64/x86_64) (PR #196848)
Dan Blackwell via llvm-commits
llvm-commits at lists.llvm.org
Tue May 12 02:40:32 PDT 2026
================
@@ -0,0 +1,41 @@
+// Verify that custom XRay events work on macOS.
+
+// RUN: %clangxx_xray -fxray-instruction-threshold=1 %s -o %t
+// RUN: %run %t 2>&1 | FileCheck %s
+
+// REQUIRES: target={{(arm64|x86_64)-apple-.*}}
+
+#include "xray/xray_interface.h"
+#include <cstdio>
+#include <cstring>
+
+static int custom_event_count = 0;
+static char last_event[64] = {};
+
+[[clang::xray_never_instrument]] void handler(int32_t fid, XRayEntryType type) {
+}
+
+[[clang::xray_never_instrument]] void custom_handler(void *data, size_t size) {
+ ++custom_event_count;
+ if (size < sizeof(last_event)) {
+ memcpy(last_event, data, size);
+ last_event[size] = '\0';
----------------
DanBlackwell wrote:
Were you planning to do something with this value? There's no CHECK using it.
https://github.com/llvm/llvm-project/pull/196848
More information about the llvm-commits
mailing list