Skip to content

Commit 3805d82

Browse files
CodaFiharlanhaskins
authored andcommitted
Revert "Remove de-initializers that dispose of LLVM objects" (#81)
This reverts commit e5c6e6c.
1 parent 7bc5935 commit 3805d82

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

Sources/LLVM/IRBuilder.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,8 +1706,7 @@ public class IRBuilder {
17061706
return Alias(llvm: LLVMAddAlias(module.llvm, type.asLLVM(), aliasee.asLLVM(), name))
17071707
}
17081708

1709-
// FIXME: Re-introduce this when disposal becomes safe.
1710-
// deinit {
1711-
// LLVMDisposeBuilder(llvm)
1712-
// }
1709+
deinit {
1710+
LLVMDisposeBuilder(llvm)
1711+
}
17131712
}

Sources/LLVM/Module.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,9 @@ public final class Module: CustomStringConvertible {
193193
return String(cString: cStr)
194194
}
195195

196-
// FIXME: Re-introduce this when disposal becomes safe.
197-
// deinit {
198-
// LLVMDisposeModule(llvm)
199-
// }
196+
deinit {
197+
LLVMDisposeModule(llvm)
198+
}
200199
}
201200

202201
extension Bool {

Sources/LLVM/TargetMachine.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,7 @@ public class TargetMachine {
212212
return MemoryBuffer(llvm: llvm)
213213
}
214214

215-
// FIXME: Re-introduce this when disposal becomes safe.
216-
// deinit {
217-
// LLVMDisposeTargetMachine(llvm)
218-
// }
215+
deinit {
216+
LLVMDisposeTargetMachine(llvm)
217+
}
219218
}

0 commit comments

Comments
 (0)