Skip to content

Commit e3b7708

Browse files
committed
SIL: add GlobalVariable.type
1 parent 7e63d08 commit e3b7708

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

SwiftCompilerSources/Sources/SIL/GlobalVariable.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ final public class GlobalVariable : CustomStringConvertible, HasShortDescription
2929

3030
public var shortDescription: String { name.string }
3131

32+
public var type: Type { Type(bridged: bridged.getType()) }
33+
3234
public var isLet: Bool { bridged.isLet() }
3335

3436
public var linkage: Linkage { bridged.getLinkage().linkage }

include/swift/SIL/SILBridging.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,7 @@ struct BridgedGlobalVar {
587587
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedStringRef getName() const;
588588
BRIDGED_INLINE bool isLet() const;
589589
BRIDGED_INLINE void setLet(bool value) const;
590+
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedType getType() const;
590591
BRIDGED_INLINE BridgedLinkage getLinkage() const;
591592
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedSourceLoc getSourceLocation() const;
592593
BRIDGED_INLINE bool isPossiblyUsedExternally() const;

include/swift/SIL/SILBridgingImpl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,10 @@ bool BridgedGlobalVar::isLet() const { return getGlobal()->isLet(); }
918918

919919
void BridgedGlobalVar::setLet(bool value) const { getGlobal()->setLet(value); }
920920

921+
BridgedType BridgedGlobalVar::getType() const {
922+
return getGlobal()->getLoweredType();
923+
}
924+
921925
BridgedLinkage BridgedGlobalVar::getLinkage() const {
922926
return (BridgedLinkage)getGlobal()->getLinkage();
923927
}

0 commit comments

Comments
 (0)