Skip to content

Commit 0412d56

Browse files
authored
Revert "[compiler-rt][XRay] Make xray_interface.h C compliant (#140068)"
This reverts commit 80da58d.
1 parent 7569de5 commit 0412d56

File tree

2 files changed

+14
-74
lines changed

2 files changed

+14
-74
lines changed

compiler-rt/include/xray/xray_interface.h

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===- xray_interface.h ---------------------------------------------------===//
1+
//===- xray_interface.h -----------------------------------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -14,17 +14,10 @@
1414
#ifndef XRAY_XRAY_INTERFACE_H
1515
#define XRAY_XRAY_INTERFACE_H
1616

17-
#ifdef __cplusplus
1817
#include <cstddef>
1918
#include <cstdint>
20-
#else
21-
#include <stddef.h>
22-
#include <stdint.h>
23-
#endif
2419

25-
#ifdef __cplusplus
2620
extern "C" {
27-
#endif
2821

2922
/// Synchronize this with AsmPrinter::SledKind in LLVM.
3023
enum XRayEntryType {
@@ -56,7 +49,7 @@ enum XRayEntryType {
5649
/// achieved by marking them all with: __attribute__((xray_never_instrument))
5750
///
5851
/// Returns 1 on success, 0 on error.
59-
extern int __xray_set_handler(void (*entry)(int32_t, enum XRayEntryType));
52+
extern int __xray_set_handler(void (*entry)(int32_t, XRayEntryType));
6053

6154
/// This removes whatever the currently provided handler is. Returns 1 on
6255
/// success, 0 on error.
@@ -67,15 +60,15 @@ extern int __xray_remove_handler();
6760
/// start logging their subsequent affected function calls (if patched).
6861
///
6962
/// Returns 1 on success, 0 on error.
70-
extern int __xray_set_handler_arg1(void (*entry)(int32_t, enum XRayEntryType,
63+
extern int __xray_set_handler_arg1(void (*entry)(int32_t, XRayEntryType,
7164
uint64_t));
7265

7366
/// Disables the XRay handler used to log first arguments of function calls.
7467
/// Returns 1 on success, 0 on error.
7568
extern int __xray_remove_handler_arg1();
7669

7770
/// Provide a function to invoke when XRay encounters a custom event.
78-
extern int __xray_set_customevent_handler(void (*entry)(void *, size_t));
71+
extern int __xray_set_customevent_handler(void (*entry)(void *, std::size_t));
7972

8073
/// This removes whatever the currently provided custom event handler is.
8174
/// Returns 1 on success, 0 on error.
@@ -102,39 +95,39 @@ enum XRayPatchingStatus {
10295

10396
/// This tells XRay to patch the instrumentation points in all currently loaded
10497
/// objects. See XRayPatchingStatus for possible result values.
105-
extern enum XRayPatchingStatus __xray_patch();
98+
extern XRayPatchingStatus __xray_patch();
10699

107100
/// This tells XRay to patch the instrumentation points in the given object.
108101
/// See XRayPatchingStatus for possible result values.
109-
extern enum XRayPatchingStatus __xray_patch_object(int32_t ObjId);
102+
extern XRayPatchingStatus __xray_patch_object(int32_t ObjId);
110103

111104
/// Reverses the effect of __xray_patch(). See XRayPatchingStatus for possible
112105
/// result values.
113-
extern enum XRayPatchingStatus __xray_unpatch();
106+
extern XRayPatchingStatus __xray_unpatch();
114107

115108
/// Reverses the effect of __xray_patch_object. See XRayPatchingStatus for
116109
/// possible result values.
117-
extern enum XRayPatchingStatus __xray_unpatch_object(int32_t ObjId);
110+
extern XRayPatchingStatus __xray_unpatch_object(int32_t ObjId);
118111

119112
/// This unpacks the given (packed) function id and patches
120113
/// the corresponding function. See XRayPatchingStatus for possible
121114
/// result values.
122-
extern enum XRayPatchingStatus __xray_patch_function(int32_t FuncId);
115+
extern XRayPatchingStatus __xray_patch_function(int32_t FuncId);
123116

124117
/// This patches a specific function in the given object. See XRayPatchingStatus
125118
/// for possible result values.
126-
extern enum XRayPatchingStatus __xray_patch_function_in_object(int32_t FuncId,
127-
int32_t ObjId);
119+
extern XRayPatchingStatus __xray_patch_function_in_object(int32_t FuncId,
120+
int32_t ObjId);
128121

129122
/// This unpacks the given (packed) function id and unpatches
130123
/// the corresponding function. See XRayPatchingStatus for possible
131124
/// result values.
132-
extern enum XRayPatchingStatus __xray_unpatch_function(int32_t FuncId);
125+
extern XRayPatchingStatus __xray_unpatch_function(int32_t FuncId);
133126

134127
/// This unpatches a specific function in the given object.
135128
/// See XRayPatchingStatus for possible result values.
136-
extern enum XRayPatchingStatus __xray_unpatch_function_in_object(int32_t FuncId,
137-
int32_t ObjId);
129+
extern XRayPatchingStatus __xray_unpatch_function_in_object(int32_t FuncId,
130+
int32_t ObjId);
138131

139132
/// This function unpacks the given (packed) function id and returns the address
140133
/// of the corresponding function. We return 0 if we encounter any error, even
@@ -180,8 +173,6 @@ extern int32_t __xray_pack_id(int32_t FuncId, int32_t ObjId);
180173
/// Calling __xray_init() more than once is safe across multiple threads.
181174
extern void __xray_init();
182175

183-
#ifdef __cplusplus
184176
} // end extern "C"
185-
#endif
186177

187178
#endif // XRAY_XRAY_INTERFACE_H

compiler-rt/test/xray/TestCases/Posix/patching-unpatching.c

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)