Skip to content

Commit b2b79f3

Browse files
committed
ASTBridging: Bridge swift::InlineKind directly
1 parent 6527be5 commit b2b79f3

File tree

4 files changed

+7
-22
lines changed

4 files changed

+7
-22
lines changed

include/swift/AST/ASTBridging.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,16 +1037,11 @@ BridgedImplementsAttr BridgedImplementsAttr_createParsed(
10371037
BridgedSourceRange cRange, BridgedTypeRepr cProtocolType,
10381038
BridgedDeclNameRef cMemberName, BridgedDeclNameLoc cMemberNameLoc);
10391039

1040-
enum ENUM_EXTENSIBILITY_ATTR(closed) BridgedInlineKind {
1041-
BridgedInlineKindNever,
1042-
BridgedInlineKindAlways,
1043-
};
1044-
10451040
SWIFT_NAME("BridgedInlineAttr.createParsed(_:atLoc:range:kind:)")
10461041
BridgedInlineAttr BridgedInlineAttr_createParsed(BridgedASTContext cContext,
10471042
BridgedSourceLoc cAtLoc,
10481043
BridgedSourceRange cRange,
1049-
BridgedInlineKind cKind);
1044+
swift::InlineKind kind);
10501045

10511046
enum ENUM_EXTENSIBILITY_ATTR(closed) BridgedParsedLifetimeDependenceKind {
10521047
BridgedParsedLifetimeDependenceKindDefault,

include/swift/AST/AttrKind.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ enum class ENUM_EXTENSIBILITY_ATTR(closed) AccessLevel : uint8_t {
7575
SWIFT_UNAVAILABLE("Unavailable in Swift")
7676
llvm::StringRef getAccessLevelSpelling(AccessLevel value);
7777

78-
enum class InlineKind : uint8_t {
79-
Never = 0,
80-
Always = 1,
78+
enum class ENUM_EXTENSIBILITY_ATTR(closed) InlineKind : uint8_t {
79+
Never SWIFT_NAME("never") = 0,
80+
Always SWIFT_NAME("always") = 1,
8181
Last_InlineKind = Always
8282
};
8383

lib/AST/Bridging/DeclAttributeBridging.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -387,22 +387,12 @@ BridgedImplementsAttr BridgedImplementsAttr_createParsed(
387387
cMemberNameLoc.unbridged());
388388
}
389389

390-
static InlineKind unbridged(BridgedInlineKind kind) {
391-
switch (kind) {
392-
case BridgedInlineKindNever:
393-
return InlineKind::Never;
394-
case BridgedInlineKindAlways:
395-
return InlineKind::Always;
396-
}
397-
llvm_unreachable("unhandled enum value");
398-
}
399-
400390
BridgedInlineAttr BridgedInlineAttr_createParsed(BridgedASTContext cContext,
401391
BridgedSourceLoc cAtLoc,
402392
BridgedSourceRange cRange,
403-
BridgedInlineKind cKind) {
393+
swift::InlineKind kind) {
404394
return new (cContext.unbridged())
405-
InlineAttr(cAtLoc.unbridged(), cRange.unbridged(), unbridged(cKind));
395+
InlineAttr(cAtLoc.unbridged(), cRange.unbridged(), kind);
406396
}
407397

408398
static swift::ParsedLifetimeDependenceKind

lib/ASTGen/Sources/ASTGen/DeclAttrs.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ extension ASTGenVisitor {
10471047
/// @inline(__always)
10481048
/// ```
10491049
func generateInlineAttr(attribute node: AttributeSyntax) -> BridgedInlineAttr? {
1050-
let kind: BridgedInlineKind? = self.generateSingleAttrOption(
1050+
let kind: swift.InlineKind? = self.generateSingleAttrOption(
10511051
attribute: node,
10521052
{
10531053
switch $0.rawText {

0 commit comments

Comments
 (0)