Skip to content

Commit 86eec7c

Browse files
committed
Add the "discard value names" optimization flag
1 parent 45f13ce commit 86eec7c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Sources/LLVM/Module.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ public class Context {
2222
self.ownsContext = ownsContext
2323
}
2424

25+
/// Returns whether the given context is set to discard all value names.
26+
///
27+
/// If true, only the names of GlobalValue objects will be available in
28+
/// the IR. This can be used to save memory and runtime, especially in
29+
/// release mode.
30+
public var discardValueNames: Bool {
31+
get { return LLVMContextShouldDiscardValueNames(self.llvm) != 0 }
32+
set { LLVMContextSetDiscardValueNames(self.llvm, newValue.llvm) }
33+
}
34+
2535
deinit {
2636
if ownsContext {
2737
LLVMContextDispose(llvm)

0 commit comments

Comments
 (0)