File tree Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Original file line number Diff line number Diff line change @@ -57,10 +57,12 @@ public struct StructType: IRType {
5757 /// Creates a constant value of this structure type initialized with the given
5858 /// list of values.
5959 ///
60+ /// - precondition: values.count == aggregate.elementCount
6061 /// - parameter values: A list of values of members of this structure.
6162 ///
6263 /// - returns: A value representing a constant value of this structure type.
6364 public func constant( values: [ IRValue ] ) -> Constant < Struct > {
65+ assert ( numericCast ( values. count) == LLVMCountStructElementTypes ( llvm) , " The number of values must match the number of elements in the aggregate " )
6466 var vals = values. map { $0. asLLVM ( ) as Optional }
6567 return vals. withUnsafeMutableBufferPointer { buf in
6668 return Constant ( llvm: LLVMConstNamedStruct ( asLLVM ( ) ,
You can’t perform that action at this time.
0 commit comments