Skip to content

Commit ea9bb77

Browse files
committed
[Orc] add do form to OrcJIT
1 parent 0c62908 commit ea9bb77

File tree

2 files changed

+227
-217
lines changed

2 files changed

+227
-217
lines changed

src/orc.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ function dispose(orc::OrcJIT)
3131
API.LLVMOrcDisposeInstance(orc)
3232
end
3333

34+
function OrcJIT(f::Core.Function, tm::TargetMachine)
35+
orc = OrcJIT(tm)
36+
try
37+
f(orc)
38+
finally
39+
dispose(orc)
40+
end
41+
end
42+
3443
function errormsg(orc::OrcJIT)
3544
# The error message is owned by `orc`, and will
3645
# be disposed along-side the OrcJIT.

0 commit comments

Comments
 (0)