1
- // ===- xray_interface.h -----------------------------------------*- C++ -* -===//
1
+ // ===- xray_interface.h -------------------------------------------------- -===//
2
2
//
3
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
4
// See https://llvm.org/LICENSE.txt for license information.
14
14
#ifndef XRAY_XRAY_INTERFACE_H
15
15
#define XRAY_XRAY_INTERFACE_H
16
16
17
+ #ifdef __cplusplus
17
18
#include < cstddef>
18
19
#include < cstdint>
20
+ #else
21
+ #include < stddef.h>
22
+ #include < stdint.h>
23
+ #endif
19
24
25
+ #ifdef __cplusplus
20
26
extern " C" {
27
+ #endif
21
28
22
29
// / Synchronize this with AsmPrinter::SledKind in LLVM.
23
30
enum XRayEntryType {
@@ -49,7 +56,7 @@ enum XRayEntryType {
49
56
// / achieved by marking them all with: __attribute__((xray_never_instrument))
50
57
// /
51
58
// / Returns 1 on success, 0 on error.
52
- extern int __xray_set_handler (void (*entry)(int32_t , XRayEntryType));
59
+ extern int __xray_set_handler (void (*entry)(int32_t , enum XRayEntryType));
53
60
54
61
// / This removes whatever the currently provided handler is. Returns 1 on
55
62
// / success, 0 on error.
@@ -60,15 +67,15 @@ extern int __xray_remove_handler();
60
67
// / start logging their subsequent affected function calls (if patched).
61
68
// /
62
69
// / Returns 1 on success, 0 on error.
63
- extern int __xray_set_handler_arg1 (void (*entry)(int32_t , XRayEntryType,
70
+ extern int __xray_set_handler_arg1 (void (*entry)(int32_t , enum XRayEntryType,
64
71
uint64_t ));
65
72
66
73
// / Disables the XRay handler used to log first arguments of function calls.
67
74
// / Returns 1 on success, 0 on error.
68
75
extern int __xray_remove_handler_arg1 ();
69
76
70
77
// / Provide a function to invoke when XRay encounters a custom event.
71
- extern int __xray_set_customevent_handler (void (*entry)(void *, std:: size_t ));
78
+ extern int __xray_set_customevent_handler (void (*entry)(void *, size_t ));
72
79
73
80
// / This removes whatever the currently provided custom event handler is.
74
81
// / Returns 1 on success, 0 on error.
@@ -95,39 +102,39 @@ enum XRayPatchingStatus {
95
102
96
103
// / This tells XRay to patch the instrumentation points in all currently loaded
97
104
// / objects. See XRayPatchingStatus for possible result values.
98
- extern XRayPatchingStatus __xray_patch ();
105
+ extern enum XRayPatchingStatus __xray_patch ();
99
106
100
107
// / This tells XRay to patch the instrumentation points in the given object.
101
108
// / See XRayPatchingStatus for possible result values.
102
- extern XRayPatchingStatus __xray_patch_object (int32_t ObjId);
109
+ extern enum XRayPatchingStatus __xray_patch_object (int32_t ObjId);
103
110
104
111
// / Reverses the effect of __xray_patch(). See XRayPatchingStatus for possible
105
112
// / result values.
106
- extern XRayPatchingStatus __xray_unpatch ();
113
+ extern enum XRayPatchingStatus __xray_unpatch ();
107
114
108
115
// / Reverses the effect of __xray_patch_object. See XRayPatchingStatus for
109
116
// / possible result values.
110
- extern XRayPatchingStatus __xray_unpatch_object (int32_t ObjId);
117
+ extern enum XRayPatchingStatus __xray_unpatch_object (int32_t ObjId);
111
118
112
119
// / This unpacks the given (packed) function id and patches
113
120
// / the corresponding function. See XRayPatchingStatus for possible
114
121
// / result values.
115
- extern XRayPatchingStatus __xray_patch_function (int32_t FuncId);
122
+ extern enum XRayPatchingStatus __xray_patch_function (int32_t FuncId);
116
123
117
124
// / This patches a specific function in the given object. See XRayPatchingStatus
118
125
// / for possible result values.
119
- extern XRayPatchingStatus __xray_patch_function_in_object (int32_t FuncId,
120
- int32_t ObjId);
126
+ extern enum XRayPatchingStatus __xray_patch_function_in_object (int32_t FuncId,
127
+ int32_t ObjId);
121
128
122
129
// / This unpacks the given (packed) function id and unpatches
123
130
// / the corresponding function. See XRayPatchingStatus for possible
124
131
// / result values.
125
- extern XRayPatchingStatus __xray_unpatch_function (int32_t FuncId);
132
+ extern enum XRayPatchingStatus __xray_unpatch_function (int32_t FuncId);
126
133
127
134
// / This unpatches a specific function in the given object.
128
135
// / See XRayPatchingStatus for possible result values.
129
- extern XRayPatchingStatus __xray_unpatch_function_in_object (int32_t FuncId,
130
- int32_t ObjId);
136
+ extern enum XRayPatchingStatus __xray_unpatch_function_in_object (int32_t FuncId,
137
+ int32_t ObjId);
131
138
132
139
// / This function unpacks the given (packed) function id and returns the address
133
140
// / of the corresponding function. We return 0 if we encounter any error, even
@@ -173,6 +180,8 @@ extern int32_t __xray_pack_id(int32_t FuncId, int32_t ObjId);
173
180
// / Calling __xray_init() more than once is safe across multiple threads.
174
181
extern void __xray_init ();
175
182
183
+ #ifdef __cplusplus
176
184
} // end extern "C"
185
+ #endif
177
186
178
187
#endif // XRAY_XRAY_INTERFACE_H
0 commit comments