Skip to content

Commit 3d02cf3

Browse files
committed
Document Use
1 parent d41288d commit 3d02cf3

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

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)