Skip to content

Commit 84875d1

Browse files
committed
[ASTGen] Bridge ASTContext.Id_x
1 parent 0ced6e0 commit 84875d1

File tree

6 files changed

+12
-23
lines changed

6 files changed

+12
-23
lines changed

include/swift/AST/ASTBridging.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,6 @@ inline const void *_Nullable BridgedIdentifier_raw(BridgedIdentifier ident) {
116116
return ident.Raw;
117117
}
118118

119-
SWIFT_NAME("getter:BridgedIdentifier.str(self:)")
120-
BRIDGED_INLINE BridgedStringRef
121-
BridgedIdentifier_getStr(BridgedIdentifier ident);
122-
123119
SWIFT_NAME("getter:BridgedIdentifier.isOperator(self:)")
124120
BRIDGED_INLINE bool BridgedIdentifier_isOperator(const BridgedIdentifier);
125121

@@ -227,6 +223,11 @@ class BridgedASTContext {
227223
BRIDGED_INLINE swift::ASTContext &unbridged() const;
228224
};
229225

226+
#define IDENTIFIER_WITH_NAME(Name, _) \
227+
SWIFT_NAME("getter:BridgedASTContext.id_" #Name "(self:)") \
228+
BRIDGED_INLINE BridgedIdentifier BridgedASTContext_id_##Name(BridgedASTContext bridged);
229+
#include "swift/AST/KnownIdentifiers.def"
230+
230231
SWIFT_NAME("getter:BridgedASTContext.raw(self:)")
231232
BRIDGED_INLINE
232233
void * _Nonnull BridgedASTContext_raw(BridgedASTContext bridged);

include/swift/AST/ASTBridgingImpl.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ swift::Identifier BridgedIdentifier::unbridged() const {
4040
return swift::Identifier::getFromOpaquePointer(Raw);
4141
}
4242

43-
BridgedStringRef BridgedIdentifier_getStr(const BridgedIdentifier ident) {
44-
return ident.unbridged().str();
45-
}
46-
4743
bool BridgedIdentifier_isOperator(const BridgedIdentifier ident) {
4844
return ident.unbridged().isOperator();
4945
}
@@ -121,6 +117,12 @@ BridgedStringRef BridgedASTContext_allocateCopyString(BridgedASTContext bridged,
121117
return bridged.unbridged().AllocateCopy(cStr.unbridged());
122118
}
123119

120+
#define IDENTIFIER_WITH_NAME(Name, _) \
121+
BridgedIdentifier BridgedASTContext_id_##Name(BridgedASTContext bridged) { \
122+
return bridged.unbridged().Id_##Name; \
123+
}
124+
#include "swift/AST/KnownIdentifiers.def"
125+
124126
//===----------------------------------------------------------------------===//
125127
// MARK: BridgedDeclContext
126128
//===----------------------------------------------------------------------===//

include/swift/Basic/BasicBridging.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,6 @@ BRIDGED_INLINE SwiftInt BridgedStringRef_count(BridgedStringRef str);
251251
SWIFT_NAME("getter:BridgedStringRef.isEmpty(self:)")
252252
BRIDGED_INLINE bool BridgedStringRef_empty(BridgedStringRef str);
253253

254-
SWIFT_NAME("BridgedStringRef.equals(self:_:)")
255-
BRIDGED_INLINE bool BridgedStringRef_equals(BridgedStringRef lhs,
256-
BridgedStringRef rhs);
257-
258254
class BridgedOwnedString {
259255
char *_Nonnull Data;
260256
size_t Length;

include/swift/Basic/BasicBridgingImpl.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,6 @@ bool BridgedStringRef_empty(BridgedStringRef str) {
7070
return str.unbridged().empty();
7171
}
7272

73-
bool BridgedStringRef_equals(BridgedStringRef lhs, BridgedStringRef rhs) {
74-
return lhs.unbridged() == rhs.unbridged();
75-
}
76-
7773
//===----------------------------------------------------------------------===//
7874
// MARK: BridgedOwnedString
7975
//===----------------------------------------------------------------------===//

lib/ASTGen/Sources/ASTGen/Bridge.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,6 @@ extension BridgedStringRef: /*@retroactive*/ Swift.ExpressibleByStringLiteral {
166166
}
167167
}
168168

169-
extension BridgedStringRef: /*@retroactive*/ Swift.Equatable {
170-
public static func ==(lhs: BridgedStringRef, rhs: BridgedStringRef) -> Bool {
171-
lhs.equals(rhs)
172-
}
173-
}
174-
175169
extension VersionTuple {
176170
var bridged: BridgedVersionTuple {
177171
switch self.components.count {

lib/ASTGen/Sources/ASTGen/Exprs.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ extension ASTGenVisitor {
308308
)
309309

310310
// If we captured something under the name "self", remember that.
311-
if nameAndLoc.identifier.str == "self" {
311+
if nameAndLoc.identifier == ctx.id_self {
312312
capturedSelfDecl = entry.varDecl
313313
}
314314

0 commit comments

Comments
 (0)