Skip to content

Commit 206e23a

Browse files
committed
Strip the jl version suffix to be consistent with Julia.
1 parent 5b774c9 commit 206e23a

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/LLVM.jl

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,17 @@ const libllvm_version = Ref{VersionNumber}()
1717
function version()
1818
if !isassigned(libllvm_version)
1919
# FIXME: add a proper C API to LLVM
20-
version_str = unsafe_string(
20+
version_print = unsafe_string(
2121
ccall((:_ZN4llvm16LTOCodeGenerator16getVersionStringEv, libllvm), Cstring, ()))
22-
m = match(r"LLVM version (?<version>.+)", version_str)
23-
m === nothing && error("Unrecognized version string: '$version_str'")
24-
libllvm_version[] =VersionNumber(m[:version])
22+
m = match(r"LLVM version (?<version>.+)", version_print)
23+
m === nothing && error("Unrecognized version string: '$version_print'")
24+
libllvm_version[] = if endswith(m[:version], "jl")
25+
# strip the "jl" SONAME suffix (JuliaLang/julia#33058)
26+
# (LLVM does never report a prerelease version anyway)
27+
VersionNumber(m[:version][1:end-2])
28+
else
29+
VersionNumber(m[:version])
30+
end
2531
end
2632
return libllvm_version[]
2733
end
@@ -76,9 +82,7 @@ include("deprecated.jl")
7682
function __init__()
7783
libllvm_version = version()
7884
@debug "Using LLVM $libllvm_version at $(Libdl.dlpath(libllvm))"
79-
if libllvm_version.major != Base.libllvm_version.major ||
80-
libllvm_version.minor != Base.libllvm_version.minor ||
81-
libllvm_version.patch != Base.libllvm_version.patch
85+
if libllvm_version != Base.libllvm_version
8286
@warn "Using a different version of LLVM ($libllvm_version) than the one shipped with Julia ($(Base.libllvm_version)); this is unsupported"
8387
end
8488

0 commit comments

Comments
 (0)