@@ -28,8 +28,6 @@ SWIFT_BEGIN_NULLABILITY_ANNOTATIONS
28
28
namespace swift {
29
29
class DiagnosticArgument ;
30
30
class DiagnosticEngine ;
31
- class NominalTypeDecl ;
32
- class VarDecl ;
33
31
}
34
32
35
33
// ===----------------------------------------------------------------------===//
@@ -60,22 +58,19 @@ bool ASTContext_langOptsHasFeature(BridgedASTContext cContext,
60
58
// AST nodes
61
59
// ===----------------------------------------------------------------------===//
62
60
61
+ // Forward declare the underlying AST node type for each wrapper.
62
+ namespace swift {
63
+ #define AST_BRIDGING_WRAPPER (Name ) class Name ;
64
+ #include " swift/AST/ASTBridgingWrappers.def"
65
+ } // end namespace swift
66
+
63
67
// Define the bridging wrappers for each AST node.
64
- #define AST_BRIDGING_WRAPPER_NONNULL (Name ) \
65
- typedef struct { \
66
- void *_Nonnull raw; \
67
- } Bridged##Name;
68
-
69
- // For nullable nodes, define both a nullable and non-null variant.
70
- #define AST_BRIDGING_WRAPPER_NULLABLE (Name ) \
71
- typedef struct { \
72
- void *_Nullable raw; \
73
- } BridgedNullable##Name; \
74
- \
75
- typedef struct { \
76
- void *_Nonnull raw; \
77
- } Bridged##Name;
68
+ #define AST_BRIDGING_WRAPPER (Name ) BRIDGING_WRAPPER_NONNULL(Name)
69
+ #include " swift/AST/ASTBridgingWrappers.def"
78
70
71
+ // For nullable nodes, also define a nullable variant.
72
+ #define AST_BRIDGING_WRAPPER_NULLABLE (Name ) BRIDGING_WRAPPER_NULLABLE(Name)
73
+ #define AST_BRIDGING_WRAPPER_NONNULL (Name )
79
74
#include " swift/AST/ASTBridgingWrappers.def"
80
75
81
76
// Declare `.asDecl` on each BridgedXXXDecl type, which upcasts a wrapper for
@@ -219,17 +214,6 @@ void Diagnostic_finish(BridgedDiagnostic cDiag);
219
214
// NominalTypeDecl
220
215
// ===----------------------------------------------------------------------===//
221
216
222
- class BridgedNominalTypeDecl {
223
- swift::NominalTypeDecl * _Nonnull Ptr;
224
-
225
- public:
226
- #ifdef USED_IN_CPP_SOURCE
227
- BridgedNominalTypeDecl (swift::NominalTypeDecl * _Nonnull ptr) : Ptr(ptr) {}
228
-
229
- swift::NominalTypeDecl * _Nonnull get () const { return Ptr; }
230
- #endif
231
- };
232
-
233
217
SWIFT_NAME (" BridgedNominalTypeDecl.getName(self:)" )
234
218
BRIDGED_INLINE
235
219
BridgedStringRef BridgedNominalTypeDecl_getName(BridgedNominalTypeDecl decl);
@@ -250,32 +234,10 @@ void NominalTypeDecl_setParsedMembers(BridgedNominalTypeDecl decl,
250
234
// VarDecl
251
235
// ===----------------------------------------------------------------------===//
252
236
253
- class BridgedVarDecl {
254
- swift::VarDecl * _Nonnull Ptr;
255
-
256
- public:
257
- #ifdef USED_IN_CPP_SOURCE
258
- BridgedVarDecl (swift::VarDecl * _Nonnull ptr) : Ptr(ptr) {}
259
-
260
- swift::VarDecl * _Nonnull get () const { return Ptr; }
261
- #endif
262
- };
263
-
264
237
SWIFT_NAME (" BridgedVarDecl.getUserFacingName(self:)" )
265
238
BRIDGED_INLINE
266
239
BridgedStringRef BridgedVarDecl_getUserFacingName(BridgedVarDecl decl);
267
240
268
- class BridgedNullableVarDecl {
269
- swift::VarDecl * _Nullable Ptr;
270
-
271
- public:
272
- #ifdef USED_IN_CPP_SOURCE
273
- BridgedNullableVarDecl (swift::VarDecl * _Nullable ptr) : Ptr(ptr) {}
274
-
275
- swift::VarDecl * _Nullable get () const { return Ptr; }
276
- #endif
277
- };
278
-
279
241
// ===----------------------------------------------------------------------===//
280
242
// Misc
281
243
// ===----------------------------------------------------------------------===//
0 commit comments