2020#include " swift/SIL/SILInstruction.h"
2121#include " swift/SIL/SILLocation.h"
2222#include " swift/SIL/SILWitnessTable.h"
23+ #include " swift/SIL/SILDefaultWitnessTable.h"
2324#include " swift/SIL/SILVTable.h"
2425#include < stdbool.h>
2526#include < stddef.h>
@@ -31,10 +32,6 @@ struct BridgedInstruction;
3132struct OptionalBridgedOperand ;
3233struct OptionalBridgedSuccessor ;
3334
34- enum {
35- BridgedWitnessTableEntrySize = 5 * sizeof (uintptr_t )
36- };
37-
3835enum ChangeNotificationKind {
3936 instructionsChanged,
4037 callsChanged,
@@ -133,26 +130,6 @@ struct BridgedOperandArray {
133130 SwiftInt count;
134131};
135132
136- typedef struct {
137- const void * _Nonnull ptr;
138- } BridgedWitnessTable;
139-
140- typedef struct {
141- const void * _Nullable ptr;
142- } OptionalBridgedWitnessTable;
143-
144- typedef struct {
145- const void * _Nonnull ptr;
146- } BridgedDefaultWitnessTable;
147-
148- typedef struct {
149- const void * _Nullable ptr;
150- } OptionalBridgedDefaultWitnessTable;
151-
152- typedef struct {
153- const void * _Nonnull ptr;
154- } BridgedWitnessTableEntry;
155-
156133typedef struct {
157134 SwiftObject obj;
158135} BridgedFunction;
@@ -257,6 +234,59 @@ struct BridgedVTable {
257234 }
258235};
259236
237+ struct BridgedWitnessTableEntry {
238+ const swift::SILWitnessTable::Entry * _Nonnull entry;
239+
240+ SWIFT_IMPORT_UNSAFE
241+ std::string getDebugDescription () const ;
242+
243+ swift::SILWitnessTable::WitnessKind getKind () const {
244+ return entry->getKind ();
245+ }
246+
247+ SWIFT_IMPORT_UNSAFE
248+ OptionalBridgedFunction getMethodFunction () const {
249+ return {entry->getMethodWitness ().Witness };
250+ }
251+ };
252+
253+ struct BridgedWitnessTableEntryArray {
254+ BridgedWitnessTableEntry base;
255+ SwiftInt count;
256+ };
257+
258+ struct BridgedWitnessTable {
259+ const swift::SILWitnessTable * _Nonnull table;
260+
261+ std::string getDebugDescription () const ;
262+
263+ SWIFT_IMPORT_UNSAFE
264+ BridgedWitnessTableEntryArray getEntries () const {
265+ auto entries = table->getEntries ();
266+ return {{entries.data ()}, (SwiftInt)entries.size ()};
267+ }
268+ };
269+
270+ struct OptionalBridgedWitnessTable {
271+ const swift::SILWitnessTable * _Nullable table;
272+ };
273+
274+ struct BridgedDefaultWitnessTable {
275+ const swift::SILDefaultWitnessTable * _Nonnull table;
276+
277+ std::string getDebugDescription () const ;
278+
279+ SWIFT_IMPORT_UNSAFE
280+ BridgedWitnessTableEntryArray getEntries () const {
281+ auto entries = table->getEntries ();
282+ return {{entries.data ()}, (SwiftInt)entries.size ()};
283+ }
284+ };
285+
286+ struct OptionalBridgedDefaultWitnessTable {
287+ const swift::SILDefaultWitnessTable * _Nullable table;
288+ };
289+
260290typedef struct {
261291 const unsigned char * _Nullable message;
262292 SwiftInt position;
@@ -373,14 +403,6 @@ llvm::StringRef SILGlobalVariable_getName(BridgedGlobalVar global);
373403std::string SILGlobalVariable_debugDescription (BridgedGlobalVar global);
374404SwiftInt SILGlobalVariable_isLet (BridgedGlobalVar global);
375405
376- std::string SILWitnessTable_debugDescription (BridgedWitnessTable table);
377- BridgedArrayRef SILWitnessTable_getEntries (BridgedWitnessTable table);
378- std::string SILDefaultWitnessTable_debugDescription (BridgedDefaultWitnessTable table);
379- BridgedArrayRef SILDefaultWitnessTable_getEntries (BridgedDefaultWitnessTable table);
380- std::string SILWitnessTableEntry_debugDescription (BridgedWitnessTableEntry entry);
381- swift::SILWitnessTable::WitnessKind SILWitnessTableEntry_getKind (BridgedWitnessTableEntry entry);
382- OptionalBridgedFunction SILWitnessTableEntry_getMethodFunction (BridgedWitnessTableEntry entry);
383-
384406OptionalBridgedBasicBlock SILBasicBlock_next (BridgedBasicBlock block);
385407OptionalBridgedBasicBlock SILBasicBlock_previous (BridgedBasicBlock block);
386408BridgedFunction SILBasicBlock_getFunction (BridgedBasicBlock block);
0 commit comments