Skip to content

Commit 1856e7f

Browse files
committed
SwiftCompilerSources: add the ValueDecl.isObjC API
1 parent 8ae66ec commit 1856e7f

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

SwiftCompilerSources/Sources/AST/Declarations.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public class Decl: CustomStringConvertible, Hashable {
3030
public class ValueDecl: Decl {
3131
final public var nameLoc: SourceLoc? { SourceLoc(bridged: bridged.Value_getNameLoc()) }
3232
final public var userFacingName: StringRef { StringRef(bridged: bridged.Value_getUserFacingName()) }
33+
final public var isObjC: Bool { bridged.Value_isObjC() }
3334
}
3435

3536
public class TypeDecl: ValueDecl {

include/swift/AST/ASTBridging.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ struct BridgedDeclObj {
317317
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedStringRef Type_getName() const;
318318
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedStringRef Value_getUserFacingName() const;
319319
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedSourceLoc Value_getNameLoc() const;
320+
BRIDGED_INLINE bool Value_isObjC() const;
320321
BRIDGED_INLINE bool GenericType_isGenericAtAnyLevel() const;
321322
BRIDGED_INLINE bool NominalType_isGlobalActor() const;
322323
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE OptionalBridgedDeclObj NominalType_getValueTypeDestructor() const;

include/swift/AST/ASTBridgingImpl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ BridgedSourceLoc BridgedDeclObj::Value_getNameLoc() const {
5252
return BridgedSourceLoc(getAs<swift::ValueDecl>()->getNameLoc().getOpaquePointerValue());
5353
}
5454

55+
bool BridgedDeclObj::Value_isObjC() const {
56+
return getAs<swift::ValueDecl>()->isObjC();
57+
}
58+
5559
bool BridgedDeclObj::GenericType_isGenericAtAnyLevel() const {
5660
return getAs<swift::GenericTypeDecl>()->isGenericContext();
5761
}

0 commit comments

Comments
 (0)