Skip to content

Commit a7d99ee

Browse files
committed
Reword struct type docs
Fix return mismatch in ConstantSpecs
1 parent 7b3ab78 commit a7d99ee

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

Sources/LLVM/StructType.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ public struct StructType: IRType {
7171
}
7272
}
7373

74-
/// Creates a complex constant value initialized with the given list of values.
74+
/// Creates an constant struct value initialized with the given list of values.
7575
///
7676
/// - parameter values: A list of values of members of this structure.
7777
/// - parameter isPacked: Whether or not this structure is 1-byte aligned with
7878
/// no packing between fields. Defaults to `false`.
7979
///
80-
/// - returns: A value representing a complex constant value with given the values.
80+
/// - returns: A value representing a constant struct value with given the values.
8181
public static func constant(values: [IRValue], isPacked: Bool = false) -> Constant<Struct> {
8282
var vals = values.map { $0.asLLVM() as Optional }
8383
return vals.withUnsafeMutableBufferPointer { buf in

Tests/LLVMTests/ConstantSpec.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ class ConstantSpec : XCTestCase {
3939
// UNSIGNEDCONST-NEXT: source_filename = "[[ModuleName]]"
4040
let module = Module(name: "ConstantTest")
4141
let builder = IRBuilder(module: module)
42-
// UNSIGNEDCONST: define void @main() {
42+
// UNSIGNEDCONST: define i64 @main() {
4343
let main = builder.addFunction("main",
4444
type: FunctionType(argTypes: [],
45-
returnType: VoidType()))
45+
returnType: IntType.int64))
4646
let constant = IntType.int64.constant(UInt64(42))
4747

4848
// UNSIGNEDCONST-NEXT: entry:
@@ -67,10 +67,10 @@ class ConstantSpec : XCTestCase {
6767
// FLOATINGCONST-NEXT: source_filename = "[[ModuleName]]"
6868
let module = Module(name: "ConstantTest")
6969
let builder = IRBuilder(module: module)
70-
// FLOATINGCONST: define void @main() {
70+
// FLOATINGCONST: define i64 @main() {
7171
let main = builder.addFunction("main",
7272
type: FunctionType(argTypes: [],
73-
returnType: VoidType()))
73+
returnType: IntType.int64))
7474
let constant = FloatType.double.constant(42.0)
7575

7676
// FLOATINGCONST-NEXT: entry:
@@ -95,10 +95,10 @@ class ConstantSpec : XCTestCase {
9595
// STRUCTCONST-NEXT: source_filename = "[[ModuleName]]"
9696
let module = Module(name: "ConstantTest")
9797
let builder = IRBuilder(module: module)
98-
// STRUCTCONST: define void @main() {
98+
// STRUCTCONST: define i64 @main() {
9999
let main = builder.addFunction("main",
100100
type: FunctionType(argTypes: [],
101-
returnType: VoidType()))
101+
returnType: IntType.int64))
102102

103103
let constant = StructType(elementTypes: [IntType.int64])
104104
.constant(values: [42])
@@ -118,10 +118,10 @@ class ConstantSpec : XCTestCase {
118118
// STRUCTCONSTGETELEMENT-NEXT: source_filename = "[[ModuleName]]"
119119
let module = Module(name: "ConstantTest")
120120
let builder = IRBuilder(module: module)
121-
// STRUCTCONSTGETELEMENT: define void @main() {
121+
// STRUCTCONSTGETELEMENT: define i64 @main() {
122122
let main = builder.addFunction("main",
123123
type: FunctionType(argTypes: [],
124-
returnType: VoidType()))
124+
returnType: IntType.int64))
125125

126126
let constant = StructType(elementTypes: [IntType.int64])
127127
.constant(values: [42])

0 commit comments

Comments
 (0)