File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -58,10 +58,22 @@ public struct StructType: IRType {
5858 /// list of values.
5959 ///
6060 /// - parameter values: A list of values of members of this structure.
61+ ///
62+ /// - returns: A value representing a constant value of this structure type.
63+ public func constant( values: [ IRValue ] ) -> IRValue {
64+ var vals = values. map { $0. asLLVM ( ) as Optional }
65+ return vals. withUnsafeMutableBufferPointer { buf in
66+ return LLVMConstNamedStruct ( asLLVM ( ) , buf. baseAddress, UInt32 ( buf. count) )
67+ }
68+ }
69+
70+ /// Creates a complex constant value initialized with the given list of values.
71+ ///
72+ /// - parameter values: A list of values of members of this structure.
6173 /// - parameter isPacked: Whether or not this structure is 1-byte aligned with
6274 /// no packing between fields. Defaults to `false`.
6375 ///
64- /// - returns: A value representing a constant value of this structure type .
76+ /// - returns: A value representing a complex constant value with given the values .
6577 public static func constant( values: [ IRValue ] , isPacked: Bool = false ) -> IRValue {
6678 var vals = values. map { $0. asLLVM ( ) as Optional }
6779 return vals. withUnsafeMutableBufferPointer { buf in
You can’t perform that action at this time.
0 commit comments