Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/interop/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ Return if a type would be boxed when instantiated in the code generator.
"""
function isboxed(typ::Type)
isboxed_ref = Ref{Bool}()
ccall(:julia_type_to_llvm, LLVM.API.LLVMTypeRef, (Any, Ptr{Bool}), typ, isboxed_ref)
if VERSION >= v"1.5.0-DEV.393"
ccall(:jl_type_to_llvm, LLVM.API.LLVMTypeRef, (Any, Ptr{Bool}), typ, isboxed_ref)
else
ccall(:julia_type_to_llvm, LLVM.API.LLVMTypeRef, (Any, Ptr{Bool}), typ, isboxed_ref)
end
return isboxed_ref[]
end

Expand All @@ -71,8 +75,13 @@ Convert a Julia type `typ` to its LLVM representation. Fails if the type would b
"""
function Base.convert(::Type{LLVMType}, typ::Type, allow_boxed::Bool=false)
isboxed_ref = Ref{Bool}()
llvmtyp = LLVMType(ccall(:julia_type_to_llvm, LLVM.API.LLVMTypeRef,
(Any, Ptr{Bool}), typ, isboxed_ref))
if VERSION >= v"1.5.0-DEV.393"
llvmtyp = LLVMType(ccall(:jl_type_to_llvm, LLVM.API.LLVMTypeRef,
(Any, Ptr{Bool}), typ, isboxed_ref))
else
llvmtyp = LLVMType(ccall(:julia_type_to_llvm, LLVM.API.LLVMTypeRef,
(Any, Ptr{Bool}), typ, isboxed_ref))
end
if !allow_boxed && isboxed_ref[]
error("Conversion of boxed type $typ is not allowed")
end
Expand Down
7 changes: 0 additions & 7 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -444,13 +444,6 @@ LLVM.Module("SomeModule", ctx) do mod
unsafe_delete!(mod, gv)
@test isempty(gvars)
end

# bug: PointerNull wasn't a constant, and couldn't be used as an initializer
let ptrtyp = LLVM.PointerType(LLVM.VoidType(ctx))
gv = GlobalVariable(mod, ptrtyp, "SomeOtherGlobal")
init = PointerNull(ptrtyp)
initializer!(gv, init)
end
end
end

Expand Down