@@ -28,8 +28,6 @@ SWIFT_BEGIN_NULLABILITY_ANNOTATIONS
2828namespace swift {
2929 class DiagnosticArgument ;
3030 class DiagnosticEngine ;
31- class NominalTypeDecl ;
32- class VarDecl ;
3331}
3432
3533// ===----------------------------------------------------------------------===//
@@ -60,22 +58,19 @@ bool ASTContext_langOptsHasFeature(BridgedASTContext cContext,
6058// AST nodes
6159// ===----------------------------------------------------------------------===//
6260
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+
6367// 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"
7870
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 )
7974#include " swift/AST/ASTBridgingWrappers.def"
8075
8176// Declare `.asDecl` on each BridgedXXXDecl type, which upcasts a wrapper for
@@ -219,17 +214,6 @@ void Diagnostic_finish(BridgedDiagnostic cDiag);
219214// NominalTypeDecl
220215// ===----------------------------------------------------------------------===//
221216
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-
233217SWIFT_NAME (" BridgedNominalTypeDecl.getName(self:)" )
234218BRIDGED_INLINE
235219BridgedStringRef BridgedNominalTypeDecl_getName(BridgedNominalTypeDecl decl);
@@ -250,32 +234,10 @@ void NominalTypeDecl_setParsedMembers(BridgedNominalTypeDecl decl,
250234// VarDecl
251235// ===----------------------------------------------------------------------===//
252236
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-
264237SWIFT_NAME (" BridgedVarDecl.getUserFacingName(self:)" )
265238BRIDGED_INLINE
266239BridgedStringRef BridgedVarDecl_getUserFacingName(BridgedVarDecl decl);
267240
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-
279241// ===----------------------------------------------------------------------===//
280242// Misc
281243// ===----------------------------------------------------------------------===//
0 commit comments