20
20
#ifndef SWIFT_REFLECTION_SWIFT_REFLECTION_H
21
21
#define SWIFT_REFLECTION_SWIFT_REFLECTION_H
22
22
23
+ #include " Platform.h"
23
24
#include " MemoryReaderInterface.h"
24
25
#include " SwiftRemoteMirrorTypes.h"
25
26
@@ -37,41 +38,42 @@ extern "C" {
37
38
#endif
38
39
39
40
// / Get the metadata version supported by the Remote Mirror library.
40
- uint16_t
41
- swift_reflection_getSupportedMetadataVersion ();
41
+ SWIFT_REMOTE_MIRROR_LINKAGE
42
+ uint16_t swift_reflection_getSupportedMetadataVersion ();
42
43
43
44
// / \returns An opaque reflection context.
45
+ SWIFT_REMOTE_MIRROR_LINKAGE
44
46
SwiftReflectionContextRef
45
- swift_reflection_createReflectionContext (
46
- void *ReaderContext,
47
- PointerSizeFunction getPointerSize,
48
- SizeSizeFunction getSizeSize,
49
- ReadBytesFunction readBytes,
50
- GetStringLengthFunction getStringLength,
51
- GetSymbolAddressFunction getSymbolAddress);
47
+ swift_reflection_createReflectionContext (void *ReaderContext,
48
+ PointerSizeFunction getPointerSize,
49
+ SizeSizeFunction getSizeSize,
50
+ ReadBytesFunction readBytes,
51
+ GetStringLengthFunction getStringLength,
52
+ GetSymbolAddressFunction getSymbolAddress);
52
53
53
54
// / Destroys an opaque reflection context.
55
+ SWIFT_REMOTE_MIRROR_LINKAGE
54
56
void
55
57
swift_reflection_destroyReflectionContext (SwiftReflectionContextRef Context);
56
58
57
59
// / Add reflection sections for a loaded Swift image.
58
- void
59
- swift_reflection_addReflectionInfo (SwiftReflectionContextRef ContextRef,
60
- swift_reflection_info_t Info);
61
-
60
+ SWIFT_REMOTE_MIRROR_LINKAGE
61
+ void swift_reflection_addReflectionInfo (SwiftReflectionContextRef ContextRef,
62
+ swift_reflection_info_t Info);
62
63
63
64
// / Returns a boolean indicating if the isa mask was successfully
64
65
// / read, in which case it is stored in the isaMask out parameter.
65
- int
66
- swift_reflection_readIsaMask (SwiftReflectionContextRef ContextRef,
67
- uintptr_t *outIsaMask);
66
+ SWIFT_REMOTE_MIRROR_LINKAGE
67
+ int swift_reflection_readIsaMask (SwiftReflectionContextRef ContextRef,
68
+ uintptr_t *outIsaMask);
68
69
69
70
// / Returns an opaque type reference for a metadata pointer, or
70
71
// / NULL if one can't be constructed.
71
72
// /
72
73
// / This function loses information; in particular, passing the
73
74
// / result to swift_reflection_infoForTypeRef() will not give
74
75
// / the same result as calling swift_reflection_infoForMetadata().
76
+ SWIFT_REMOTE_MIRROR_LINKAGE
75
77
swift_typeref_t
76
78
swift_reflection_typeRefForMetadata (SwiftReflectionContextRef ContextRef,
77
79
uintptr_t Metadata);
@@ -82,59 +84,66 @@ swift_reflection_typeRefForMetadata(SwiftReflectionContextRef ContextRef,
82
84
// / This function loses information; in particular, passing the
83
85
// / result to swift_reflection_infoForTypeRef() will not give
84
86
// / the same result as calling swift_reflection_infoForInstance().
87
+ SWIFT_REMOTE_MIRROR_LINKAGE
85
88
swift_typeref_t
86
89
swift_reflection_typeRefForInstance (SwiftReflectionContextRef ContextRef,
87
90
uintptr_t Object);
88
91
89
92
// / Returns a typeref from a mangled type name string.
93
+ SWIFT_REMOTE_MIRROR_LINKAGE
90
94
swift_typeref_t
91
95
swift_reflection_typeRefForMangledTypeName (SwiftReflectionContextRef ContextRef,
92
96
const char *MangledName,
93
97
uint64_t Length);
94
98
95
99
// / Returns a structure describing the layout of a value of a typeref.
96
100
// / For classes, this returns the reference value itself.
101
+ SWIFT_REMOTE_MIRROR_LINKAGE
97
102
swift_typeinfo_t
98
103
swift_reflection_infoForTypeRef (SwiftReflectionContextRef ContextRef,
99
104
swift_typeref_t OpaqueTypeRef);
100
105
101
106
// / Returns the information about a child field of a value by index.
107
+ SWIFT_REMOTE_MIRROR_LINKAGE
102
108
swift_childinfo_t
103
109
swift_reflection_childOfTypeRef (SwiftReflectionContextRef ContextRef,
104
- swift_typeref_t OpaqueTypeRef,
105
- unsigned Index);
110
+ swift_typeref_t OpaqueTypeRef, unsigned Index);
106
111
107
112
// / Returns a structure describing the layout of a class instance
108
113
// / from the isa pointer of a class.
114
+ SWIFT_REMOTE_MIRROR_LINKAGE
109
115
swift_typeinfo_t
110
116
swift_reflection_infoForMetadata (SwiftReflectionContextRef ContextRef,
111
117
uintptr_t Metadata);
112
118
113
119
// / Returns the information about a child field of a class instance
114
120
// / by index.
121
+ SWIFT_REMOTE_MIRROR_LINKAGE
115
122
swift_childinfo_t
116
123
swift_reflection_childOfMetadata (SwiftReflectionContextRef ContextRef,
117
- uintptr_t Metadata,
118
- unsigned Index);
124
+ uintptr_t Metadata, unsigned Index);
119
125
120
126
// / Returns a structure describing the layout of a class or closure
121
127
// / context instance, from a pointer to the object itself.
128
+ SWIFT_REMOTE_MIRROR_LINKAGE
122
129
swift_typeinfo_t
123
130
swift_reflection_infoForInstance (SwiftReflectionContextRef ContextRef,
124
131
uintptr_t Object);
125
132
126
133
// / Returns the information about a child field of a class or closure
127
134
// / context instance.
135
+ SWIFT_REMOTE_MIRROR_LINKAGE
128
136
swift_childinfo_t
129
137
swift_reflection_childOfInstance (SwiftReflectionContextRef ContextRef,
130
- uintptr_t Object,
131
- unsigned Index);
138
+ uintptr_t Object, unsigned Index);
132
139
133
140
// / Returns the number of generic arguments of a typeref.
141
+ SWIFT_REMOTE_MIRROR_LINKAGE
134
142
unsigned
135
143
swift_reflection_genericArgumentCountOfTypeRef (swift_typeref_t OpaqueTypeRef);
136
144
137
145
// / Returns a fully instantiated typeref for a generic argument by index.
146
+ SWIFT_REMOTE_MIRROR_LINKAGE
138
147
swift_typeref_t
139
148
swift_reflection_genericArgumentOfTypeRef (swift_typeref_t OpaqueTypeRef,
140
149
unsigned Index);
@@ -158,24 +167,29 @@ swift_reflection_genericArgumentOfTypeRef(swift_typeref_t OpaqueTypeRef,
158
167
// /
159
168
// / Returns true if InstanceTypeRef and StartOfInstanceData contain valid
160
169
// / valid values.
170
+ SWIFT_REMOTE_MIRROR_LINKAGE
161
171
int swift_reflection_projectExistential (SwiftReflectionContextRef ContextRef,
162
172
swift_addr_t ExistentialAddress,
163
173
swift_typeref_t ExistentialTypeRef,
164
174
swift_typeref_t *OutInstanceTypeRef,
165
175
swift_addr_t *OutStartOfInstanceData);
166
176
167
177
// / Dump a brief description of the typeref as a tree to stderr.
178
+ SWIFT_REMOTE_MIRROR_LINKAGE
168
179
void swift_reflection_dumpTypeRef (swift_typeref_t OpaqueTypeRef);
169
180
170
181
// / Dump information about the layout for a typeref.
182
+ SWIFT_REMOTE_MIRROR_LINKAGE
171
183
void swift_reflection_dumpInfoForTypeRef (SwiftReflectionContextRef ContextRef,
172
184
swift_typeref_t OpaqueTypeRef);
173
185
174
186
// / Dump information about the layout of a class instance from its isa pointer.
187
+ SWIFT_REMOTE_MIRROR_LINKAGE
175
188
void swift_reflection_dumpInfoForMetadata (SwiftReflectionContextRef ContextRef,
176
189
uintptr_t Metadata);
177
190
178
191
// / Dump information about the layout of a class or closure context instance.
192
+ SWIFT_REMOTE_MIRROR_LINKAGE
179
193
void swift_reflection_dumpInfoForInstance (SwiftReflectionContextRef ContextRef,
180
194
uintptr_t Object);
181
195
@@ -186,10 +200,9 @@ void swift_reflection_dumpInfoForInstance(SwiftReflectionContextRef ContextRef,
186
200
// /
187
201
// / Returns the length of the demangled string this function tried to copy
188
202
// / into `OutDemangledName`.
189
- size_t swift_reflection_demangle (const char *MangledName,
190
- size_t Length,
191
- char *OutDemangledName,
192
- size_t MaxLength);
203
+ SWIFT_REMOTE_MIRROR_LINKAGE
204
+ size_t swift_reflection_demangle (const char *MangledName, size_t Length,
205
+ char *OutDemangledName, size_t MaxLength);
193
206
194
207
#ifdef __cplusplus
195
208
} // extern "C"
0 commit comments