13
13
#ifndef SWIFT_PLUGINSERVER_PLUGINSERVER_H
14
14
#define SWIFT_PLUGINSERVER_PLUGINSERVER_H
15
15
16
- // NOTE: Partially ported from SwiftShim's SwiftStdint.h. We cannot include
17
- // that header here because it belongs to the runtime, but we need the same
18
- // logic for interoperability with Swift code in the compiler itself.
19
- // stdint.h is provided by Clang, but it dispatches to libc's stdint.h. As a
20
- // result, using stdint.h here would pull in Darwin module (which includes
21
- // libc). This creates a dependency cycle, so we can't use stdint.h in
22
- // SwiftShims.
23
- // On Linux, the story is different. We get the error message
24
- // "/usr/include/x86_64-linux-gnu/sys/types.h:146:10: error: 'stddef.h' file not
25
- // found"
26
- // This is a known Clang/Ubuntu bug.
27
-
28
- // Clang has been defining __INTxx_TYPE__ macros for a long time.
29
- // __UINTxx_TYPE__ are defined only since Clang 3.5.
30
- #if defined(_MSC_VER ) && !defined(__clang__ )
31
- typedef __int64 __swiftc_int64_t ;
32
- typedef unsigned __int64 __swiftc_uint64_t ;
33
- typedef int __swiftc_int32_t ;
34
- typedef unsigned int __swiftc_uint32_t ;
35
- #elif !defined(__APPLE__ ) && !defined(__linux__ ) && !defined(__OpenBSD__ ) && !defined(__wasi__ )
36
- #include <stdint.h>
37
- typedef int64_t __swiftc_int64_t ;
38
- typedef uint64_t __swiftc_uint64_t ;
39
- typedef int32_t __swiftc_int32_t ;
40
- typedef uint32_t __swiftc_uint32_t ;
41
- typedef intptr_t __swiftc_intptr_t ;
42
- typedef uintptr_t __swiftc_uintptr_t ;
43
- #else
44
- typedef __INT64_TYPE__ __swiftc_int64_t ;
45
- #ifdef __UINT64_TYPE__
46
- typedef __UINT64_TYPE__ __swiftc_uint64_t ;
47
- #else
48
- typedef unsigned __INT64_TYPE__ __swiftc_uint64_t ;
49
- #endif
50
-
51
- typedef __INT32_TYPE__ __swiftc_int32_t ;
52
- #ifdef __UINT32_TYPE__
53
- typedef __UINT32_TYPE__ __swiftc_uint32_t ;
54
- #else
55
- typedef unsigned __INT32_TYPE__ __swiftc_uint32_t ;
56
- #endif
57
- #endif
58
-
59
- #define __swiftc_join3 (a ,b ,c ) a ## b ## c
60
-
61
- #define __swiftc_intn_t (n ) __swiftc_join3(__swiftc_int, n, _t)
62
- #define __swiftc_uintn_t (n ) __swiftc_join3(__swiftc_uint, n, _t)
63
-
64
- #if defined(_MSC_VER ) && !defined(__clang__ )
65
- #if defined(_WIN64 )
66
- typedef __swiftc_int64_t SwiftInt ;
67
- typedef __swiftc_uint64_t SwiftUInt ;
68
- #elif defined(_WIN32 )
69
- typedef __swiftc_int32_t SwiftInt ;
70
- typedef __swiftc_uint32_t SwiftUInt ;
71
- #else
72
- #error unknown windows pointer width
73
- #endif
74
- #else
75
- typedef __swiftc_intn_t (__INTPTR_WIDTH__ ) SwiftInt ;
76
- typedef __swiftc_uintn_t (__INTPTR_WIDTH__ ) SwiftUInt ;
77
- #endif
16
+ #include <stddef.h>
78
17
79
18
#ifdef __cplusplus
80
19
extern "C" {
@@ -92,10 +31,11 @@ const void *PluginServer_createConnection(const char **errorMessage);
92
31
void PluginServer_destroyConnection (const void * connHandle );
93
32
94
33
/// Read bytes from the IPC communication handle.
95
- SwiftInt PluginServer_read (const void * connHandle , void * data , SwiftUInt nbyte );
34
+ ptrdiff_t PluginServer_read (const void * connHandle , void * data , size_t nbyte );
96
35
97
36
/// Write bytes to the IPC communication handle.
98
- SwiftInt PluginServer_write (const void * connHandle , const void * data , SwiftUInt nbyte );
37
+ ptrdiff_t PluginServer_write (const void * connHandle , const void * data ,
38
+ size_t nbyte );
99
39
100
40
//===----------------------------------------------------------------------===//
101
41
// Dynamic link
0 commit comments