Skip to content

Commit 8fdf2ce

Browse files
committed
Document Use
1 parent d41288d commit 8fdf2ce

File tree

2 files changed

+23
-18
lines changed

2 files changed

+23
-18
lines changed

Sources/LLVMSwift/Module.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ public final class Module {
104104
}
105105
}
106106

107-
/// Creates a type with the given name in this module if that name does not
108-
/// conflict with an existing type name.
107+
/// Searches for and retrieves a type with the given name in this module if
108+
/// that name references an existing type.
109109
///
110110
/// - parameter name: The name of the type to create.
111111
///
@@ -116,8 +116,8 @@ public final class Module {
116116
return convertType(type)
117117
}
118118

119-
/// Creates a function with the given name in this module if that name does
120-
/// not conflict with an existing type name.
119+
/// Searches for and retrieves a function with the given name in this module
120+
/// if that name references an existing function.
121121
///
122122
/// - parameter name: The name of the function to create.
123123
///

Sources/LLVMSwift/Use.swift

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
import cllvm
22

3+
/// `Use` represents an iterator over the uses and users of a particular value
4+
/// in an LLVM program.
35
public struct Use {
4-
internal let llvm: LLVMUseRef
5-
6-
public func next() -> Use? {
7-
guard let next = LLVMGetNextUse(llvm) else { return nil }
8-
return Use(llvm: next)
9-
}
10-
11-
public func user() -> IRValue? {
12-
return LLVMGetUser(llvm)
13-
}
14-
15-
public func usedValue() -> IRValue? {
16-
return LLVMGetUsedValue(llvm)
17-
}
6+
internal let llvm: LLVMUseRef
7+
8+
/// Retrieves the next use of a value.
9+
public func next() -> Use? {
10+
guard let next = LLVMGetNextUse(llvm) else { return nil }
11+
return Use(llvm: next)
12+
}
13+
14+
/// Obtain the user value for this `User` object.
15+
public func user() -> IRValue? {
16+
return LLVMGetUser(llvm)
17+
}
18+
19+
/// Obtain the value this `User` object corresponds to.
20+
public func usedValue() -> IRValue? {
21+
return LLVMGetUsedValue(llvm)
22+
}
1823
}

0 commit comments

Comments
 (0)