Skip to content

Commit c37dfd0

Browse files
committed
ASTBridging: Bridge swift::ExposureKind directly
1 parent 7818241 commit c37dfd0

File tree

4 files changed

+9
-20
lines changed

4 files changed

+9
-20
lines changed

include/swift/AST/ASTBridging.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,17 +1005,12 @@ BridgedExclusivityAttr BridgedExclusivityAttr_createParsed(
10051005
BridgedASTContext cContext, BridgedSourceLoc cAtLoc,
10061006
BridgedSourceRange cRange, BridgedExclusivityAttrMode cMode);
10071007

1008-
enum ENUM_EXTENSIBILITY_ATTR(closed) BridgedExposureKind {
1009-
BridgedExposureKindCxx,
1010-
BridgedExposureKindWasm,
1011-
};
1012-
10131008
SWIFT_NAME("BridgedExposeAttr.createParsed(_:atLoc:range:name:kind:)")
10141009
BridgedExposeAttr BridgedExposeAttr_createParsed(BridgedASTContext cContext,
10151010
BridgedSourceLoc cAtLoc,
10161011
BridgedSourceRange cRange,
10171012
BridgedStringRef cName,
1018-
BridgedExposureKind cKind);
1013+
swift::ExposureKind kind);
10191014

10201015
enum ENUM_EXTENSIBILITY_ATTR(closed) BridgedExternKind {
10211016
BridgedExternKindC,

include/swift/AST/AttrKind.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@ enum class ENUM_EXTENSIBILITY_ATTR(closed) EffectsKind : uint8_t {
9595
};
9696

9797
/// This enum represents the possible values of the @_expose attribute.
98-
enum class ExposureKind : uint8_t { Cxx, Wasm, Last_ExposureKind = Wasm };
98+
enum class ENUM_EXTENSIBILITY_ATTR(closed) ExposureKind : uint8_t {
99+
Cxx SWIFT_NAME("cxx"),
100+
Wasm SWIFT_NAME("wasm"),
101+
Last_ExposureKind = Wasm
102+
};
99103

100104
/// This enum represents the possible values of the @_extern attribute.
101105
enum class ExternKind: uint8_t {

lib/AST/Bridging/DeclAttributeBridging.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -328,24 +328,14 @@ BridgedExclusivityAttr BridgedExclusivityAttr_createParsed(
328328
ExclusivityAttr(cAtLoc.unbridged(), cRange.unbridged(), unbridged(cMode));
329329
}
330330

331-
static ExposureKind unbridged(BridgedExposureKind kind) {
332-
switch (kind) {
333-
case BridgedExposureKindCxx:
334-
return ExposureKind::Cxx;
335-
case BridgedExposureKindWasm:
336-
return ExposureKind::Wasm;
337-
}
338-
llvm_unreachable("unhandled enum value");
339-
}
340-
341331
BridgedExposeAttr BridgedExposeAttr_createParsed(BridgedASTContext cContext,
342332
BridgedSourceLoc cAtLoc,
343333
BridgedSourceRange cRange,
344334
BridgedStringRef cName,
345-
BridgedExposureKind cKind) {
335+
swift::ExposureKind kind) {
346336
return new (cContext.unbridged())
347337
ExposeAttr(cName.unbridged(), cAtLoc.unbridged(), cRange.unbridged(),
348-
unbridged(cKind), /*Implicit=*/false);
338+
kind, /*Implicit=*/false);
349339
}
350340

351341
static ExternKind unbridged(BridgedExternKind kind) {

lib/ASTGen/Sources/ASTGen/DeclAttrs.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ extension ASTGenVisitor {
907907
// FIXME: SwiftParser should parse the argument as LabeledExprListArguments
908908
return self.generateWithLabeledExprListArguments(attribute: node) { args in
909909
// Exposure kind.
910-
let kind: BridgedExposureKind? = self.generateConsumingPlainIdentifierAttrOption(args: &args) {
910+
let kind: swift.ExposureKind? = self.generateConsumingPlainIdentifierAttrOption(args: &args) {
911911
switch $0.rawText {
912912
case "Cxx":
913913
return .cxx

0 commit comments

Comments
 (0)