Skip to content

Commit 8a4e694

Browse files
committed
Add binding to retrieve the value type of a global
1 parent b8d15e3 commit 8a4e694

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Sources/LLVM/IRGlobal.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ import cllvm
77
public protocol IRGlobal: IRConstant {}
88

99
extension IRGlobal {
10+
/// Retrieves the "value type" of this global value.
11+
///
12+
/// The formal type of a global value is always a pointer type. The value
13+
/// type, in contrast, is the type of the value the global points to.
14+
public var valueType: IRType {
15+
return convertType(LLVMGlobalGetValueType(asLLVM()))
16+
}
17+
1018
/// Retrieves the alignment of this value.
1119
public var alignment: Alignment {
1220
get { return Alignment(LLVMGetAlignment(asLLVM())) }

0 commit comments

Comments
 (0)