Skip to content

Commit ced850d

Browse files
committed
SwiftCompilerSources: bridge GlobalVariable.varDecl
1 parent b1601a9 commit ced850d

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

SwiftCompilerSources/Sources/SIL/GlobalVariable.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ import Basic
1414
import SILBridging
1515

1616
final public class GlobalVariable : CustomStringConvertible, HasShortDescription, Hashable {
17+
public var varDecl: VarDecl? {
18+
VarDecl(bridged: bridged.getDecl())
19+
}
20+
1721
public var name: StringRef {
1822
return StringRef(bridged: bridged.getName())
1923
}

include/swift/SIL/SILBridging.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,7 @@ struct BridgedGlobalVar {
594594

595595
BridgedGlobalVar(SwiftObject obj) : obj(obj) {}
596596
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE swift::SILGlobalVariable * _Nonnull getGlobal() const;
597+
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedNullableVarDecl getDecl() const;
597598
SWIFT_IMPORT_UNSAFE BridgedOwnedString getDebugDescription() const;
598599
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedStringRef getName() const;
599600
BRIDGED_INLINE bool isLet() const;

include/swift/SIL/SILBridgingImpl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,10 @@ swift::SILGlobalVariable * _Nonnull BridgedGlobalVar::getGlobal() const {
693693
return static_cast<swift::SILGlobalVariable *>(obj);
694694
}
695695

696+
BridgedNullableVarDecl BridgedGlobalVar::getDecl() const {
697+
return getGlobal()->getDecl();
698+
}
699+
696700
BridgedStringRef BridgedGlobalVar::getName() const {
697701
return getGlobal()->getName();
698702
}

0 commit comments

Comments
 (0)