Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/crystal/files/, dev-lang/crystal/
Date: Mon, 11 Dec 2017 20:03:57
Message-Id: 1513022618.e4e28b774ec066428e0116b94af8baad3e95c559.mgorny@gentoo
1 commit: e4e28b774ec066428e0116b94af8baad3e95c559
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Mon Dec 11 20:01:09 2017 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Mon Dec 11 20:03:38 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e4e28b77
7
8 dev-lang/crystal: [QA] Move patches to a distfile
9
10 dev-lang/crystal/Manifest | 1 +
11 dev-lang/crystal/crystal-0.23.1.ebuild | 7 +-
12 .../files/crystal-0.22.0-blocking-stdio-hack.patch | 20 -
13 .../files/crystal-0.23.0-verbose-LDFLAGS.patch | 9 -
14 dev-lang/crystal/files/crystal-0.23.1-llvm-5.patch | 837 ---------------------
15 5 files changed, 5 insertions(+), 869 deletions(-)
16
17 diff --git a/dev-lang/crystal/Manifest b/dev-lang/crystal/Manifest
18 index c0ba3024244..29524660167 100644
19 --- a/dev-lang/crystal/Manifest
20 +++ b/dev-lang/crystal/Manifest
21 @@ -1,3 +1,4 @@
22 DIST crystal-0.23.0-1-linux-i686.tar.gz 18498501 BLAKE2B 7a8e4e5a2b1425b6effe0a634b74b28c340c4d23c4bfccc0abac4e5d47473e10421d025e68e1fb1fa5b0ba8296108e36cd17d393fb143b8012168d595e5852f9 SHA512 8745114c4824d2859c569ed1bd1057d6d649d57b10d41d22c17627f623704eb98ec2e3ab2bf06622de624906f53e053975a6b9d852aeaafeae4f43585609de28
23 DIST crystal-0.23.0-1-linux-x86_64.tar.gz 18729061 BLAKE2B bfca07702b2f7c7d6b11aac864475316cabe86bdba90b1819ecd5cb45769b2b7fd9fb4c9f80e46301785209cc5b35fe39bf689163b9376a32b24f8a685a6281b SHA512 6a4e427b4ab3c3be6efcfaee5c1a19eff04eaf00db949d1e1ba8f29c3277affe96a7aba4273d93fd05251453d5b5b937aa792bc448ff2f6d6aa7f2b17d175f75
24 +DIST crystal-0.23.1-patchset.tar.bz2 7268 BLAKE2B 135990ac9f1a225f169dbc5bb6034d2194d9fc917954764564d68afec09af703382743965a801c9ce54a5866af60847b4c4fc0b9daf2cf5ea99052fbeb771b2a SHA512 68896fc5d1772eeb3dd263f1615fc8031a63d0f3eebca1feb35165adf14a610157302541c84cbc9031a3070fd5566ffe88ad03a8c523f55980520e5614b00b89
25 DIST crystal-0.23.1.tar.gz 1646650 BLAKE2B 3105a683e61835d1e514d5d403b00d3dfae01100a9862d6346c45201c5fb6cba879255469652463719998e976afc495ee9fd4f14f829a709f832cd323cfc2b3b SHA512 06ee0d45cc79cc343d04c346e9cd47b6e4ebc79bf21833662f268f9604f7d2080f7696824e1959de341539f801ae8f898fe1d7b18e4c75378d4eb191878668d5
26
27 diff --git a/dev-lang/crystal/crystal-0.23.1.ebuild b/dev-lang/crystal/crystal-0.23.1.ebuild
28 index 08967bd554f..41f26d88e36 100644
29 --- a/dev-lang/crystal/crystal-0.23.1.ebuild
30 +++ b/dev-lang/crystal/crystal-0.23.1.ebuild
31 @@ -12,6 +12,7 @@ BV_X86=${BV}-linux-i686
32 DESCRIPTION="The Crystal Programming Language"
33 HOMEPAGE="https://crystal-lang.org"
34 SRC_URI="https://github.com/crystal-lang/crystal/archive/${PV}.tar.gz -> ${P}.tar.gz
35 + https://dev.gentoo.org/~mgorny/dist/${P}-patchset.tar.bz2
36 amd64? ( https://github.com/crystal-lang/crystal/releases/download/${PV}/crystal-${BV_AMD64}.tar.gz )
37 x86? ( https://github.com/crystal-lang/crystal/releases/download/${PV}/crystal-${BV_X86}.tar.gz )"
38
39 @@ -37,14 +38,14 @@ RDEPEND="${DEPEND}
40 "
41
42 PATCHES=(
43 - "${FILESDIR}"/${PN}-0.23.0-verbose-LDFLAGS.patch
44 - "${FILESDIR}"/${PN}-0.23.1-llvm-5.patch
45 + "${WORKDIR}"/${P}-patchset/${PN}-0.23.0-verbose-LDFLAGS.patch
46 + "${WORKDIR}"/${P}-patchset/${PN}-0.23.1-llvm-5.patch
47 )
48
49 src_prepare() {
50 default
51
52 - use blocking-stdio-hack && eapply "${FILESDIR}"/"${PN}"-0.22.0-blocking-stdio-hack.patch
53 + use blocking-stdio-hack && eapply "${WORKDIR}"/${P}-patchset/${PN}-0.22.0-blocking-stdio-hack.patch
54 }
55
56 src_compile() {
57
58 diff --git a/dev-lang/crystal/files/crystal-0.22.0-blocking-stdio-hack.patch b/dev-lang/crystal/files/crystal-0.22.0-blocking-stdio-hack.patch
59 deleted file mode 100644
60 index 07b7dba7be6..00000000000
61 --- a/dev-lang/crystal/files/crystal-0.22.0-blocking-stdio-hack.patch
62 +++ /dev/null
63 @@ -1,20 +0,0 @@
64 -Workaround tty corruption in crystal.
65 -
66 -Patch restores blocking mode of file desriptors
67 -in exchange of potential runtime deadlocks
68 -when dealing with stdio.
69 -
70 -Reported-by: Renich Bon Ciric
71 -Bug: https://github.com/crystal-lang/crystal/issues/2065
72 -Bug: https://bugs.gentoo.org/616256
73 -diff --git a/src/compiler/crystal/stdio.cr b/src/compiler/crystal/stdio.cr
74 -new file mode 100644
75 -index 000000000..e65f65089
76 ---- /dev/null
77 -+++ b/src/compiler/crystal/stdio.cr
78 -@@ -0,0 +1,5 @@
79 -+module Crystal
80 -+ STDIN.blocking = true
81 -+ STDOUT.blocking=true
82 -+ STDERR.blocking = true
83 -+end
84
85 diff --git a/dev-lang/crystal/files/crystal-0.23.0-verbose-LDFLAGS.patch b/dev-lang/crystal/files/crystal-0.23.0-verbose-LDFLAGS.patch
86 deleted file mode 100644
87 index 35eace15dae..00000000000
88 --- a/dev-lang/crystal/files/crystal-0.23.0-verbose-LDFLAGS.patch
89 +++ /dev/null
90 @@ -1,9 +0,0 @@
91 -diff --git a/Makefile b/Makefile
92 -index eff69e5..5c0c024 100644
93 ---- a/Makefile
94 -+++ b/Makefile
95 -@@ -28,3 +28,3 @@ SOURCES := $(shell find src -name '*.cr')
96 - SPEC_SOURCES := $(shell find spec -name '*.cr')
97 --FLAGS := $(if $(release),--release )$(if $(stats),--stats )$(if $(progress),--progress )$(if $(threads),--threads $(threads) )$(if $(debug),-d )
98 -+FLAGS := $(if $(release),--release )$(if $(stats),--stats )$(if $(progress),--progress )$(if $(threads),--threads $(threads) )$(if $(debug),-d )$(if $(verbose),--verbose )$(if $(LDFLAGS),--link-flags="$(LDFLAGS)" )
99 - SPEC_FLAGS := $(if $(verbose),-v )$(if $(junit_output),--junit_output $(junit_output) )
100
101 diff --git a/dev-lang/crystal/files/crystal-0.23.1-llvm-5.patch b/dev-lang/crystal/files/crystal-0.23.1-llvm-5.patch
102 deleted file mode 100644
103 index bbfd922149e..00000000000
104 --- a/dev-lang/crystal/files/crystal-0.23.1-llvm-5.patch
105 +++ /dev/null
106 @@ -1,837 +0,0 @@
107 -https://bugs.gentoo.org/630634
108 -diff --git a/.gitignore b/.gitignore
109 -index 9a883edfd..5f852d930 100644
110 ---- a/.gitignore
111 -+++ b/.gitignore
112 -@@ -12,5 +12,6 @@ all_spec
113 - /tmp
114 - /doc/
115 - /src/llvm/ext/llvm_ext.o
116 -+/src/llvm/ext/llvm_ext.dwo
117 - /src/ext/*.o
118 - /src/ext/libcrystal.a
119 -diff --git a/Makefile b/Makefile
120 -index a5dc0d7e3..14a21bb86 100644
121 ---- a/Makefile
122 -+++ b/Makefile
123 -@@ -37,8 +37,6 @@ LLVM_CONFIG_FINDER := \
124 - (command -v llvm-config > /dev/null && (case "$(llvm-config --version)" in 3.9*) command -v llvm-config;; *) false;; esac)) || \
125 - command -v llvm-config-3.8 || command -v llvm-config38 || \
126 - (command -v llvm-config > /dev/null && (case "$(llvm-config --version)" in 3.8*) command -v llvm-config;; *) false;; esac)) || \
127 -- command -v llvm-config-3.6 || command -v llvm-config36 || \
128 -- command -v llvm-config-3.5 || command -v llvm-config35 || \
129 - command -v llvm-config
130 - LLVM_CONFIG := $(shell $(LLVM_CONFIG_FINDER))
131 - LLVM_EXT_DIR = src/llvm/ext
132 -diff --git a/src/compiler/crystal/compiler.cr b/src/compiler/crystal/compiler.cr
133 -index a2bed9a95..afc7976e3 100644
134 ---- a/src/compiler/crystal/compiler.cr
135 -+++ b/src/compiler/crystal/compiler.cr
136 -@@ -447,9 +447,6 @@ module Crystal
137 -
138 - protected def optimize(llvm_mod)
139 - fun_pass_manager = llvm_mod.new_function_pass_manager
140 -- {% if LibLLVM::IS_35 || LibLLVM::IS_36 %}
141 -- fun_pass_manager.add_target_data target_machine.data_layout
142 -- {% end %}
143 - pass_manager_builder.populate fun_pass_manager
144 - fun_pass_manager.run llvm_mod
145 - module_pass_manager.run llvm_mod
146 -@@ -460,9 +457,6 @@ module Crystal
147 - private def module_pass_manager
148 - @module_pass_manager ||= begin
149 - mod_pass_manager = LLVM::ModulePassManager.new
150 -- {% if LibLLVM::IS_35 || LibLLVM::IS_36 %}
151 -- mod_pass_manager.add_target_data target_machine.data_layout
152 -- {% end %}
153 - pass_manager_builder.populate mod_pass_manager
154 - mod_pass_manager
155 - end
156 -@@ -554,54 +548,29 @@ module Crystal
157 - can_reuse_previous_compilation =
158 - !compiler.emit && !@bc_flags_changed && File.exists?(bc_name) && File.exists?(object_name)
159 -
160 -- {% if LibLLVM::IS_35 %}
161 -- # In LLVM 3.5 we can't write a bitcode to memory,
162 -- # so instead we write it to another file
163 -- bc_name_new = self.bc_name_new
164 -- llvm_mod.write_bitcode_to_file(bc_name_new)
165 --
166 -- if can_reuse_previous_compilation
167 -- if FileUtils.cmp(bc_name, bc_name_new)
168 -- # If the user cancelled a previous compilation it might be that
169 -- # the .o file is empty
170 -- if File.size(object_name) > 0
171 -- File.delete bc_name_new
172 -- must_compile = false
173 -- end
174 -- end
175 -- end
176 -+ memory_buffer = llvm_mod.write_bitcode_to_memory_buffer
177 -
178 -- if must_compile
179 -- # Create/overwrite the .bc file (for next compilations)
180 -- File.rename(bc_name_new, bc_name)
181 -- compiler.optimize llvm_mod if compiler.release?
182 -- compiler.target_machine.emit_obj_to_file llvm_mod, object_name
183 -- end
184 -- {% else %}
185 -- memory_buffer = llvm_mod.write_bitcode_to_memory_buffer
186 --
187 -- if can_reuse_previous_compilation
188 -- memory_io = IO::Memory.new(memory_buffer.to_slice)
189 -- changed = File.open(bc_name) { |bc_file| !FileUtils.cmp(bc_file, memory_io) }
190 --
191 -- # If the user cancelled a previous compilation
192 -- # it might be that the .o file is empty
193 -- if !changed && File.size(object_name) > 0
194 -- must_compile = false
195 -- memory_buffer.dispose
196 -- memory_buffer = nil
197 -- else
198 -- # We need to compile, so we'll write the memory buffer to file
199 -- end
200 -- end
201 -+ if can_reuse_previous_compilation
202 -+ memory_io = IO::Memory.new(memory_buffer.to_slice)
203 -+ changed = File.open(bc_name) { |bc_file| !FileUtils.cmp(bc_file, memory_io) }
204 -
205 -- # If there's a memory buffer, it means we must create a .o from it
206 -- if memory_buffer
207 -- # Create the .bc file (for next compilations)
208 -- File.write(bc_name, memory_buffer.to_slice)
209 -+ # If the user cancelled a previous compilation
210 -+ # it might be that the .o file is empty
211 -+ if !changed && File.size(object_name) > 0
212 -+ must_compile = false
213 - memory_buffer.dispose
214 -+ memory_buffer = nil
215 -+ else
216 -+ # We need to compile, so we'll write the memory buffer to file
217 - end
218 -- {% end %}
219 -+ end
220 -+
221 -+ # If there's a memory buffer, it means we must create a .o from it
222 -+ if memory_buffer
223 -+ # Create the .bc file (for next compilations)
224 -+ File.write(bc_name, memory_buffer.to_slice)
225 -+ memory_buffer.dispose
226 -+ end
227 -
228 - if must_compile
229 - compiler.optimize llvm_mod if compiler.release?
230 -diff --git a/src/llvm.cr b/src/llvm.cr
231 -index 44a03c272..f9b31cf4b 100644
232 ---- a/src/llvm.cr
233 -+++ b/src/llvm.cr
234 -@@ -94,11 +94,5 @@ module LLVM
235 - string
236 - end
237 -
238 -- {% if LibLLVM::IS_35 %}
239 -- DEBUG_METADATA_VERSION = 1
240 -- {% elsif LibLLVM::IS_36 %}
241 -- DEBUG_METADATA_VERSION = 2
242 -- {% else %}
243 -- DEBUG_METADATA_VERSION = 3
244 -- {% end %}
245 -+ DEBUG_METADATA_VERSION = 3
246 - end
247 -diff --git a/src/llvm/context.cr b/src/llvm/context.cr
248 -index 8485eedf1..7d66a4365 100644
249 ---- a/src/llvm/context.cr
250 -+++ b/src/llvm/context.cr
251 -@@ -9,9 +9,9 @@ class LLVM::Context
252 - end
253 -
254 - def new_module(name : String) : Module
255 -- {% if LibLLVM::IS_38 || LibLLVM::IS_36 || LibLLVM::IS_35 %}
256 -+ {% if LibLLVM::IS_38 %}
257 - Module.new(LibLLVM.module_create_with_name_in_context(name, self), name, self)
258 -- {% else %}
259 -+ {% else %} # LLVM >= 3.9
260 - Module.new(LibLLVM.module_create_with_name_in_context(name, self), self)
261 - {% end %}
262 - end
263 -@@ -104,9 +104,9 @@ class LLVM::Context
264 - if ret != 0 && msg
265 - raise LLVM.string_and_dispose(msg)
266 - end
267 -- {% if LibLLVM::IS_38 || LibLLVM::IS_36 || LibLLVM::IS_35 %}
268 -+ {% if LibLLVM::IS_38 %}
269 - Module.new(mod, "unknown", self)
270 -- {% else %}
271 -+ {% else %} # LLVM >= 3.9
272 - Module.new(mod, self)
273 - {% end %}
274 - end
275 -diff --git a/src/llvm/di_builder.cr b/src/llvm/di_builder.cr
276 -index b8c0fd628..79571d2c0 100644
277 ---- a/src/llvm/di_builder.cr
278 -+++ b/src/llvm/di_builder.cr
279 -@@ -31,16 +31,8 @@ struct LLVM::DIBuilder
280 -
281 - def create_function(scope, name, linkage_name, file, line, composite_type, is_local_to_unit, is_definition,
282 - scope_line, flags, is_optimized, func)
283 -- {% if LibLLVM::IS_36 || LibLLVM::IS_35 %}
284 -- LibLLVMExt.di_builder_create_function(self, scope, name, linkage_name, file, line, composite_type,
285 -- is_local_to_unit ? 1 : 0,
286 -- is_definition ? 1 : 0,
287 -- scope_line, flags,
288 -- is_optimized ? 1 : 0, func)
289 -- {% else %}
290 -- LibLLVMExt.di_builder_create_function(self, scope, name, linkage_name, file, line, composite_type,
291 -- is_local_to_unit, is_definition, scope_line, flags, is_optimized, func)
292 -- {% end %}
293 -+ LibLLVMExt.di_builder_create_function(self, scope, name, linkage_name, file, line, composite_type,
294 -+ is_local_to_unit, is_definition, scope_line, flags, is_optimized, func)
295 - end
296 -
297 - def create_auto_variable(scope, name, file, line, type, align_in_bits)
298 -@@ -87,19 +79,11 @@ struct LLVM::DIBuilder
299 - end
300 -
301 - def create_replaceable_composite_type(scope, name, file, line, context : Context)
302 -- {% if LibLLVM::IS_35 || LibLLVM::IS_36 %}
303 -- LibLLVMExt.temporary_md_node(context, nil, 0).as(LibLLVMExt::Metadata)
304 -- {% else %}
305 -- LibLLVMExt.di_builder_create_replaceable_composite_type(self, scope, name, file, line)
306 -- {% end %}
307 -+ LibLLVMExt.di_builder_create_replaceable_composite_type(self, scope, name, file, line)
308 - end
309 -
310 - def replace_temporary(from, to)
311 -- {% if LibLLVM::IS_35 || LibLLVM::IS_36 %}
312 -- LibLLVMExt.metadata_replace_all_uses_with(from, to)
313 -- {% else %}
314 -- LibLLVMExt.di_builder_replace_temporary(self, from, to)
315 -- {% end %}
316 -+ LibLLVMExt.di_builder_replace_temporary(self, from, to)
317 - end
318 -
319 - def end
320 -diff --git a/src/llvm/ext/llvm_ext.cc b/src/llvm/ext/llvm_ext.cc
321 -index d13446160..3dbdd4220 100644
322 ---- a/src/llvm/ext/llvm_ext.cc
323 -+++ b/src/llvm/ext/llvm_ext.cc
324 -@@ -18,35 +18,22 @@ using namespace llvm;
325 - #define LLVM_VERSION_LE(major, minor) \
326 - (LLVM_VERSION_MAJOR < (major) || LLVM_VERSION_MAJOR == (major) && LLVM_VERSION_MINOR <= (minor))
327 -
328 -+#if LLVM_VERSION_LE(4, 0)
329 - typedef struct LLVMOpaqueDIBuilder *LLVMDIBuilderRef;
330 - DEFINE_SIMPLE_CONVERSION_FUNCTIONS(DIBuilder, LLVMDIBuilderRef)
331 -
332 --#if LLVM_VERSION_EQ(3, 5)
333 --typedef LLVMValueRef LLVMMetadataRef;
334 --typedef Value Metadata;
335 --#define DIBuilderRef LLVMDIBuilderRef
336 --
337 --#else /* LLVM != 3.5 */
338 - typedef struct LLVMOpaqueMetadata *LLVMMetadataRef;
339 - DEFINE_ISA_CONVERSION_FUNCTIONS(Metadata, LLVMMetadataRef)
340 - inline Metadata **unwrap(LLVMMetadataRef *Vals) {
341 - return reinterpret_cast<Metadata **>(Vals);
342 - }
343 --#endif /* LLVM == 3.5 */
344 --
345 --#if LLVM_VERSION_LE(3, 6)
346 --template <typename T> T unwrapDIptr(LLVMMetadataRef v) {
347 -- return v ? T(unwrap<MDNode>(v)) : T();
348 --}
349 --#define DIBuilderRef LLVMDIBuilderRef
350 -+#endif
351 -
352 --#else /* LLVM > 3.6 */
353 - typedef DIBuilder *DIBuilderRef;
354 - #define DIArray DINodeArray
355 - template <typename T> T *unwrapDIptr(LLVMMetadataRef v) {
356 - return (T *)(v ? unwrap<MDNode>(v) : NULL);
357 - }
358 --#endif /* LLVM <= 3.6 */
359 -
360 - #if LLVM_VERSION_LE(3, 6)
361 - #define OperandBundleDef void
362 -@@ -66,13 +53,7 @@ void LLVMDIBuilderFinalize(LLVMDIBuilderRef dref) { unwrap(dref)->finalize(); }
363 -
364 - LLVMMetadataRef LLVMDIBuilderCreateFile(DIBuilderRef Dref, const char *File,
365 - const char *Dir) {
366 --#if LLVM_VERSION_LE(3, 6)
367 -- DIBuilder *D = unwrap(Dref);
368 -- DIFile F = D->createFile(File, Dir);
369 -- return wrap(F);
370 --#else
371 - return wrap(Dref->createFile(File, Dir));
372 --#endif
373 - }
374 -
375 - LLVMMetadataRef LLVMDIBuilderCreateCompileUnit(DIBuilderRef Dref, unsigned Lang,
376 -@@ -82,20 +63,13 @@ LLVMMetadataRef LLVMDIBuilderCreateCompileUnit(DIBuilderRef Dref, unsigned Lang,
377 - int Optimized,
378 - const char *Flags,
379 - unsigned RuntimeVersion) {
380 --#if LLVM_VERSION_LE(3, 6)
381 -- DIBuilder *D = unwrap(Dref);
382 -- DICompileUnit CU = D->createCompileUnit(Lang, File, Dir, Producer, Optimized,
383 -- Flags, RuntimeVersion);
384 -- return wrap(CU);
385 --#else
386 --# if LLVM_VERSION_LE(3, 9)
387 -+#if LLVM_VERSION_LE(3, 9)
388 - return wrap(Dref->createCompileUnit(Lang, File, Dir, Producer, Optimized,
389 - Flags, RuntimeVersion));
390 --# else
391 -+#else
392 - DIFile *F = Dref->createFile(File, Dir);
393 - return wrap(Dref->createCompileUnit(Lang, F, Producer, Optimized,
394 - Flags, RuntimeVersion));
395 --# endif
396 - #endif
397 - }
398 -
399 -@@ -111,19 +85,11 @@ LLVMMetadataRef LLVMDIBuilderCreateFunction(
400 - #endif
401 - bool IsOptimized,
402 - LLVMValueRef Func) {
403 --#if LLVM_VERSION_LE(3, 6)
404 -- DIBuilder *D = unwrap(Dref);
405 -- DISubprogram Sub = D->createFunction(
406 -- unwrapDI<DIDescriptor>(Scope), Name, LinkageName, unwrapDI<DIFile>(File),
407 -- Line, unwrapDI<DICompositeType>(CompositeType), IsLocalToUnit,
408 -- IsDefinition, ScopeLine, Flags, IsOptimized, unwrap<Function>(Func));
409 --#else
410 - DISubprogram *Sub = Dref->createFunction(
411 - unwrapDI<DIScope>(Scope), Name, LinkageName, unwrapDI<DIFile>(File), Line,
412 - unwrapDI<DISubroutineType>(CompositeType), IsLocalToUnit, IsDefinition,
413 - ScopeLine, Flags, IsOptimized);
414 - unwrap<Function>(Func)->setSubprogram(Sub);
415 --#endif
416 - return wrap(Sub);
417 - }
418 -
419 -@@ -132,18 +98,8 @@ LLVMMetadataRef LLVMDIBuilderCreateLexicalBlock(DIBuilderRef Dref,
420 - LLVMMetadataRef File,
421 - unsigned Line,
422 - unsigned Column) {
423 --#if LLVM_VERSION_LE(3, 6)
424 -- DIBuilder *D = unwrap(Dref);
425 --# if LLVM_VERSION_EQ(3, 5)
426 -- DILexicalBlock LB = D->createLexicalBlock(unwrapDI<DIDescriptor>(Scope), unwrapDI<DIFile>(File), Line, Column, 0);
427 --# else /* LLVM <= 3.6 && LLVM != 3.5 */
428 -- DILexicalBlock LB = D->createLexicalBlock(unwrapDI<DIDescriptor>(Scope), unwrapDI<DIFile>(File), Line, Column);
429 --# endif
430 -- return wrap(LB);
431 --#else /* LLVM > 3.6 */
432 - return wrap(Dref->createLexicalBlock(unwrapDI<DIDescriptor>(Scope),
433 - unwrapDI<DIFile>(File), Line, Column));
434 --#endif /* LLVM <= 3.6 */
435 - }
436 -
437 - LLVMMetadataRef LLVMDIBuilderCreateBasicType(DIBuilderRef Dref,
438 -@@ -151,71 +107,34 @@ LLVMMetadataRef LLVMDIBuilderCreateBasicType(DIBuilderRef Dref,
439 - uint64_t SizeInBits,
440 - uint64_t AlignInBits,
441 - unsigned Encoding) {
442 --#if LLVM_VERSION_LE(3, 6)
443 -- DIBuilder *D = unwrap(Dref);
444 -- DIBasicType T = D->createBasicType(Name, SizeInBits, AlignInBits, Encoding);
445 -- return wrap(T);
446 --#else
447 --# if LLVM_VERSION_LE(3, 9)
448 -+#if LLVM_VERSION_LE(3, 9)
449 - return wrap(Dref->createBasicType(Name, SizeInBits, AlignInBits, Encoding));
450 --# else
451 -+#else
452 - return wrap(Dref->createBasicType(Name, SizeInBits, Encoding));
453 --# endif
454 - #endif
455 - }
456 -
457 - LLVMMetadataRef LLVMDIBuilderGetOrCreateTypeArray(DIBuilderRef Dref,
458 - LLVMMetadataRef *Data,
459 - unsigned Length) {
460 --#if LLVM_VERSION_LE(3, 6)
461 -- DIBuilder *D = unwrap(Dref);
462 --# if LLVM_VERSION_EQ(3, 5)
463 -- Value **DataValue = unwrap(Data);
464 -- ArrayRef<Value *> Elements(DataValue, Length);
465 -- DIArray A = D->getOrCreateArray(Elements);
466 --# else /* LLVM <= 3.6 && LLVM != 3.5 */
467 -- Metadata **DataValue = unwrap(Data);
468 -- ArrayRef<Metadata *> Elements(DataValue, Length);
469 -- DITypeArray A = D->getOrCreateTypeArray(Elements);
470 --# endif
471 -- return wrap(A);
472 --#else /* LLVM > 3.6 */
473 - Metadata **DataValue = unwrap(Data);
474 - return wrap(
475 - Dref->getOrCreateTypeArray(ArrayRef<Metadata *>(DataValue, Length))
476 - .get());
477 --#endif /* LLVM <= 3.6 */
478 - }
479 -
480 - LLVMMetadataRef LLVMDIBuilderGetOrCreateArray(DIBuilderRef Dref,
481 - LLVMMetadataRef *Data,
482 - unsigned Length) {
483 --#if LLVM_VERSION_LE(3, 6)
484 -- DIBuilder *D = unwrap(Dref);
485 -- ArrayRef<Metadata *> elements(unwrap(Data), Length);
486 -- DIArray a = D->getOrCreateArray(elements);
487 --
488 -- return wrap(a);
489 --#else
490 - Metadata **DataValue = unwrap(Data);
491 - return wrap(
492 - Dref->getOrCreateArray(ArrayRef<Metadata *>(DataValue, Length)).get());
493 --#endif
494 - }
495 -
496 - LLVMMetadataRef
497 - LLVMDIBuilderCreateSubroutineType(DIBuilderRef Dref, LLVMMetadataRef File,
498 - LLVMMetadataRef ParameterTypes) {
499 --#if LLVM_VERSION_LE(3, 6)
500 -- DIBuilder *D = unwrap(Dref);
501 --# if LLVM_VERSION_EQ(3, 5)
502 -- DICompositeType CT = D->createSubroutineType(unwrapDI<DIFile>(File), unwrapDI<DIArray>(ParameterTypes));
503 --# else /* LLVM <= 3.6 && LLVM != 3.5 */
504 -- DICompositeType CT = D->createSubroutineType(unwrapDI<DIFile>(File), unwrapDI<DITypeArray>(ParameterTypes));
505 --# endif
506 --#else /* LLVM > 3.6 */
507 - DISubroutineType *CT = Dref->createSubroutineType(DITypeRefArray(unwrap<MDTuple>(ParameterTypes)));
508 --#endif /* LLVM <= 3.6 */
509 - return wrap(CT);
510 - }
511 -
512 -@@ -229,21 +148,14 @@ LLVMMetadataRef LLVMDIBuilderCreateAutoVariable(
513 - DINode::DIFlags Flags,
514 - #endif
515 - uint32_t AlignInBits) {
516 --#if LLVM_VERSION_LE(3, 6)
517 -- DIBuilder *D = unwrap(Dref);
518 -- DIVariable V = D->createLocalVariable(
519 -- llvm::dwarf::DW_TAG_auto_variable, unwrapDI<DIDescriptor>(Scope), Name, unwrapDI<DIFile>(File), Line,
520 -- unwrapDI<DIType>(Ty), AlwaysPreserve, Flags, 0);
521 --#else
522 --# if LLVM_VERSION_LE(3, 9)
523 -+#if LLVM_VERSION_LE(3, 9)
524 - DILocalVariable *V = Dref->createAutoVariable(
525 - unwrapDI<DIDescriptor>(Scope), Name, unwrapDI<DIFile>(File), Line,
526 - unwrapDI<DIType>(Ty), AlwaysPreserve, Flags);
527 --# else
528 -+#else
529 - DILocalVariable *V = Dref->createAutoVariable(
530 - unwrapDI<DIDescriptor>(Scope), Name, unwrapDI<DIFile>(File), Line,
531 - unwrapDI<DIType>(Ty), AlwaysPreserve, Flags, AlignInBits);
532 --# endif
533 - #endif
534 - return wrap(V);
535 - }
536 -@@ -258,18 +170,10 @@ LLVMMetadataRef LLVMDIBuilderCreateParameterVariable(
537 - DINode::DIFlags Flags
538 - #endif
539 - ) {
540 --#if LLVM_VERSION_LE(3, 6)
541 -- DIBuilder *D = unwrap(Dref);
542 -- DIVariable V = D->createLocalVariable(
543 -- llvm::dwarf::DW_TAG_arg_variable, unwrapDI<DIDescriptor>(Scope), Name, unwrapDI<DIFile>(File), Line,
544 -- unwrapDI<DIType>(Ty), AlwaysPreserve, Flags, ArgNo);
545 -- return wrap(V);
546 --#else
547 - DILocalVariable *V = Dref->createParameterVariable
548 - (unwrapDI<DIDescriptor>(Scope), Name, ArgNo, unwrapDI<DIFile>(File), Line,
549 - unwrapDI<DIType>(Ty), AlwaysPreserve, Flags);
550 - return wrap(V);
551 --#endif
552 - }
553 -
554 - LLVMValueRef LLVMDIBuilderInsertDeclareAtEnd(DIBuilderRef Dref,
555 -@@ -278,46 +182,17 @@ LLVMValueRef LLVMDIBuilderInsertDeclareAtEnd(DIBuilderRef Dref,
556 - LLVMMetadataRef Expr,
557 - LLVMValueRef DL,
558 - LLVMBasicBlockRef Block) {
559 --#if LLVM_VERSION_EQ(3, 5)
560 -- DIBuilder *D = unwrap(Dref);
561 -- Instruction *Instr =
562 -- D->insertDeclare(unwrap(Storage), unwrapDI<DIVariable>(VarInfo),
563 -- unwrap(Block));
564 -- Instr->setDebugLoc(DebugLoc::getFromDILocation(cast<MDNode>(DL)));
565 --#endif
566 --
567 --#if LLVM_VERSION_EQ(3, 6)
568 -- DIBuilder *D = unwrap(Dref);
569 -- Instruction *Instr =
570 -- D->insertDeclare(unwrap(Storage), unwrapDI<DIVariable>(VarInfo),
571 -- unwrapDI<DIExpression>(Expr), unwrap(Block));
572 -- Instr->setDebugLoc(DebugLoc::getFromDILocation(cast<MDNode>(unwrap<MetadataAsValue>(DL)->getMetadata())));
573 --#endif
574 --
575 --#if LLVM_VERSION_GE(3, 7)
576 - Instruction *Instr =
577 - Dref->insertDeclare(unwrap(Storage), unwrap<DILocalVariable>(VarInfo),
578 - unwrapDI<DIExpression>(Expr),
579 - DebugLoc(cast<MDNode>(unwrap<MetadataAsValue>(DL)->getMetadata())),
580 - unwrap(Block));
581 --#endif
582 --
583 - return wrap(Instr);
584 - }
585 -
586 - LLVMMetadataRef LLVMDIBuilderCreateExpression(DIBuilderRef Dref, int64_t *Addr,
587 - size_t Length) {
588 --#if LLVM_VERSION_LE(3, 6)
589 --# if LLVM_VERSION_EQ(3, 5)
590 -- return nullptr;
591 --# else /* LLVM <= 3.6 && LLVM != 3.5 */
592 -- DIBuilder *D = unwrap(Dref);
593 -- DIExpression Expr = D->createExpression(ArrayRef<int64_t>(Addr, Length));
594 -- return wrap(Expr);
595 --# endif
596 --#else /* LLVM > 3.6 */
597 - return wrap(Dref->createExpression(ArrayRef<int64_t>(Addr, Length)));
598 --#endif
599 - }
600 -
601 - LLVMMetadataRef LLVMDIBuilderCreateEnumerationType(
602 -@@ -325,30 +200,16 @@ LLVMMetadataRef LLVMDIBuilderCreateEnumerationType(
603 - LLVMMetadataRef File, unsigned LineNumber, uint64_t SizeInBits,
604 - uint64_t AlignInBits, LLVMMetadataRef Elements,
605 - LLVMMetadataRef UnderlyingType) {
606 --#if LLVM_VERSION_LE(3, 6)
607 -- DIBuilder *D = unwrap(Dref);
608 -- DICompositeType enumType = D->createEnumerationType(
609 -- unwrapDI<DIDescriptor>(Scope), Name, unwrapDI<DIFile>(File), LineNumber,
610 -- SizeInBits, AlignInBits, unwrapDI<DIArray>(Elements),
611 -- unwrapDI<DIType>(UnderlyingType));
612 --#else
613 - DICompositeType *enumType = Dref->createEnumerationType(
614 - unwrapDI<DIDescriptor>(Scope), Name, unwrapDI<DIFile>(File), LineNumber,
615 - SizeInBits, AlignInBits, DINodeArray(unwrapDI<MDTuple>(Elements)),
616 - unwrapDI<DIType>(UnderlyingType));
617 --#endif
618 - return wrap(enumType);
619 - }
620 -
621 - LLVMMetadataRef LLVMDIBuilderCreateEnumerator(DIBuilderRef Dref,
622 - const char *Name, int64_t Value) {
623 --#if LLVM_VERSION_LE(3, 6)
624 -- DIBuilder *D = unwrap(Dref);
625 -- DIEnumerator e = D->createEnumerator(Name, Value);
626 -- return wrap(e);
627 --#else
628 - DIEnumerator *e = Dref->createEnumerator(Name, Value);
629 --#endif
630 - return wrap(e);
631 - }
632 -
633 -@@ -367,22 +228,13 @@ LLVMDIBuilderCreateStructType(DIBuilderRef Dref,
634 - #endif
635 - LLVMMetadataRef DerivedFrom,
636 - LLVMMetadataRef Elements) {
637 --#if LLVM_VERSION_LE(3, 6)
638 -- DIBuilder *D = unwrap(Dref);
639 -- DICompositeType CT = D->createStructType(
640 -- unwrapDI<DIDescriptor>(Scope), Name, unwrapDI<DIFile>(File), Line,
641 -- SizeInBits, AlignInBits, Flags, unwrapDI<DIType>(DerivedFrom),
642 -- unwrapDI<DIArray>(Elements));
643 --#else
644 - DICompositeType *CT = Dref->createStructType(
645 - unwrapDI<DIDescriptor>(Scope), Name, unwrapDI<DIFile>(File), Line,
646 - SizeInBits, AlignInBits, Flags, unwrapDI<DIType>(DerivedFrom),
647 - DINodeArray(unwrapDI<MDTuple>(Elements)));
648 --#endif
649 - return wrap(CT);
650 - }
651 -
652 --#if LLVM_VERSION_GE(3, 8)
653 - LLVMMetadataRef
654 - LLVMDIBuilderCreateReplaceableCompositeType(DIBuilderRef Dref,
655 - LLVMMetadataRef Scope,
656 -@@ -409,7 +261,6 @@ LLVMDIBuilderReplaceTemporary(DIBuilderRef Dref,
657 - llvm::TempMDNode fwd_decl(Node);
658 - Dref->replaceTemporary(std::move(fwd_decl), Type);
659 - }
660 --#endif
661 -
662 - LLVMMetadataRef
663 - LLVMDIBuilderCreateMemberType(DIBuilderRef Dref, LLVMMetadataRef Scope,
664 -@@ -422,16 +273,9 @@ LLVMDIBuilderCreateMemberType(DIBuilderRef Dref, LLVMMetadataRef Scope,
665 - DINode::DIFlags Flags,
666 - #endif
667 - LLVMMetadataRef Ty) {
668 --#if LLVM_VERSION_LE(3, 6)
669 -- DIBuilder *D = unwrap(Dref);
670 -- DIDerivedType DT = D->createMemberType(
671 -- unwrapDI<DIDescriptor>(Scope), Name, unwrapDI<DIFile>(File), Line,
672 -- SizeInBits, AlignInBits, OffsetInBits, Flags, unwrapDI<DIType>(Ty));
673 --#else
674 - DIDerivedType *DT = Dref->createMemberType(
675 - unwrapDI<DIDescriptor>(Scope), Name, unwrapDI<DIFile>(File), Line,
676 - SizeInBits, AlignInBits, OffsetInBits, Flags, unwrapDI<DIType>(Ty));
677 --#endif
678 - return wrap(DT);
679 - }
680 -
681 -@@ -440,39 +284,24 @@ LLVMMetadataRef LLVMDIBuilderCreatePointerType(DIBuilderRef Dref,
682 - uint64_t SizeInBits,
683 - uint64_t AlignInBits,
684 - const char *Name) {
685 --#if LLVM_VERSION_LE(3, 6)
686 -- DIBuilder *D = unwrap(Dref);
687 -- DIDerivedType T = D->createPointerType(unwrapDI<DIType>(PointeeType),
688 -- SizeInBits, AlignInBits, Name);
689 --#else
690 - DIDerivedType *T = Dref->createPointerType(unwrapDI<DIType>(PointeeType),
691 -- SizeInBits, AlignInBits, Name);
692 -+ SizeInBits, AlignInBits,
693 -+#if LLVM_VERSION_GE(5, 0)
694 -+ None,
695 - #endif
696 -+ Name);
697 - return wrap(T);
698 - }
699 -
700 - LLVMMetadataRef LLVMTemporaryMDNode(LLVMContextRef C, LLVMMetadataRef *MDs,
701 - unsigned Count) {
702 --#if LLVM_VERSION_LE(3, 6)
703 -- return wrap(MDNode::getTemporary(*unwrap(C),
704 -- ArrayRef<Metadata *>(unwrap(MDs), Count)));
705 --#else
706 - return wrap(MDTuple::getTemporary(*unwrap(C),
707 - ArrayRef<Metadata *>(unwrap(MDs), Count))
708 - .release());
709 --#endif
710 - }
711 -
712 - void LLVMMetadataReplaceAllUsesWith(LLVMMetadataRef MD, LLVMMetadataRef New) {
713 --#if LLVM_VERSION_LE(3, 6)
714 --# if LLVM_VERSION_EQ(3, 5)
715 - auto *Node = unwrap<MDNode>(MD);
716 --# else /* LLVM <= 3.6 && LLVM != 3.5 */
717 -- auto *Node = unwrap<MDNodeFwdDecl>(MD);
718 --# endif
719 --#else /* LLVM > 3.6 */
720 -- auto *Node = unwrap<MDNode>(MD);
721 --#endif
722 - Node->replaceAllUsesWith(unwrap<MDNode>(New));
723 - MDNode::deleteTemporary(Node);
724 - }
725 -diff --git a/src/llvm/function_pass_manager.cr b/src/llvm/function_pass_manager.cr
726 -index 979cb9c97..834d72a20 100644
727 ---- a/src/llvm/function_pass_manager.cr
728 -+++ b/src/llvm/function_pass_manager.cr
729 -@@ -2,12 +2,6 @@ class LLVM::FunctionPassManager
730 - def initialize(@unwrap : LibLLVM::PassManagerRef)
731 - end
732 -
733 -- {% if LibLLVM::IS_35 || LibLLVM::IS_36 %}
734 -- def add_target_data(target_data)
735 -- LibLLVM.add_target_data target_data, self
736 -- end
737 -- {% end %}
738 --
739 - def run(mod : Module)
740 - changed = false
741 - run do |runner|
742 -diff --git a/src/llvm/lib_llvm.cr b/src/llvm/lib_llvm.cr
743 -index e2c7a9445..5a0b67cdd 100644
744 ---- a/src/llvm/lib_llvm.cr
745 -+++ b/src/llvm/lib_llvm.cr
746 -@@ -6,8 +6,6 @@ lib LibLLVM
747 - (command -v llvm-config > /dev/null && (case "$(llvm-config --version)" in 3.9*) command -v llvm-config;; *) false;; esac)) || \
748 - command -v llvm-config-3.8 || command -v llvm-config38 || \
749 - (command -v llvm-config > /dev/null && (case "$(llvm-config --version)" in 3.8*) command -v llvm-config;; *) false;; esac)) || \
750 -- command -v llvm-config-3.6 || command -v llvm-config36 || \
751 -- command -v llvm-config-3.5 || command -v llvm-config35 || \
752 - command -v llvm-config
753 - `.chomp.stringify
754 - }}
755 -@@ -32,8 +30,6 @@ end
756 - IS_40 = {{LibLLVM::VERSION.starts_with?("4.0")}}
757 - IS_39 = {{LibLLVM::VERSION.starts_with?("3.9")}}
758 - IS_38 = {{LibLLVM::VERSION.starts_with?("3.8")}}
759 -- IS_36 = {{LibLLVM::VERSION.starts_with?("3.6")}}
760 -- IS_35 = {{LibLLVM::VERSION.starts_with?("3.5")}}
761 - end
762 - {% end %}
763 -
764 -@@ -283,9 +279,7 @@ lib LibLLVM
765 - fun set_alignment = LLVMSetAlignment(value : ValueRef, bytes : UInt32)
766 - fun get_return_type = LLVMGetReturnType(TypeRef) : TypeRef
767 -
768 -- {% unless LibLLVM::IS_35 %}
769 -- fun write_bitcode_to_memory_buffer = LLVMWriteBitcodeToMemoryBuffer(mod : ModuleRef) : MemoryBufferRef
770 -- {% end %}
771 -+ fun write_bitcode_to_memory_buffer = LLVMWriteBitcodeToMemoryBuffer(mod : ModuleRef) : MemoryBufferRef
772 -
773 - fun dispose_memory_buffer = LLVMDisposeMemoryBuffer(buf : MemoryBufferRef) : Void
774 - fun get_buffer_start = LLVMGetBufferStart(buf : MemoryBufferRef) : UInt8*
775 -@@ -293,26 +287,22 @@ lib LibLLVM
776 -
777 - fun write_bitcode_to_fd = LLVMWriteBitcodeToFD(mod : ModuleRef, fd : LibC::Int, should_close : LibC::Int, unbuffered : LibC::Int) : LibC::Int
778 -
779 -- {% if LibLLVM::IS_36 || LibLLVM::IS_35 %}
780 -- fun add_target_data = LLVMAddTargetData(td : TargetDataRef, pm : PassManagerRef)
781 -- {% end %}
782 --
783 -- {% if LibLLVM::IS_38 || LibLLVM::IS_36 || LibLLVM::IS_35 %}
784 -+ {% if LibLLVM::IS_38 %}
785 - fun copy_string_rep_of_target_data = LLVMCopyStringRepOfTargetData(data : TargetDataRef) : UInt8*
786 - fun get_target_machine_data = LLVMGetTargetMachineData(t : TargetMachineRef) : TargetDataRef
787 - fun set_data_layout = LLVMSetDataLayout(mod : ModuleRef, data : UInt8*)
788 -- {% else %}
789 -+ {% else %} # LLVM >= 3.9
790 - fun create_target_data_layout = LLVMCreateTargetDataLayout(t : TargetMachineRef) : TargetDataRef
791 - fun set_module_data_layout = LLVMSetModuleDataLayout(mod : ModuleRef, data : TargetDataRef)
792 - {% end %}
793 -
794 -- {% if LibLLVM::IS_38 || LibLLVM::IS_36 || LibLLVM::IS_35 %}
795 -+ {% if LibLLVM::IS_38 %}
796 - fun add_attribute = LLVMAddAttribute(arg : ValueRef, attr : LLVM::Attribute)
797 - fun add_instr_attribute = LLVMAddInstrAttribute(instr : ValueRef, index : UInt32, attr : LLVM::Attribute)
798 - fun add_function_attr = LLVMAddFunctionAttr(fn : ValueRef, pa : LLVM::Attribute)
799 - fun get_function_attr = LLVMGetFunctionAttr(fn : ValueRef) : LLVM::Attribute
800 - fun get_attribute = LLVMGetAttribute(arg : ValueRef) : LLVM::Attribute
801 -- {% else %}
802 -+ {% else %} # LLVM >= 3.9
803 - type AttributeRef = Void*
804 - alias AttributeIndex = UInt
805 -
806 -diff --git a/src/llvm/lib_llvm_ext.cr b/src/llvm/lib_llvm_ext.cr
807 -index 84c65cccb..953567eb8 100644
808 ---- a/src/llvm/lib_llvm_ext.cr
809 -+++ b/src/llvm/lib_llvm_ext.cr
810 -@@ -13,19 +13,11 @@ lib LibLLVMExt
811 - fun create_di_builder = LLVMNewDIBuilder(LibLLVM::ModuleRef) : DIBuilder
812 - fun di_builder_finalize = LLVMDIBuilderFinalize(DIBuilder)
813 -
814 -- {% if LibLLVM::IS_36 || LibLLVM::IS_35 %}
815 -- fun di_builder_create_function = LLVMDIBuilderCreateFunction(
816 -- builder : DIBuilder, scope : Metadata, name : Char*,
817 -- linkage_name : Char*, file : Metadata, line : UInt,
818 -- composite_type : Metadata, is_local_to_unit : Int, is_definition : Int,
819 -- scope_line : UInt, flags : LLVM::DIFlags, is_optimized : Int, func : LibLLVM::ValueRef) : Metadata
820 -- {% else %}
821 -- fun di_builder_create_function = LLVMDIBuilderCreateFunction(
822 -- builder : DIBuilder, scope : Metadata, name : Char*,
823 -- linkage_name : Char*, file : Metadata, line : UInt,
824 -- composite_type : Metadata, is_local_to_unit : Bool, is_definition : Bool,
825 -- scope_line : UInt, flags : LLVM::DIFlags, is_optimized : Bool, func : LibLLVM::ValueRef) : Metadata
826 -- {% end %}
827 -+ fun di_builder_create_function = LLVMDIBuilderCreateFunction(
828 -+ builder : DIBuilder, scope : Metadata, name : Char*,
829 -+ linkage_name : Char*, file : Metadata, line : UInt,
830 -+ composite_type : Metadata, is_local_to_unit : Bool, is_definition : Bool,
831 -+ scope_line : UInt, flags : LLVM::DIFlags, is_optimized : Bool, func : LibLLVM::ValueRef) : Metadata
832 -
833 - fun di_builder_create_file = LLVMDIBuilderCreateFile(builder : DIBuilder, file : Char*, dir : Char*) : Metadata
834 - fun di_builder_create_compile_unit = LLVMDIBuilderCreateCompileUnit(builder : DIBuilder,
835 -@@ -94,17 +86,12 @@ lib LibLLVMExt
836 - align_in_bits : UInt64,
837 - name : Char*) : Metadata
838 -
839 -- {% if LibLLVM::IS_35 || LibLLVM::IS_36 %}
840 -- fun temporary_md_node = LLVMTemporaryMDNode(context : LibLLVM::ContextRef, mds : Metadata*, count : UInt) : Metadata
841 -- fun metadata_replace_all_uses_with = LLVMMetadataReplaceAllUsesWith(Metadata, Metadata)
842 -- {% else %}
843 -- fun di_builder_create_replaceable_composite_type = LLVMDIBuilderCreateReplaceableCompositeType(builder : DIBuilder,
844 -- scope : Metadata,
845 -- name : Char*,
846 -- file : Metadata,
847 -- line : UInt) : Metadata
848 -- fun di_builder_replace_temporary = LLVMDIBuilderReplaceTemporary(builder : DIBuilder, from : Metadata, to : Metadata)
849 -- {% end %}
850 -+ fun di_builder_create_replaceable_composite_type = LLVMDIBuilderCreateReplaceableCompositeType(builder : DIBuilder,
851 -+ scope : Metadata,
852 -+ name : Char*,
853 -+ file : Metadata,
854 -+ line : UInt) : Metadata
855 -+ fun di_builder_replace_temporary = LLVMDIBuilderReplaceTemporary(builder : DIBuilder, from : Metadata, to : Metadata)
856 -
857 - fun set_current_debug_location = LLVMSetCurrentDebugLocation2(LibLLVM::BuilderRef, Int, Int, Metadata, Metadata)
858 -
859 -diff --git a/src/llvm/module.cr b/src/llvm/module.cr
860 -index cb71e3b21..c15a56e77 100644
861 ---- a/src/llvm/module.cr
862 -+++ b/src/llvm/module.cr
863 -@@ -6,7 +6,7 @@ class LLVM::Module
864 -
865 - getter context : Context
866 -
867 -- {% if LibLLVM::IS_38 || LibLLVM::IS_36 || LibLLVM::IS_35 %}
868 -+ {% if LibLLVM::IS_38 %}
869 - def initialize(@unwrap : LibLLVM::ModuleRef, @name : String, @context : Context)
870 - @owned = false
871 - end
872 -@@ -14,7 +14,7 @@ class LLVM::Module
873 - def name : String
874 - @name
875 - end
876 -- {% else %}
877 -+ {% else %} # LLVM >= 3.9
878 - def initialize(@unwrap : LibLLVM::ModuleRef, @context : Context)
879 - @owned = false
880 - end
881 -@@ -34,9 +34,9 @@ class LLVM::Module
882 - end
883 -
884 - def data_layout=(data : TargetData)
885 -- {% if LibLLVM::IS_38 || LibLLVM::IS_36 || LibLLVM::IS_35 %}
886 -+ {% if LibLLVM::IS_38 %}
887 - LibLLVM.set_data_layout(self, data.to_data_layout_string)
888 -- {% else %}
889 -+ {% else %} # LLVM >= 3.9
890 - LibLLVM.set_module_data_layout(self, data)
891 - {% end %}
892 - end
893 -@@ -57,11 +57,9 @@ class LLVM::Module
894 - LibLLVM.write_bitcode_to_file self, filename
895 - end
896 -
897 -- {% unless LibLLVM::IS_35 %}
898 -- def write_bitcode_to_memory_buffer
899 -- MemoryBuffer.new(LibLLVM.write_bitcode_to_memory_buffer self)
900 -- end
901 -- {% end %}
902 -+ def write_bitcode_to_memory_buffer
903 -+ MemoryBuffer.new(LibLLVM.write_bitcode_to_memory_buffer self)
904 -+ end
905 -
906 - def write_bitcode_to_fd(fd : Int, should_close = false, buffered = false)
907 - LibLLVM.write_bitcode_to_fd(self, fd, should_close ? 1 : 0, buffered ? 1 : 0)
908 -diff --git a/src/llvm/module_pass_manager.cr b/src/llvm/module_pass_manager.cr
909 -index 10bfa60bd..519227809 100644
910 ---- a/src/llvm/module_pass_manager.cr
911 -+++ b/src/llvm/module_pass_manager.cr
912 -@@ -3,12 +3,6 @@ class LLVM::ModulePassManager
913 - @unwrap = LibLLVM.pass_manager_create
914 - end
915 -
916 -- {% if LibLLVM::IS_35 || LibLLVM::IS_36 %}
917 -- def add_target_data(target_data)
918 -- LibLLVM.add_target_data target_data, self
919 -- end
920 -- {% end %}
921 --
922 - def run(mod)
923 - LibLLVM.run_pass_manager(self, mod) != 0
924 - end
925 -diff --git a/src/llvm/target_machine.cr b/src/llvm/target_machine.cr
926 -index e4bb081e9..42e44abe2 100644
927 ---- a/src/llvm/target_machine.cr
928 -+++ b/src/llvm/target_machine.cr
929 -@@ -9,9 +9,9 @@ class LLVM::TargetMachine
930 -
931 - def data_layout
932 - @layout ||= begin
933 -- layout = {% if LibLLVM::IS_38 || LibLLVM::IS_36 || LibLLVM::IS_35 %}
934 -+ layout = {% if LibLLVM::IS_38 %}
935 - LibLLVM.get_target_machine_data(self)
936 -- {% else %}
937 -+ {% else %} # LLVM >= 3.9
938 - LibLLVM.create_target_data_layout(self)
939 - {% end %}
940 - layout ? TargetData.new(layout) : raise "Missing layout for #{self}"
941 ---
942 -2.14.1
943 -