Skip to content

Commit 7008f3b

Browse files
committed
Consistenly use LLVM.unsafe_message.
1 parent 1cf66a5 commit 7008f3b

File tree

4 files changed

+7
-13
lines changed

4 files changed

+7
-13
lines changed

src/analysis.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ function verify(mod::Module)
66
convert(Core.Bool, API.LLVMVerifyModule(mod, API.LLVMReturnStatusAction, out_error))
77

88
if status
9-
error = unsafe_string(out_error[])
10-
API.LLVMDisposeMessage(out_error[])
9+
error = unsafe_message(out_error[])
1110
throw(LLVMException(error))
1211
end
1312
end

src/buffer.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ function MemoryBufferFile(path::String)
3434
convert(Core.Bool, API.LLVMCreateMemoryBufferWithContentsOfFile(path, out_ref, out_error))
3535

3636
if status
37-
error = unsafe_string(out_error[])
38-
API.LLVMDisposeMessage(out_error[])
37+
error = unsafe_message(out_error[])
3938
throw(LLVMException(error))
4039
end
4140

src/execution.jl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ function ExecutionEngine(mod::Module)
6767
out_error))
6868

6969
if status
70-
error = unsafe_string(out_error[])
71-
API.LLVMDisposeMessage(out_error[])
70+
error = unsafe_message(out_error[])
7271
throw(LLVMException(error))
7372
end
7473

@@ -83,8 +82,7 @@ function Interpreter(mod::Module)
8382
out_error))
8483

8584
if status
86-
error = unsafe_string(out_error[])
87-
API.LLVMDisposeMessage(out_error[])
85+
error = unsafe_message(out_error[])
8886
throw(LLVMException(error))
8987
end
9088

@@ -99,8 +97,7 @@ function JIT(mod::Module, optlevel::API.LLVMCodeGenOptLevel=API.LLVMCodeGenLevel
9997
optlevel, out_error))
10098

10199
if status
102-
error = unsafe_string(out_error[])
103-
API.LLVMDisposeMessage(out_error[])
100+
error = unsafe_message(out_error[])
104101
throw(LLVMException(error))
105102
end
106103

src/ir.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ function Base.parse(::Type{Module}, ir::String, ctx::Context=GlobalContext())
99
status = convert(Core.Bool, API.LLVMParseIRInContext(ctx, membuf, out_ref, out_error))
1010

1111
if status
12-
error = unsafe_string(out_error[])
13-
API.LLVMDisposeMessage(out_error[])
12+
error = unsafe_message(out_error[])
1413
throw(LLVMException(error))
1514
end
1615

@@ -20,4 +19,4 @@ end
2019

2120
## writer
2221

23-
Base.convert(::Type{String}, mod::Module) = unsafe_string(API.LLVMPrintModuleToString(mod))
22+
Base.convert(::Type{String}, mod::Module) = unsafe_string(API.LLVMPrintModuleToString(mod))

0 commit comments

Comments
 (0)