Skip to content

Commit 28f791e

Browse files
committed
Fix doc comments remove optionality on StructType initializer
1 parent 383b115 commit 28f791e

File tree

6 files changed

+7
-11
lines changed

6 files changed

+7
-11
lines changed

Sources/LLVM/FloatType.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public struct FloatType: IRType {
99
/// The kind of floating point type this is
1010
public var kind: Kind
1111

12-
/// Returns the context associated with this module.
12+
/// Returns the context associated with this type.
1313
public let context: Context
1414

1515
/// Creates a float type of a particular kind

Sources/LLVM/IntType.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public struct IntType: IRType {
1111
/// Retrieves the bit width of this integer type.
1212
public let width: Int
1313

14-
/// Returns the context associated with this module.
14+
/// Returns the context associated with this type.
1515
public let context: Context
1616

1717
/// Creates an integer type with the specified bit width.

Sources/LLVM/LabelType.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import cllvm
55
/// `LabelType` represents code labels.
66
public struct LabelType: IRType {
77

8-
/// Returns the context associated with this module.
8+
/// Returns the context associated with this type.
99
public let context: Context
1010

1111
/// Creates a code label.

Sources/LLVM/StructType.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,10 @@ public struct StructType: IRType {
3737
/// no packing between fields. Defaults to `false`.
3838
/// - parameter context: The context to create this type in
3939
/// - SeeAlso: http://llvm.org/docs/ProgrammersManual.html#achieving-isolation-with-llvmcontext
40-
public init(elementTypes: [IRType], isPacked: Bool = false, in context: Context? = nil) {
40+
public init(elementTypes: [IRType], isPacked: Bool = false, in context: Context = Context.global) {
4141
var irTypes = elementTypes.map { $0.asLLVM() as Optional }
4242
self.llvm = irTypes.withUnsafeMutableBufferPointer { buf in
43-
if let context = context {
44-
return LLVMStructTypeInContext(context.llvm, buf.baseAddress, UInt32(buf.count), isPacked.llvm)
45-
} else {
46-
return LLVMStructType(buf.baseAddress, UInt32(buf.count), isPacked.llvm)
47-
}
43+
return LLVMStructTypeInContext(context.llvm, buf.baseAddress, UInt32(buf.count), isPacked.llvm)
4844
}
4945
}
5046

Sources/LLVM/VoidType.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import cllvm
55
/// The `Void` type represents any value and has no size.
66
public struct VoidType: IRType {
77

8-
/// Returns the context associated with this module.
8+
/// Returns the context associated with this type.
99
public let context: Context
1010

1111
/// Creates an instance of the `Void` type.

Sources/LLVM/X86MMXType.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import cllvm
1010
/// type. There are no arrays, vectors or constants of this type.
1111
public struct X86MMXType: IRType {
1212

13-
/// Returns the context associated with this module.
13+
/// Returns the context associated with this type.
1414
public let context: Context
1515

1616
/// Creates an `X86MMXType`.

0 commit comments

Comments
 (0)