Skip to content

Commit 28b7fd7

Browse files
committed
[AST] Abstract away a couple of bridging wrappers
Move these into ASTBridgingWrappers.def.
1 parent 2ac0860 commit 28b7fd7

File tree

3 files changed

+5
-16
lines changed

3 files changed

+5
-16
lines changed

include/swift/AST/ASTBridging.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,6 @@ typedef enum ENUM_EXTENSIBILITY_ATTR(open) BridgedDiagID : uint32_t {
125125
#include "swift/AST/DiagnosticsAll.def"
126126
} BridgedDiagID;
127127

128-
BRIDGING_WRAPPER_NONNULL(DiagnosticEngine)
129-
BRIDGING_WRAPPER_NULLABLE(DiagnosticEngine)
130-
131128
class BridgedDiagnosticArgument {
132129
int64_t storage[3];
133130

@@ -367,10 +364,6 @@ typedef struct BridgedASTNode {
367364
ASTNodeKind kind;
368365
} BridgedASTNode;
369366

370-
typedef struct BridgedTypeAttributes {
371-
void *_Nonnull raw;
372-
} BridgedTypeAttributes;
373-
374367
struct BridgedIdentifierAndSourceLoc {
375368
BridgedIdentifier name;
376369
BridgedSourceLoc nameLoc;

include/swift/AST/ASTBridgingWrappers.def

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ AST_BRIDGING_WRAPPER_NULLABLE(TypeRepr)
6767
AST_BRIDGING_WRAPPER_NULLABLE(GenericParamList)
6868
AST_BRIDGING_WRAPPER_NULLABLE(TrailingWhereClause)
6969
AST_BRIDGING_WRAPPER_NULLABLE(ParameterList)
70+
AST_BRIDGING_WRAPPER_NONNULL(TypeAttributes)
71+
72+
// Non-AST types to generate wrappers for.
73+
AST_BRIDGING_WRAPPER_NULLABLE(DiagnosticEngine)
7074

7175
#undef AST_BRIDGING_WRAPPER_NONNULL
7276
#undef AST_BRIDGING_WRAPPER_NULLABLE

lib/AST/ASTBridging.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,6 @@ static inline BridgedDiagnosticImpl *unbridged(BridgedDiagnostic cDiag) {
233233
return static_cast<BridgedDiagnosticImpl *>(cDiag.raw);
234234
}
235235

236-
static inline DiagnosticEngine &unbridged(BridgedDiagnosticEngine cEngine) {
237-
return *cEngine.get();
238-
}
239-
240-
static inline TypeAttributes *unbridged(BridgedTypeAttributes cAttributes) {
241-
return static_cast<TypeAttributes *>(cAttributes.raw);
242-
}
243-
244236
static TypeAttrKind unbridged(BridgedTypeAttrKind kind) {
245237
switch (kind) {
246238
#define TYPE_ATTR(X) \
@@ -281,7 +273,7 @@ BridgedDiagnostic Diagnostic_create(BridgedSourceLoc cLoc,
281273
break;
282274
}
283275

284-
DiagnosticEngine &diags = unbridged(cDiags);
276+
DiagnosticEngine &diags = *unbridged(cDiags);
285277
return {new BridgedDiagnosticImpl{diags.diagnose(loc, diagID, text), {text}}};
286278
}
287279

0 commit comments

Comments
 (0)